Project

General

Profile

Season selection in multi year means - month cross-over

Added by Nathanael Harwood over 5 years ago

Hi all,

Thanks to this forum, I have made multi-year means of 5-day averages for 30 odd years of data.

When I use:

cdo -timselmean,5 -select,season=DJF -ydaymean CDOTEST.nc CDOTEST_MULTIY.nc

It gives me a timestep (12) from 02-25 to 12-01 which is not okay, obviously 1st Dec will skew that Feb 5-day mean. This doesn't matter when it involves timesteps from Dec-Jan, or Jan-Feb for example, and there are 90 days in total for DJF (with 29 Feb removed).

Is there any way of getting multi-year averages using -ydaymean to be in the order DJF? Or perhaps I should try a different -select code? (2 year subset of data attached)

Many thanks,

NH


Replies (15)

RE: Season selection in multi year means - month cross-over - Added by Karin Meier-Fleischer over 5 years ago

Hi Nathanael,

you are using ydaymean which calculates the yearly day mean but you should use daymean instead. To remove the first and last incomplete season you can use the select operator, too.

cdo -select,season=DJF -daymean CDOTEST.nc tmp.nc

cdo -timselmean,5 -select,startdate=2010-12-01,enddate=2011-02-28 tmp.nc outfile.nc

cdo infon outfile.nc 
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter name
     1 : 2010-12-03 00:00:00       0    32760       0 :      241.89      271.73      298.28 : t             
     2 : 2010-12-08 00:00:00       0    32760       0 :      241.76      271.58      296.45 : t             
     3 : 2010-12-13 00:00:00       0    32760       0 :      235.62      271.66      297.30 : t             
     4 : 2010-12-18 00:00:00       0    32760       0 :      239.58      271.53      297.37 : t             
     5 : 2010-12-23 00:00:00       0    32760       0 :      239.95      271.46      298.12 : t             
     6 : 2010-12-28 00:00:00       0    32760       0 :      240.47      270.27      296.57 : t             
     7 : 2011-01-02 00:00:00       0    32760       0 :      243.87      270.47      297.32 : t             
     8 : 2011-01-07 00:00:00       0    32760       0 :      236.10      271.05      298.33 : t             
     9 : 2011-01-12 00:00:00       0    32760       0 :      237.22      271.20      296.79 : t             
    10 : 2011-01-17 00:00:00       0    32760       0 :      244.79      270.25      296.66 : t             
    11 : 2011-01-22 00:00:00       0    32760       0 :      238.24      270.26      297.89 : t             
    12 : 2011-01-27 00:00:00       0    32760       0 :      239.44      269.50      297.65 : t             
    13 : 2011-02-01 00:00:00       0    32760       0 :      238.20      269.99      298.26 : t             
    14 : 2011-02-06 00:00:00       0    32760       0 :      240.46      270.31      300.76 : t             
    15 : 2011-02-11 00:00:00       0    32760       0 :      239.69      270.77      299.75 : t             
    16 : 2011-02-16 00:00:00       0    32760       0 :      233.05      271.75      300.11 : t             
    17 : 2011-02-21 00:00:00       0    32760       0 :      235.28      270.02      301.53 : t             
    18 : 2011-02-26 00:00:00       0    32760       0 :      241.37      270.30      300.55 : t             
cdo infon: Processed 589680 values from 1 variable over 18 timesteps ( 0.01s 14MB )

-Karin

RE: Season selection in multi year means - month cross-over - Added by Nathanael Harwood over 5 years ago

Hi Karin,

Maybe I didn't word the question well - I am trying to get multi-year mean of the data, hence the use of ydaymean

I need multi-year means of 5 day averages to create anomalies from. When you use ydaymean, it puts it in the order JF...D when I need it DJF because I can't have a timestep which crosses over from Feb to Dec, as I currently have (02-25 to 12-01)

The crossover is the result of the ordering of the months with ydaymean output, and can't be resolved by removing incomplete seasons because it's multi-year

Thanks for your help,

Nathanael

RE: Season selection in multi year means - month cross-over - Added by Nathanael Harwood over 5 years ago

Sorry to plug this question, but can someone tell me whether the above is possible in CDO?

i.e. Can you generate multi-year means of 5-day averages in data from months DJF without the timesteps crossing over from Feb to Dec?

Many thanks,

NH

RE: Season selection in multi year means - month cross-over - Added by Karin Meier-Fleischer over 5 years ago

Hi Nathanael,

did you have a look at the output of ydaymean?

cdo -ydaymean CDOTEST.nc tmp_y.nc

cdo infon tmp_y.nc 
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter name
     1 : 2011-01-01 00:00:00       0    32760       0 :      239.93      271.02      297.27 : t             
     2 : 2011-01-02 00:00:00       0    32760       0 :      240.68      270.84      296.77 : t             
     3 : 2011-01-03 00:00:00       0    32760       0 :      241.93      270.63      297.22 : t             
     4 : 2011-01-04 00:00:00       0    32760       0 :      242.66      270.41      297.07 : t             
     5 : 2011-01-05 00:00:00       0    32760       0 :      243.99      270.44      297.20 : t             
     6 : 2011-01-06 00:00:00       0    32760       0 :      240.49      270.58      296.94 : t             
     7 : 2011-01-07 00:00:00       0    32760       0 :      239.37      270.50      297.05 : t             
     8 : 2011-01-08 00:00:00       0    32760       0 :      241.24      270.57      297.36 : t             
     9 : 2011-01-09 00:00:00       0    32760       0 :      239.79      270.68      296.08 : t             
    10 : 2011-01-10 00:00:00       0    32760       0 :      238.46      270.33      295.88 : t             
    11 : 2011-01-11 00:00:00       0    32760       0 :      237.50      270.51      296.73 : t             
    12 : 2011-01-12 00:00:00       0    32760       0 :      237.95      270.44      296.74 : t             
    13 : 2011-01-13 00:00:00       0    32760       0 :      237.26      270.60      297.79 : t             
    14 : 2011-01-14 00:00:00       0    32760       0 :      242.98      270.58      298.13 : t             
    15 : 2011-01-15 00:00:00       0    32760       0 :      243.00      270.31      298.32 : t
....
   355 : 2011-12-21 00:00:00       0    32760       0 :      238.96      271.90      297.75 : t             
   356 : 2011-12-22 00:00:00       0    32760       0 :      237.63      271.90      297.69 : t             
   357 : 2011-12-23 00:00:00       0    32760       0 :      237.68      271.45      298.08 : t             
   358 : 2011-12-24 00:00:00       0    32760       0 :      239.45      271.11      297.74 : t             
   359 : 2011-12-25 00:00:00       0    32760       0 :      242.90      270.80      297.54 : t             
   360 : 2011-12-26 00:00:00       0    32760       0 :      244.31      270.50      297.02 : t             
   361 : 2011-12-27 00:00:00       0    32760       0 :      244.50      270.49      297.03 : t             
   362 : 2011-12-28 00:00:00       0    32760       0 :      243.58      270.43      297.24 : t             
   363 : 2011-12-29 00:00:00       0    32760       0 :      244.28      270.45      298.10 : t             
   364 : 2011-12-30 00:00:00       0    32760       0 :      244.79      270.51      297.40 : t             
   365 : 2011-12-31 00:00:00       0    32760       0 :      244.37      270.37      297.42 : t

The computed yearly mean of the multi-year CDOTEST.nc file (years: 2010-2011) will be stored
month 1-12 with the date of the last year. There is no way to get DJF from ydaymean because
you have month 1 and 2 and the month 12 of the ydaymean year 2011. Therefore, you should do
the ydaymean at the end of the computation.

I've tested the next with my own test multi-year daily data file because yours have only
2 years which is for season testing purposes too little.

cdo -timselmean,5 myfile.nc tmp.nc
cdo -ydaymean -select,season=DJF tmp.nc outfile.nc
cdo info outfile.nc
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter ID
     1 : 2009-01-02 12:00:00       2    18432       0 :      220.59      277.33      310.66 : -1            
     2 : 2008-01-03 12:00:00       2    18432       0 :      230.87      276.91      309.03 : -1            
     3 : 2009-01-07 12:00:00       2    18432       0 :      224.15      277.20      310.54 : -1            
     4 : 2008-01-08 12:00:00       2    18432       0 :      230.90      276.86      308.00 : -1            
     5 : 2009-01-12 12:00:00       2    18432       0 :      225.83      277.40      308.97 : -1            
     6 : 2008-01-13 12:00:00       2    18432       0 :      229.84      276.93      306.57 : -1            
     7 : 2009-01-17 12:00:00       2    18432       0 :      225.35      277.53      307.62 : -1            
     8 : 2008-01-18 12:00:00       2    18432       0 :      229.82      277.05      308.32 : -1            
     9 : 2009-01-22 12:00:00       2    18432       0 :      227.78      277.27      308.69 : -1            
    10 : 2008-01-23 12:00:00       2    18432       0 :      229.09      277.14      307.60 : -1            
    11 : 2009-01-27 12:00:00       2    18432       0 :      228.63      277.22      307.76 : -1            
    12 : 2008-01-28 12:00:00       2    18432       0 :      228.65      276.94      307.88 : -1            
    13 : 2009-02-01 12:00:00       2    18432       0 :      229.68      277.13      310.05 : -1            
    14 : 2008-02-02 12:00:00       2    18432       0 :      227.72      276.81      307.56 : -1            
    15 : 2009-02-06 12:00:00       2    18432       0 :      226.33      277.01      310.77 : -1            
    16 : 2008-02-07 12:00:00       2    18432       0 :      225.32      276.66      306.91 : -1            
    17 : 2009-02-11 12:00:00       2    18432       0 :      225.43      276.82      307.70 : -1            
    18 : 2008-02-12 12:00:00       2    18432       0 :      225.23      276.63      307.37 : -1            
    19 : 2009-02-16 12:00:00       2    18432       0 :      224.72      276.65      309.76 : -1            
    20 : 2008-02-17 12:00:00       2    18432       0 :      225.22      276.61      307.17 : -1            
    21 : 2009-02-21 12:00:00       2    18432       0 :      220.33      276.38      309.65 : -1            
    22 : 2008-02-22 12:00:00       2    18432       0 :      222.66      276.91      306.12 : -1            
    23 : 2009-02-26 12:00:00       2    18432       0 :      218.15      276.82      308.13 : -1            
    24 : 2008-02-27 12:00:00       2    18432       0 :      225.18      277.31      308.34 : -1            
    25 : 2009-12-03 12:00:00       2    18432       0 :      230.51      277.56      309.74 : -1            
    26 : 2007-12-04 12:00:00       2    18432       0 :      227.52      277.52      308.77 : -1            
    27 : 2009-12-08 12:00:00       2    18432       0 :      230.19      277.37      308.48 : -1            
    28 : 2007-12-09 12:00:00       2    18432       0 :      230.77      277.47      309.67 : -1            
    29 : 2009-12-13 12:00:00       2    18432       0 :      229.47      277.37      307.93 : -1            
    30 : 2007-12-14 12:00:00       2    18432       0 :      229.44      277.29      307.52 : -1            
    31 : 2009-12-18 12:00:00       2    18432       0 :      230.07      277.64      310.00 : -1            
    32 : 2007-12-19 12:00:00       2    18432       0 :      229.64      277.03      306.76 : -1            
    33 : 2009-12-23 12:00:00       2    18432       0 :      231.92      277.41      311.45 : -1            
    34 : 2007-12-24 12:00:00       2    18432       0 :      230.02      277.31      308.06 : -1            
    35 : 2009-12-28 12:00:00       2    18432       0 :      235.66      277.40      309.62 : -1            
    36 : 2007-12-29 12:00:00       2    18432       0 :      230.58      276.96      308.57 : -1            
    37 : 2009-12-31 12:00:00       2    18432       0 :      226.76      276.83      313.45 : -1            
cdo info: Processed 681984 values from 1 variable over 37 timesteps ( 0.00s 20MB )

As you can see there is a problem with the years. It seems that the months/days and the DJF
data is ok but the years written to the file are mixed up.

@Uwe do you know what is going on?

-Karin

RE: Season selection in multi year means - month cross-over - Added by Nathanael Harwood over 5 years ago

Hi Karin

Thanks for trying that on your data - using your code above, mine doesn't have the year problem (it lists the final year of the dataset for that month - below)

But it still gives incorrect timesteps for the end of Feb - 12 and 13 - and 13 still crosses over into December as it is the mean of 02-25 to 12-01

There's no way of getting the data to be in order D-J-F for multiyear means? That would solve the problem I think

Many thanks for your help,

NH

 -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean                                                             Maximum : Parameter ID
     1 : 2018-01-03 00:00:00       0    32760       0 :      245.04      270.55                                                              296.16 : -1
     2 : 2018-01-08 00:00:00       0    32760       0 :      244.43      270.34                                                              296.11 : -1
     3 : 2018-01-13 00:00:00       0    32760       0 :      244.64      270.13                                                              296.11 : -1
     4 : 2018-01-18 00:00:00       0    32760       0 :      244.85      270.11                                                              296.19 : -1
     5 : 2018-01-23 00:00:00       0    32760       0 :      243.99      270.06                                                              296.52 : -1
     6 : 2018-01-28 00:00:00       0    32760       0 :      245.15      270.14                                                              296.87 : -1
     7 : 2018-02-02 00:00:00       0    32760       0 :      243.89      270.18                                                              297.16 : -1
     8 : 2018-02-07 00:00:00       0    32760       0 :      244.63      270.27                                                              297.42 : -1
     9 : 2018-02-12 00:00:00       0    32760       0 :      244.75      270.40                                                              297.48 : -1
    10 : 2018-02-17 00:00:00       0    32760       0 :      244.94      270.48                                                              297.96 : -1
    11 : 2018-02-22 00:00:00       0    32760       0 :      245.28      270.48                                                              298.44 : -1
    12 : 2018-02-26 12:00:00       0    32760       0 :      244.63      271.43                                                              301.34 : -1
    13 : 2017-02-27 00:00:00       0    32760       0 :      245.56      270.63                                                              298.69 : -1
    14 : 2017-12-04 00:00:00       0    32760       0 :      246.24      271.88                                                              296.45 : -1
    15 : 2017-12-09 00:00:00       0    32760       0 :      245.96      271.63                                                              296.51 : -1
    16 : 2017-12-14 00:00:00       0    32760       0 :      244.43      271.41                                                              296.44 : -1
    17 : 2017-12-19 00:00:00       0    32760       0 :      244.23      271.12                                                              296.21 : -1
    18 : 2017-12-24 00:00:00       0    32760       0 :      245.12      270.92                                                              296.20 : -1
    19 : 2017-12-29 00:00:00       0    32760       0 :      245.61      270.73                                                              296.15 : -1
cdo info: Processed 622440 values from 1 variable over 19 timesteps [0.00s 8424K                                                        B]

RE: Season selection in multi year means - month cross-over - Added by Uwe Schulzweida over 5 years ago

Here is an example to change JFD to DJF:

cdo cat -selmon,12 infile  -selmon,1,2  infile  outfile

RE: Season selection in multi year means - month cross-over - Added by Nathanael Harwood over 5 years ago

Hi Uwe,

Thanks for that - unfortunately, running that code puts all Decembers together, and then J and F normally after all Decs: (sinfo output)

This means that the -timselmean,5 for 5 day means gives a timestep that overlaps from Dec 1979 to Dec 1980.

 1979-12-01 00:00:00  1979-12-02 00:00:00  1979-12-03 00:00:00  1979-12-04 00:00:00
  1979-12-05 00:00:00  1979-12-06 00:00:00  1979-12-07 00:00:00  1979-12-08 00:00:00
  1979-12-09 00:00:00  1979-12-10 00:00:00  1979-12-11 00:00:00  1979-12-12 00:00:00
  1979-12-13 00:00:00  1979-12-14 00:00:00  1979-12-15 00:00:00  1979-12-16 00:00:00
  1979-12-17 00:00:00  1979-12-18 00:00:00  1979-12-19 00:00:00  1979-12-20 00:00:00
  1979-12-21 00:00:00  1979-12-22 00:00:00  1979-12-23 00:00:00  1979-12-24 00:00:00
  1979-12-25 00:00:00  1979-12-26 00:00:00  1979-12-27 00:00:00  1979-12-28 00:00:00
  1979-12-29 00:00:00  1979-12-30 00:00:00  1979-12-31 00:00:00  1980-12-01 00:00:00
  1980-12-02 00:00:00  1980-12-03 00:00:00  1980-12-04 00:00:00  1980-12-05 00:00:00
  1980-12-06 00:00:00  1980-12-07 00:00:00  1980-12-08 00:00:00  1980-12-09 00:00:00
  1980-12-10 00:00:00  1980-12-11 00:00:00  1980-12-12 00:00:00  1980-12-13 00:00:00
  1980-12-14 00:00:00  1980-12-15 00:00:00  1980-12-16 00:00:00  1980-12-17 00:00:00
  1980-12-18 00:00:00  1980-12-19 00:00:00  1980-12-20 00:00:00  1980-12-21 00:00:00
  1980-12-22 00:00:00  1980-12-23 00:00:00  1980-12-24 00:00:00  1980-12-25 00:00:00
  1980-12-26 00:00:00  1980-12-27 00:00:00  1980-12-28 00:00:00  1980-12-29 00:00:00
   ................................................................................

I have also tried -shifttime,-2mo on my data so that DJF would be OND, and then the 5-day means would run as I want and split the 90 days appropriately, but this fails because (for example) the 31st of Jan is removed when it becomes Nov because Nov can't have 31 days.

I would appreciate any help on this, especially if I'm wrong about any of the above

Cheers,
NH

RE: Season selection in multi year means - month cross-over - Added by Ralf Mueller over 5 years ago

hi!

you might use the timsort at the very end of the operators chain - could that help??

cheers
ralf

RE: Season selection in multi year means - month cross-over - Added by Uwe Schulzweida over 5 years ago

I would propose to remove the 29th of February with the operator del29feb.

RE: Season selection in multi year means - month cross-over - Added by Nathanael Harwood over 5 years ago

Hi,

Thanks for the suggestions all - timsort doesn't work either on its own after all operators, or chained with -ydaymean unfortunately.

I have already removed the 29th Feb to make DJF a perfect 90 straight days, thanks for suggesting

I can get perfect 5 day means for DJF by doing the following:

cdo -select,season=DJF -select,startdate=1979-12-01 850t_del29feb.nc temp.nc
cdo timselmean,5 temp.nc temp_5day.nc  

   1979-12-03 00:00:00  1979-12-08 00:00:00  1979-12-13 00:00:00  1979-12-18 00:0                                                                                                                                                                                               0:00
  1979-12-23 00:00:00  1979-12-28 00:00:00  1980-01-02 00:00:00  1980-01-07 00:0                                                                                                                                                                                               0:00
  1980-01-12 00:00:00  1980-01-17 00:00:00  1980-01-22 00:00:00  1980-01-27 00:0                                                                                                                                                                                               0:00
  1980-02-01 00:00:00  1980-02-06 00:00:00  1980-02-11 00:00:00  1980-02-16 00:0                                                                                                                                                                                               0:00
  1980-02-21 00:00:00  1980-02-26 00:00:00  1980-12-03 00:00:00  1980-12-08 00:0                                                                                                                                                                                               0:00
  1980-12-13 00:00:00  1980-12-18 00:00:00  1980-12-23 00:00:00  1980-12-28 00:0                                                                                                                                                                                               0:00
  1981-01-02 00:00:00  1981-01-07 00:00:00  1981-01-12 00:00:00  1981-01-17 00:0                                                                                                                                                                                               0:00
  1981-01-22 00:00:00  1981-01-27 00:00:00  1981-02-01 00:00:00  1981-02-06 00:0                                                                                                                                                                                               0:00
  1981-02-11 00:00:00  1981-02-16 00:00:00  1981-02-21 00:00:00  1981-02-26 00:0                                                                                                                                                                                               0:00
  1981-12-03 00:00:00  1981-12-08 00:00:00  1981-12-13 00:00:00  1981-12-18 00:0                                                                                                                                                                                               0:00
  1981-12-23 00:00:00  1981-12-28 00:00:00  1982-01-02 00:00:00  1982-01-07 00:0                                                                                                                                                                                               0:00
  1982-01-12 00:00:00  1982-01-17 00:00:00  1982-01-22 00:00:00  1982-01-27 00:0                                                                                                                                                                                               0:00
  1982-02-01 00:00:00  1982-02-06 00:00:00  1982-02-11 00:00:00  1982-02-16 00:0                                                                                                                                                                                               0:00
  1982-02-21 00:00:00  1982-02-26 00:00:00  1982-12-03 00:00:00  1982-12-08 00:0                                                                                                                                                                                               0:00
  1982-12-13 00:00:00  1982-12-18 00:00:00  1982-12-23 00:00:00  1982-12-28 00:0                                                                                                                                                                                               0:00
   .............................................................................                                                                                                                                                                                               ...
   ...................................................

But using ydaymean on that doesn't work - it returns the same Feb-Dec overlap problem as above.

If anyone knows any way forward with this I'd appreciate - I'm happy to provide a (spatial) subset with the full 38 years for the problem

Many thanks,
NH

RE: Season selection in multi year means - month cross-over - Added by Ralf Mueller over 5 years ago

i checked with some synthetic field and found this


% cdo showyear $ifile                                                                                                                                                                     [Thu 2018-09-06|11:37:08]
 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028
cdo showyear: Processed 1 variable over 10000 timesteps [0.01s 48MB]

% cdo -mergetime -selmon,12 $ifile -selmon,1,2 $ifile __out.nc                                                                                                                            [Thu 2018-09-06|11:36:21]
cdo(2) selmonth: Process started
cdo(3) selmonth: Process started
cdo(2) selmonth: Processed 837 values from 1 variable over 10000 timesteps
cdo(3) selmonth: Processed 1600 values from 1 variable over 10000 timesteps
cdo mergetime: Processed 2437 values from 2 variables over 1600 timesteps [0.12s 53MB]
<ram@melian:~/Downloads>
% cdo showmon `lf`                                                                                                                                                                        [Thu 2018-09-06|11:37:06]
 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2 12  1  2
cdo showmon: Processed 1 variable over 2437 timesteps [0.01s 45MB]

does this look useful to you?

cheers
ralf

RE: Season selection in multi year means - month cross-over - Added by Nathanael Harwood over 5 years ago

Hi Ralf,

Thanks for the help - I can get the above month structure (12 1 2) by chaining -select,season=DJF and -select,startdate=1979-12-01

But ydaymean doesn't then work on that as it reverts to the JFD structure again, a big problem as my 5-day means require a DJF order

If there's any way ydaymean can use DJF, I'd love to find it

Cheers,
NH

RE: Season selection in multi year means - month cross-over - Added by Karin Meier-Fleischer over 5 years ago

Hi Nathanael and Ralf,

may I weigh in here again. The following works now with my data:

cdo -O -select,season=DJF,startdate=2006-12-01,enddate=2009-02-28 -del29feb myfile.nc t1.nc
cdo -O -timselmean,5  t1.nc t2.nc
cdo -O -ydaymean t2.nc t3.nc
cdo -O -mergetime -selmon,12 t3.nc -selmon,1,2 t3.nc t4.nc

cdo infon t4.nc
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter name
     1 : 2008-12-03 12:00:00       2    18432       0 :      227.04      277.50      308.74 : tas           
     2 : 2008-12-08 12:00:00       2    18432       0 :      230.24      277.44      308.66 : tas           
     3 : 2008-12-13 12:00:00       2    18432       0 :      229.52      277.38      307.28 : tas           
     4 : 2008-12-18 12:00:00       2    18432       0 :      230.13      277.31      307.39 : tas           
     5 : 2008-12-23 12:00:00       2    18432       0 :      229.66      277.44      309.03 : tas           
     6 : 2008-12-28 12:00:00       2    18432       0 :      231.06      277.18      309.06 : tas           
     7 : 2009-01-02 12:00:00       2    18432       0 :      228.17      276.99      309.93 : tas           
     8 : 2009-01-07 12:00:00       2    18432       0 :      226.90      276.96      308.22 : tas           
     9 : 2009-01-12 12:00:00       2    18432       0 :      228.52      277.09      306.96 : tas           
    10 : 2009-01-17 12:00:00       2    18432       0 :      229.09      277.31      308.10 : tas           
    11 : 2009-01-22 12:00:00       2    18432       0 :      230.69      277.30      308.20 : tas           
    12 : 2009-01-27 12:00:00       2    18432       0 :      229.46      277.27      307.72 : tas           
    13 : 2009-02-01 12:00:00       2    18432       0 :      229.72      277.10      309.12 : tas           
    14 : 2009-02-06 12:00:00       2    18432       0 :      226.27      276.86      306.62 : tas           
    15 : 2009-02-11 12:00:00       2    18432       0 :      226.53      276.68      307.28 : tas           
    16 : 2009-02-16 12:00:00       2    18432       0 :      225.80      276.63      309.52 : tas           
    17 : 2009-02-21 12:00:00       2    18432       0 :      222.61      276.66      308.62 : tas           
    18 : 2009-02-26 12:00:00       2    18432       0 :      222.04      277.17      308.09 : tas           
cdo infon: Processed 331776 values from 1 variable over 18 timesteps ( 0.01s 14MB )

-Karin

RE: Season selection in multi year means - month cross-over - Added by Nathanael Harwood over 5 years ago

Thank you so much people! Karin those steps work perfectly on my data. Ralf - sorry I missed where the mergetime etc operators were supposed to go

It is a massive relief to know I can do this all within CDO.

One last thing if I may - to subtract my 5-day time series from the multiyear mean created above, I tried this to generate anomalies:

cdo -b 32 -ydaysub temp_5day.nc temp_multiyear.nc temp_anomaly.nc 
cdo ydaysub (Abort): Day of year 65 not found (date=19800303)!

I wonder if ydaysub will have problems given that the time series has timesteps like 1979-12-01 - 1979-12-05 whereas the multiyear mean just has 1979-12-03 for the same step

Many thanks,
NH

RE: Season selection in multi year means - month cross-over - Added by Nathanael Harwood over 5 years ago

Just for the sake of completeness, so that someone can follow all the steps through to create anomalies in this way:

Karin's code above perfectly creates multiyear means from daily data over user-specified timesteps - 5 day means are used here

The following is the appropriate way to create the time series to subtract from the multiyear mean:

cdo -select,season=DJF,startdate=1979-12-01 
cdo -timselmean,5 
cdo -selmon,12,1,2 -settaxis,1979-12-03,00:00:00,5day 
cdo -b 32 -ydaysub

The third step makes the time series match the multiyear mean, and should be adjusted to the required number of days

ydaysub can then subtract the time series, thinking that both are single day datasets.

Many many thanks for the help I got on here,

NH

    (1-15/15)