【发布时间】:2021-02-13 21:05:22
【问题描述】:
我有一个 netcdf 文件,有人传给我,它使用“自 DATE 以来的年数”:
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" ;
当我尝试用 xarray 打开它时,我得到了错误:
ValueError: unable to decode time units 'years since 2000-1-1 00:00:00' with calendar 'proleptic_gregorian'. Try opening your dataset with decode_times=False.
我可以在 decode_times=False 时打开,但我无法分割时间。我发现将单位更改为“天数”解决了错误,但当然会弄乱时间轴(我只是用
覆盖了单位ncatted -O -a units,time,m,c,"days since 2000-1-1 00:00:00" ./test.nc
作为测试,但没有更新实际时间变量值)
在 xarray 中打开单位为“年后”的 netcdf 数据文件有技巧吗?
【问题讨论】:
标签: netcdf python-xarray