how to include the time_bnds 1981-01-01 00:00 -1981-01-01 23:00 in a nc file using cdo?

128 views Asked by At

I have a NC file with 13879 daily time steps starting from 1981-01-01. I want to include "time_bnds" in a 1981-01-01 00:00-1981-01-01 23:00 format. How do I do that with cdo? I am attaching two NC files, one of which needs this "time_bnds" and the other contains the required time_bnds. The one in which time_bnds is required to be included is named

  1. imd_pr_1981_2018_clipped.nc

The other one, which is in correct format (already have the time_bnds),

  1. pr_1981_2018_clipped_mm.nc

Please advise on how to add the time_bnds to the imd_pr_1981_2018_clipped.nc file, as mentioned above.

The link for the data is here

2

There are 2 answers

0
subhra sekhar maity On BEST ANSWER

I like to thank Robert Wilson and Karin Meier-Fleischer of the CDO support forum for their help. As pointed out by Robert Wilson, it cannot be done using CDO but can be achieved by NCO. I got the solution to my question from Karin Meier-Fleischer in the CDO support forum, which is as follows:

ncap2 -O -s 'defdim("bnds",2);time_bnds=make_bounds(TIME,$bnds,"time_bnds");' \imd_pr_1981_2018_clipped.nc imd_pr_1981_2018_clipped_changed.nc

The link to the CDO forum is here

7
Robert Wilson On

The CDO method you are looking for in this case is shifttime.

You will need to move time forward 23 hours, which can be done as follows:

cdo shifttime,23hours in.nc out.nc