Project

General

Profile

cdo monthly mean adds extra dimension and variable

Added by Christ Reflin almost 3 years ago

Dear cdo developer,

I have 3 months of daily temperature data. Each of them has 1 variable (temperature) and 3 dimension (lon,lat,tim)
I would like to obtain monthly data by averaging the daily temperature, so at the end I would have 3 band.

in the beginning, I merged all of them using
$ cdo mergetime inputfile*.nc merge_file.nc

after that, I calculated the average of the merge_file.nc using
$ cdo monavg merge_file.nc finaldata_monthlyavg.nc

However, my finaldata_monthlyavg.nc has 2 variable and 4 dimension,

Could you help me to understand this?

Thank you
Christ


Replies (3)

RE: cdo monthly mean adds extra dimension and variable - Added by Karin Meier-Fleischer almost 3 years ago

Hi Christian,

the result is exactly what I would expect. When using monavg CDO adds the time bounds variable which has the dimensions(time,bnds).

 time_bnds =
  43829, 43859,
  43860, 43888,
  43889, 43919 ;

The time variable contains the mid points of time_bnds.

 time = 43844, 43874, 43904 ;

CF-convention:
"time_bnds" is a separate 2-dimensional variable that defines the start and end time points of each measurement.
Variable "time_bnds" has the same attributes "units" and "calendar" as variable "time".

-Karin

RE: cdo monthly mean adds extra dimension and variable - Added by Christ Reflin almost 3 years ago

Thank you for your response Karin,

I really appreciate it,

Can I remove this time_bnds variable without disarrange the others variable?

How do I obtain the average months without adding the additional dimension?

Best
Christian

RE: cdo monthly mean adds extra dimension and variable - Added by Karin Meier-Fleischer almost 3 years ago

Maybe some applications need to have the time_bnds. If you want to delete the time_bnds you have to delete the attribute bounds from time, too. It points to the time_bnds variable.

To delete time_bnds do

ncks -O -C -x -v time_bnds finaldata_monthlyavg.nc outfile.nc
    (1-3/3)