本文介绍了将时间轴单位从“years since"更改为到“天后"在 netcdf 文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个有人传给我的 netcdf 文件,其中使用了自 DATE 以来的年数";作为时间单位:
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" ;
我想将单位更改为天数"相同的基准日期 - 显然需要更改时间变量以保持一致.我希望使用 nco 或 cdo 的解决方案,但我有点难倒.(python 解决方案也可以,但实际上我需要这样做的原因是我实际上无法使用 xarray 打开文件.)
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.)
推荐答案
尝试记录 NCO 的 udunits()
函数 这里:
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
这篇关于将时间轴单位从“years since"更改为到“天后"在 netcdf 文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!