Change the year of the date in a netcdf data
Added by Blanca Rios over 2 years ago
Hello everyone,
I have a CAM-Chem output file for the year 2020, and I want to change the year to 2050, try this:
cdo -setyear,2050 camchem-20220315152419483528.nc out_2050.nc
but it modifies the format of the dates, from 2020-04-30 18:00 - 2020-05-01 00:00 to 2050-05-01 00:00
Does anyone have an idea how I can modify it?
Greetings
Replies (4)
RE: Change the year of the date in a netcdf data - Added by kunal bali over 2 years ago
Hi,
I think it should work.
cdo setyear,2050 input.nc output.nc
RE: Change the year of the date in a netcdf data - Added by Karin Meier-Fleischer over 2 years ago
Hi Blanca,
can you upload the file?
-Karin
RE: Change the year of the date in a netcdf data - Added by Blanca Rios over 2 years ago
Karin Meier-Fleischer wrote in RE: Change the year of the date in a netcdf data:
Hi Blanca,
can you upload the file?
-Karin
Hello Karin,
I attach a file from one day, since the original file is very heavy. But the date format is the same.
Thank you
Blanca
RE: Change the year of the date in a netcdf data - Added by Uwe Schulzweida over 2 years ago
With setyear,2050 the time bounds are removed. If they are needed you should try shifttime,30years.
Unfortunately also the variable ilev will be lost with CDO, because this variable is is not used in the file. If you still need it, you should add the attribute bounds="ilev" to the variable lev:
ncatted -a bounds,lev,c,c,"ilev" camchem-20220318114350861352.nc