简体   繁体   中英

How to put Timestamp at the start of the Month in CDO?

Currently I am working with cmip6 models monthly precipitation.nc files. I want the dates to start from 1st day of each month. Here is the part of result of cdo sinfo of input file:

1950-01-16 12:00:00 1950-02-15 00:00:00 1950-03-16 12:00:00 1950-04-16 00:00:00

As you can see the date starts from 16 or 15. Even after applying cdo --timestat_date first monmean to my input file, there was no change in dates of my output file. I tried on other models' files too but in vain.

My CDO ver:
CDI library version: 2.0.5
cgribex library version: 2.0.1
ecCodes library version: 2.26.0
NetCDF library version: 4.8.1 of Apr 25 2022 17:43:42 $
hdf5 library version: 1.12.1 threadsafe
exse library version: 1.4.2
FILE library version: 1.9.1

The easiest way to do this in CDO is probably to reset the time axis or set the day. In your case the dataset appears to start on 1st January 1950 and has every month since then. So, one the following ought to work.

cdo settaxis,1950-01-01,12:00:00,1mon infile outfile

cdo setday,1 infile outfile

Note that the command line option you used, --timestat_date first , assigns the first time available within each month to the output file when calculating the monthly mean. Thus it would have worked as desired if you had used daily data as input. However, as your input is already a monthly mean with a single timestep available, it will simply return the time from the original dataset in this case.

cdo --timestat_date first monmean infile outfile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM