Change the format of time:units
Added by YUU YAN over 5 years ago
Hi,
I want to change the format of time:units from 'hours since 1900-01-01 00:00:00.0' to 'days since 1900-01-01 00:00:00'. Could you please tell me how to get it? Thanks
variables:
double time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:units = "hours since 1900-01-01 00:00:00.0" ;
time:calendar = "gregorian" ;
time:axis = "T" ;
Best regards,
Yu
t2m_y2014_cut.nc (18.3 MB) t2m_y2014_cut.nc |
Replies (4)
RE: Change the format of time:units - Added by Karin Meier-Fleischer over 5 years ago
Hi Yuu,
use the setreftime operator to change the reference time:
cdo -setreftime,1900-01-01,00:00:00,1day t2m_y2014_cut.nc outfile.nc
double time(time) ; time:standard_name = "time" ; time:long_name = "time" ; time:units = "days since 1900-1-1 00:00:00" ; time:calendar = "gregorian" ; time:axis = "T" ;
-Karin
RE: Change the format of time:units - Added by Suvarna Tikle over 1 year ago
Hi Karin,
I am working on same type.
My file variable was-
double time(time) ;
time:standard_name = "time" ;
time:units = "day as %Y%m%d.%f" ;
time:calendar = "proleptic_gregorian" ;
time:axis = "T" ;
Then used
cdo -setreftime,1850-01-01,00:00:00,hours CO_agri_LE_monthly_2019_tonnes.nc time_CO_agri_LE_monthly_2019_tonnes.nc
It becomes
double time(time) ;
time:standard_name = "time" ;
time:units = "hours since 1850-1-1 00:00:00" ;
time:calendar = "proleptic_gregorian" ;
time:axis = "T" ;
But I want it in below format
float time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:units = "hours since 1850-01-01 00:00:00" ;
time:calendar = "gregorian" ;
time:axis = "T" ;
How to change the calendar along with date? or to just displayed name can be change with below command? Format of the calendar has been already changed with above command or not?
ncatted -a long_name,proleptic_gregorian,c,c,"gregorian" time_CO_agri_LE_monthly_2019_tonnes.nc
Best,
Suvarna
RE: Change the format of time:units - Added by Karin Meier-Fleischer over 1 year ago
CDO's standard calendar is gregorian (see https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.1.7.2).
If you want to set the calendar to standard use ' -setcalendar,standard '.