我正在使用 Python 中的 xclim 包来处理 NetCDF 文件中的气候数据。但是,当我尝试读取 NetCDF 文件时,遇到名称错误。以下是导致问题的代码片段:
from xclim.core.calendar import percentile_doy
from xclim.indices import cold_spell_duration_index
path_to_tasmin_file = "/scratch/aez849/CCCS/BIAS_CORR_DAYMET/Merge_Hist_rcp45/K/tmin.hist_rcp45_merged.CanESM2.CRCM5-UQAM.day.NAM-44i.mbcn-Daymet.nc"
tasmin = xr.open_dataset(path_to_tasmin_file).tasmin.isel(lat=0, lon=0)
当我运行上面的代码时,我收到以下错误消息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/scratch/aez849/CCCS/azal/lib/python3.10/site-packages/xarray/backends/a pi.py", line 573, in open_dataset
backend_ds = backend.open_dataset(
File "/scratch/aez849/CCCS/azal/lib/python3.10/site-packages/xarray/backends/n etCDF4_.py", line 603, in open_dataset
store = NetCDF4DataStore.open(
File "/scratch/aez849/CCCS/azal/lib/python3.10/site-packages/xarray/backends/n etCDF4_.py", line 367, in open
import netCDF4
File "/scratch/aez849/CCCS/azal/lib/python3.10/site-packages/netCDF4/__init__. py", line 3, in <module>
from ._netCDF4 import *
File "src/netCDF4/_netCDF4.pyx", line 1, in init netCDF4._netCDF4
ModuleNotFoundError: No module named 'mpi4py'
任何有关如何解决此问题的见解或建议将不胜感激。 我在安装“mpi4py”模块时遇到问题。显然,它与我拥有的“XClim”版本不匹配。