Project

General

Profile

Time average of the monthly NETCDF file

Added by mubashar dogar about 11 years ago

Dear CDO users,

I have a netcdf file containing monthly data, let say it has 10 years (120 months). I wanted to generated a new netcdf file containing average value of all the 120 months in such a way that the output netcdf file should contain the same no of months (120) instead of one month value by repeating this averaged calculated value (120 times) and produce same time length as the input file. In short my output file will have 120 time steps as the input but each time step will have the same averaged value. How can I do that?

Thanks,

Mubashar


Replies (4)

RE: Time average of the monthly NETCDF file - Added by Uwe Schulzweida about 11 years ago

Hi Mubashar,

Try the undocumented CDO operator duplicate to duplicate a file. Use the optional parameter to set the number of duplicates. Here is an example for 120 duplicates:

cdo duplicate,120 ifile ofile
Use this operator in combination with settaxis to modify the time axis.
cdo settaxis,<startdate>,0,1mo -duplicate,120 ifile ofile
The status of this operator is experimental, your feedback is very welcome.

Cheers,
Uwe

RE: Time average of the monthly NETCDF file - Added by mubashar dogar about 11 years ago

Dear Uwe,

The duplicate and settaxis command works perfectly fine. Before applying the duplicate & settaxis command for duplicating I applied time average command on my input data (having julinan calender) to get time average as follows:

cdo timmean asmsw.nc_jan1990_dec1999.nc timmean.nc

Warning (cdfInqContents) : calendar >julian< unsupported!
cdo timmean: Processed 7840800 values from 18 variables over 121 timesteps. ( 0.39s )

What about julian calender warning message?

2ndly my original input file shows pressure coordinate in ncdump as as follows:

float pfull(pfull) ;
pfull:positive = "up" ;
pfull:long_name = "pressure" ;
pfull:units = "hPa" ;

while cdo shows ncdump of timemean.nc as:

float pfull(pfull) ;
pfull:standard_name = "air_pressure" ;
pfull:long_name = "pressure" ;
pfull:units = "hPa" ;
pfull:positive = "down" ;
pfull:axis = "Z" ;

Please notice the difference of positive = "down" and positive = "up".

Can I somehow get the same pressure convention. I know the data represents perfectly fine but have opposite display in GrADS.

Thanks,

Mubashar

RE: Time average of the monthly NETCDF file - Added by Uwe Schulzweida about 11 years ago

CDO doesn't support a pure Julian calendar. In this case a standard mixed Gregorian/Julian calendar as defined by Udunits is used. I think the result should be ok, if the reference date/time is near to the time offset.

RE: Time average of the monthly NETCDF file - Added by mubashar dogar about 11 years ago

Hi,

One thing I forgot to mention is that I want julian calendar (as is in my original input file) instead of standard calendar. How can we specify this?

Thanks,

Mubashar

    (1-4/4)