问题
I have a netcdf file that someone passed me that uses "years since DATE" as the time units:
double time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:calendar = "proleptic_gregorian" ;
time:axis = "T" ;
time:units = "years since 2000-1-1 00:00:00" ;
I want to change the units to "Days since" the same base date - Obviously the timevariable needs to be changed to be consistent. I was hoping for a solution using nco or cdo, but I am a bit stumped. (A python solution would also be okay, but in fact the reason I need to do this is that I can't actually get the file to open with xarray.)
回答1:
Try NCO's udunits()
function documented here:
ncap2 -O -s '@units="days since 2000-1-1 00:00:00";time=udunits(time,@units);time@units=@units' in.nc out.nc
来源:https://stackoverflow.com/questions/64624632/change-time-axis-units-from-years-since-to-days-since-in-netcdf-file