- 积分
- 9323
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2019-7-3
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2021-7-8 08:50:31
|
显示全部楼层
您好,大神 .grd格式的数据能转换成nc格式的吗?我想用ncl处理更方便。我在网上找了数据格式转换的命令如下:
from xgrads import open_CtlDataset
open_CtlDataset('E:/Study/Data_assimilation/paper/model2data/DATA_back200/nature/t30.ctl').to_netcdf('output.nc')
但是报错了
File "e:/Study/Data_assimilation/paper/model2data/DATA_back200/result/grd2nc.py", line 3, in <module>
open_CtlDataset('E:/Study/Data_assimilation/paper/model2data/DATA_back200/nature/t30.ctl').to_netcdf('output.nc')
File "D:\ProgramData\Anaconda3\lib\site-packages\xarray\core\dataset.py", line 1784, in to_netcdf
return to_netcdf(
File "D:\ProgramData\Anaconda3\lib\site-packages\xarray\backends\api.py", line 1035, in to_netcdf
_validate_attrs(dataset, invalid_netcdf=invalid_netcdf and engine == "h5netcdf")
File "D:\ProgramData\Anaconda3\lib\site-packages\xarray\backends\api.py", line 172, in _validate_attrs
check_attr(k, v, valid_types)
File "D:\ProgramData\Anaconda3\lib\site-packages\xarray\backends\api.py", line 164, in check_attr
raise TypeError(
TypeError: Invalid value for attr 'pdef': None. For serialization to netCDF files, its value must be of one of the following types: str, Number, ndarray, number, list, tuple
有什么其它办法吗? |
|