微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当时间被指定为“base_time”的偏移量时合并 netCDF 文件

如何解决当时间被指定为“base_time”的偏移量时合并 netCDF 文件

我想使用时间维度合并多个 netCDF 文件。这些文件是相同的,但时间由来自“base_time”的“time_offset”指定,其中“base_time”在每个文件中都不同。

特别是在我的情况下,我每天有一个文件,“base_time”是那天的开始,即:

    <class 'netCDF4._netCDF4.Variable'>
int32 base_time()
    string: 1-Jan-2019,00:00:00 GMT
    long_name: Base time in Epoch
    units: seconds since 1970-1-1 0:00:00 0:00
    unlimited dimensions: 
    current shape = ()
    filling on,default _FillValue of -2147483647 used

并且 'time_offset' 是该基准时间的偏移量(以秒为单位),即:

<class 'netCDF4._netCDF4.Variable'>
float64 time_offset(time)
    long_name: Time offset from base_time
    units: seconds since 2019-1-1 00:00:00 0:00
unlimited dimensions: time
current shape = (826,)
filling on,default _FillValue of 9.969209968386869e+36 used

因此'time_offset'的单位每天都不同,因为'base_time'不同。

我尝试了以下方法

test = xarray.open_mfdataset(all_files,decode_cf=True,concat_dim='time')

但我收到以下错误

ValueError: Could not find any dimension coordinates to use to order the datasets for concatenation

我是 xarray 的新手,不太确定如何解决这个问题,任何建议都会有所帮助:)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。