DJF mean
Added by S BR almost 13 years ago
Hi,
I am having monthly SST data for 100 years.
I would like to have the NDJF mean SST data for these years (ND for current year and JF for following year).
Is this possible by CDO.
I tried with following syntax but seems to be not working.
cdo yearmean -selmon,11,12,1,2 ifile, ofile
Kindly suggest.
Regards
SBR
Replies (20)
RE: DJF mean - Added by Uwe Schulzweida almost 13 years ago
You have to shift the timeseries by minus 2 month. Then select the month 9,10,11,12 and do a yearly average:
cdo yearmean -shifttime,-2mo -selmon,9,10,11,12 ifile ofilePlease note that the first year is an incomplete mean because of the missing ND of the previous year.
Regards,
Uwe
RE: DJF mean - Added by S BR almost 13 years ago
Dear Uwe,
Thanks for your response but it is not working. I am getting the error with this syntax mentioned below.
It seems not accepting the "shifttime" operator. Kindly suggest.
Regards
SBR
cdo yearmean -shifttime,-2mo -selmon,9,10,11,12 test_in.nc test_out.nc
cdo yearmean: Started child process "shifttime,-2mo -selmon,9,10,11,12 test_in.nc (pipe1.1)".
cdo(2) shifttime: Started child process "selmon,9,10,11,12 test_in.nc (pipe2.1)".
cdo(2) shifttime (Warning): Time bounds unsupported by this operator, removed!
cdo(3) selmon: Processed 28576800 values from 1 variable over 1329 timesteps. ( 3.42s )
cdo(2) shifttime: Processed 28576800 values from 1 variable over 441 timesteps. ( 3.43s )
cdo yearmean: Processed 28576800 values from 1 variable over 441 timesteps. ( 3.43s )
RE: DJF mean - Added by Andreas Dobler about 7 years ago
Hi Uwe,
found this thread when searching for something similar and have a question:
Should the 2nd and 3rd cdo command not be the other way around
to shift first, then select the months and then do the yearly mean?
cdo yearmean -selmon,9,10,11,12 -shifttime,-2mo ifile ofile
Best regards
Andreas
RE: DJF mean - Added by Uwe Schulzweida about 7 years ago
Hi Andreas,
Thats correct, first shift and then select the months!
Cheers,
Uwe
RE: DJF mean - Added by patty Lyn about 3 years ago
Andreas Dobler wrote in RE: DJF mean:
Hi Uwe,
found this thread when searching for something similar and have a question:
Should the 2nd and 3rd cdo command not be the other way around
to shift first, then select the months and then do the yearly mean?
[...]Best regards
Andreas
Hi, if I want to calculate only DJF, D for current year, JF for next year, can it be do yearmean -selmon,10,11,12 -shifttime,-2mo ifile ofile?
RE: DJF mean - Added by Ralf Mueller about 3 years ago
hi Andreas!
Isn't your suggestion exactly what is written above? despite the fact that your period 3 months.
cheers
ralf
RE: DJF mean - Added by Abubakar Bello about 3 years ago
So what is the final solution? I am also having a similar problem, I want to calculate DJF the December is for the current year(2020) and JF for the next year(2021)
RE: DJF mean - Added by Ralf Mueller about 3 years ago
Hi!
Please read some messages above:
cdo yearmean -selmon,9,10,11,12 -shifttime,-2mo ifile ofileIs a great example. you only have to think about the month a bit to adjust it to your case:
cdo yearmean -selmon,10,11,12 -shifttime,-2mo ifile ofile
hth
ralf
RE: DJF mean - Added by Abubakar Bello almost 3 years ago
This work only for annual mean what if you want to calculate the seasonal mean of DJF season whereas the D is in different years with the JF?
RE: DJF mean - Added by Ralf Mueller almost 3 years ago
In the call above only the relevant months are selected. So the yearmean operator only computes the mean over DJF. I thought the mean over these months was what you initially wanted.It is effectively a seasonal mean, right?
RE: DJF mean - Added by Abubakar Bello almost 3 years ago
Hi Ralf,
What i want is the seasonal mean of DJF but the D and JF are of different years because the rain cycle I'm using is from July to June.
I thought yearmean will operate for the entire months JFMAMJJASOND.
cdo seasmean -selseas,DJF -shiftftime,2mon infle outfile? Is this the correct command?
RE: DJF mean - Added by Ralf Mueller almost 3 years ago
no - the two operators `seasmean` and `selseas` have nothing to do with each other.
you want DJF, so what you have to do is
- shift the timesteps by 2 months into the past, so that DJF becomes OND (on the time axis, not the data). This is what
cdo -shifttime,-2mo ..
does - if you are only interested in DJF you now select the coresponding (shifted) months with
-selmon,10,11,12
and - compute a mean over these months with
yearmean
. It will only use OND (i.e. DJF) because this no other data in that stream.yearmean
will produce one timestep per year (given the possibility that you want to process many years and not a single one, this should be useful)
just in case: The operators are executed from right to left. cdo yearmean -selmon,10,11,12
selects first the month and then computes the mean.
hth
ralf
RE: DJF mean - Added by Hyeonho Lee over 1 year ago
Hi Ralf,
I want to extract annual DJF mean from a monthly mean data.
I've tried these below commands.cdo yearmean -selmon,10,11,12 -shifttime,-2mo ifile ofile
cdo yearmean -shifttime,-2mo -selmon,10,11,12 ifile ofile2
I opened those files, ofile and ofile2, by Panoply.
So my concern is that Panoply shows me both of them have same thing.Slice Time[1 1of 40] = 1982- *08* -01 00:00 -- 1982- *10* -01 00:00
Even though they show me same 'Slice Time',cdo yearmean -selmon,10,11,12 -shifttime,-2mo ifile ofile
is the command for DJF mean, not ASO or OND , right?
Best regards,
Hyeonho
RE: DJF mean - Added by Hyeonho Lee over 1 year ago
Sorry for my mistakes...
The first thing is that I wanted to modify but I made two more posts.
The second thing is about the last paragraph.
I changed the order of the command.
'shittime' should be followed by 'selmon' for my question.
Even though they show me same 'Slice Time',cdo yearmean -shifttime,-2mo -selmon,10,11,12 ifile ofile
is the command for DJF mean, not ASO or OND , right?
I thought this command makes the mean for ASO .
So I did withcdo yearmean -shifttime,+2mo -selmon,10,11,12 ifile ofile
But actually it doesn't work.
RE: DJF mean - Added by Hyeonho Lee over 1 year ago
Oh finally I've got how it works.
I've got why '-2mo' is right.
Anyway after shifting time axis, we get yearmean of OND, actually it's DJF data bc of shift.
But still one question is left.
Why does Panoply show me this one?Slice Time[1 1of 40] = 1982-08-01 00:00 -- 1982-10-01 00:00
We've got 'pseudo OND mean'.
So 'Slice Time' shoud beSlice Time[1 1of 40] = 1982-10-01 00:00 -- 1982-12-01 00:00
Isn't it?
RE: DJF mean - Added by Karin Meier-Fleischer over 1 year ago
I am not able to reproduce the panoply time slice problem with my data. Can you upload the ifile?
RE: DJF mean - Added by Hyeonho Lee over 1 year ago
Hi Karin,
I will upload the ifile.
cdo yearmean -selmon,10,11,12 -shifttime,-2mo ifile ofile
cdo yearmean -shifttime,-2mo -selmon,10,11,12 ifile ofile2
In this time, the first command makes
Slice Time[1 1of 41] = 1982-11-01 00:00 -- 1982-12-01 00:00
The second command makes
Slice Time[1 1of 40] = 1982-08-01 00:00 -- 1982-10-01 00:00
Oh this file is too big...
Instead, I'll let you know that this data is oisst.mon.mean.nc from OISSTv2.
https://psl.noaa.gov/data/gridded/data.noaa.oisst.v2.highres.html
and I extracted 1982~2021 with
cdo seltimestep,5/484 oisst.mon.mean.nc ifile
RE: DJF mean - Added by Karin Meier-Fleischer over 1 year ago
The dimension time has an attribute time_bnds that gives the time range for each timestep. Panoply displays this time range for each time step (click on the right blue arrow up/down and you can see the time range for each timestep).
Two ways to compute the seasonal means:
1. Extract the exact time range with full DJF and use shifttime and selmon
cdo -shifttime,1year \ -yearmean \ -selmon,10,11,12 \ -shifttime,-2mo \ -seldate,"1981-12-01T00:00:00,2021-02-01T00:00:00" \ infile outfile
2. Extract the exact time range with full DJF and use seasmean and selmon
cdo -selmonth,1 \ -seasmean \ -seldate,"1981-12-01T00:00:00,2021-02-01T00:00:00" \ infile outfile
RE: DJF mean - Added by Karin Meier-Fleischer over 1 year ago
By the way
'cdo yearmean -shifttime,-2mo -selmon,10,11,12 ifile ofile2' does not make sense because you extract the wrong time range OND and not DJF!
The CDO command line has to be read from right to left.
RE: DJF mean - Added by Hyeonho Lee over 1 year ago
I appreciate your help, Karin.
It's a lot for me!