gpt4 book ai didi

hdf5 -\[错误-101\] NetCDF : HDF error when opening netcdf file

转载 作者:行者123 更新时间:2023-12-03 00:25:00 38 4
gpt4 key购买 nike

打开 netcdf 文件时出现此错误。该代码之前可以运行。如何解决这个问题?

Traceback (most recent call last):

File "", line 1, in ...

File "file.py", line 71, in gather_vgt return xr.open_dataset(filename)

File "/.../lib/python3.6/site-packages/xarray/backends/api.py", line 286, in open_dataset autoclose=autoclose)

File "/.../lib/python3.6/site-packages/xarray/backends/netCDF4_.py", line 275, in open ds = opener()

File "/.../lib/python3.6/site-packages/xarray/backends/netCDF4_.py", line 199, in _open_netcdf4_group ds = nc4.Dataset(filename, mode=mode, **kwargs)

File "netCDF4/_netCDF4.pyx", line 2015, in netCDF4._netCDF4.Dataset.init

File "netCDF4/_netCDF4.pyx", line 1636, in netCDF4._netCDF4._ensure_nc_success

OSError: [Errno -101] NetCDF: HDF error: b'file.nc'

当我尝试使用 h5py 打开相同的 netcdf 文件时,出现此错误:

OSError: Unable to open file (file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override), errno = 38, error message = '...')

最佳答案

你一定处于这种情况:

  • 您的 HDF5 库已更新 (1.10.1)(netcdf 在底层使用 HDF5)

  • 您的文件系统不支持 HDF5 库使用的文件锁定。

为了读取您的 hdf5 或 netcdf 文件,您需要设置 environment variable :

 HDF5_USE_FILE_LOCKING=FALSE
<小时/>

作为引用,这在 HDF5 version 1.10.1 中介绍过。 ,

Added a mechanism for disabling the SWMR file locking scheme.

The file locking calls used in HDF5 1.10.0 (including patch1)
will fail when the underlying file system does not support file
locking or where locks have been disabled. To disable all file
locking operations, an environment variable named
HDF5_USE_FILE_LOCKING can be set to the five-character string
'FALSE'. This does not fundamentally change HDF5 library
operation (aside from initial file open/create, SWMR is lock-free),
but users will have to be more careful about opening files
to avoid problematic access patterns (i.e.: multiple writers) >that the file locking was designed to prevent.

Additionally, the error message that is emitted when file lock
operations set errno to ENOSYS (typical when file locking has been
disabled) has been updated to describe the problem and potential
resolution better.

(DER, 2016/10/26, HDFFV-9918)

关于hdf5 -\[错误-101\] NetCDF : HDF error when opening netcdf file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49317927/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com