You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xarray ValueError求助:combine='by_coords'时concat_dim参数无效

解决 ValueError: When combine='by_coords', passing a value for concat_dim has no effect 的问题

问题根源

该错误源于新版本xarray的参数兼容性校验:当使用combine='by_coords'模式时,不能同时指定concat_dim参数(因为by_coords会自动根据坐标维度合并文件,无需显式指定合并维度)。而act-atmos库的read_netcdf函数可能默认传递了concat_dim,与combine='by_coords'冲突,触发报错。

解决方法

1. 显式传递兼容的合并参数

根据你的需求选择以下任一方式:

  • 指定固定维度合并:若需沿特定维度(如时间time)合并文件,使用combine='nested'并搭配concat_dim:
    obj = act.io.armfiles.read_netcdf('sgpmetE13.b1/*', combine='nested', concat_dim='time')
    
  • 自动按坐标合并:若希望xarray自动根据坐标合并,传递combine='by_coords'并确保不设置concat_dim(可显式设为None):
    obj = act.io.armfiles.read_netcdf('sgpmetE13.b1/*', combine='by_coords', concat_dim=None)
    

2. 更新act-atmos库到最新版本

检查act-atmos是否发布了修复该兼容性问题的更新,执行升级命令:

pip install --upgrade act-atmos

3. 降级xarray到兼容版本

若升级act-atmos无效,可回退到未添加该参数校验的旧版xarray,例如:

pip install xarray==2023.6.0

内容的提问来源于stack exchange,提问作者Fan Mei

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 01:10:27