0

我已经做的是读取(使用 xarray 和 cfgrib)文件 GRIB (.grb) 并替换它的一些值。所以我实际上已经设法访问和修改了文件。我不能做的是“保存更改”,因此将这个新修改的文​​件保存为 GRIB。我可以将它保存为 netcdf 但这不是我的目标。这是我已经尝试过的:

# I used this to open the file:
fileGRIB = xr.open_dataset('file_path', engine = 'cfgrib')
# I applied some small changes values(of precipitation in this file case)
[...]
# And I tried to save the file back to GRIB:
cfgrib.to_grib(fileGRIB, 'output.grib')
fileGRIB.to_netcdf('output.grb', engine = 'cfgrib')

这些最后的命令不起作用:

  • to_netcdf 给了我一个“无法识别的引擎”错误
  • cfgrib.to_grib 给了我'KeyError:830912400000000000'
4

0 回答 0