python - 将时间指定为“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 的新手,不太确定如何解决这个问题,任何建议都会有所帮助:)
解决方案
推荐阅读
- asp.net-core - ASP.Net 核心身份 - 基本登录系统的过度杀伤力?
- spring - Spring Security中的白名单分段文件上传
- android - 如何返回从改造中检索到的值?
- websphere - 如何在 IBM 沃森助手中逃脱插槽?
- firebase - Unity FireBase 实时数据库获取特定密钥的所有子项
- ffmpeg - 有没有办法对由语言管理的多个音频和子流进行编码
- c# - 如何等待下一个串口数据与收集的字节一起附加?
- snowflake-cloud-data-platform - 如果无法触发多个 SQL 语句,如何使用 Snowflake 作为 ETL / ELT 选项?
- python - 如何将 obj 文件加载到 PyOpenGL
- javascript - 在谷歌脚本上使用 forEach 的问题