Python: How to use MFdataset in netCDF4

人盡茶涼 提交于 2019-12-04 21:16:05

I think the error is pretty clear, but there are ways to avoid it.

1/ You could convert the NetCDF files from NetCDF4 to the classic format using e.g. nccopy:

nccopy -k classic nc4_file.nc ncclassic_file.nc

2/ xarray has a similar method (called open_mfdataset) which is able to handle NetCDF4 files. A quick test:

import netCDF4 as nc4
test = nc4.MFDataset(['test0.nc','test1.nc'])

This gives me the same error as you get ("MFNetCDF4 only works with..."), the same with xarray works without any problems:

import xarray as xr
test = xr.open_mfdataset(['test0.nc', 'test1.nc'])
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!