Project

General

Profile

How to correct the time dimension using CDO?

Added by Utkarsh Verma over 2 years ago

Hi all,

I have a NetCDF file which I converted using 'nccopy' to make it work in CDO and the NetCDF file is 3 hourly file but the 3hour time dimension looks like this:

Time coordinate : 1 step
RefTime = 1998-12-31 00:00:21 Units = days Calendar = standard
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
1998-12-31 00:00:21

Instead of this, it should be like 1998-12-31 21:00:00.

Anyone can help me to correct the time dimension?

Thanks, and regards,
Utkarsh

test.nc (12.1 MB) test.nc

Replies (4)

RE: How to correct the time dimension using CDO? - Added by Karin Meier-Fleischer over 2 years ago

Hi Utkarsh,

you can use the settime operator.

cdo -settime,21:00:00 test.nc outfile.nc

RE: How to correct the time dimension using CDO? - Added by Utkarsh Verma over 2 years ago

Hi Karin,
Thanks for replying,

I want to know how to make changes in a file when there is more than one timestep for example:

Time coordinate : 2920 steps
RefTime = 2019-01-01 00:00:00 Units = days Calendar = standard
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
2019-01-01 00:00:00 2019-01-01 00:00:03 2019-01-01 00:00:06 2019-01-01 00:00:09
2019-01-01 00:00:12 2019-01-01 00:00:15 2019-01-01 00:00:18 2019-01-01 00:00:21
2019-01-02 00:00:00 2019-01-02 00:00:03 2019-01-02 00:00:06 2019-01-02 00:00:09
2019-01-02 00:00:12 2019-01-02 00:00:15 2019-01-02 00:00:18 2019-01-02 00:00:21
2019-01-03 00:00:00 2019-01-03 00:00:03 2019-01-03 00:00:06 2019-01-03 00:00:09
2019-01-03 00:00:12 2019-01-03 00:00:15 2019-01-03 00:00:18 2019-01-03 00:00:21

regards,
Utkarsh

RE: How to correct the time dimension using CDO? - Added by Karin Meier-Fleischer over 2 years ago

For only one timestep as in your given test.nc file you can use the settime operator.

For multiple timesteps you have to use settaxis

cdo -settaxis,2019-01-01,00:00:00,3hours infile outfile
    (1-4/4)