\ [Errno -101 \] NetCDF:打开netcdf文件时出现HDF错误 [英] \[Errno -101\] NetCDF: HDF error when opening netcdf file

查看:4307
本文介绍了\ [Errno -101 \] NetCDF:打开netcdf文件时出现HDF错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打开netcdf文件时出现此错误. 该代码以前工作过. 我该如何解决?

I have this error when opening my netcdf file. The code was working before. How do I fix this ?

回溯(最近通话最近一次):

Traceback (most recent call last):

文件",第1行,在 ...

File "", line 1, in ...

gather_vgt中的文件"file.py",第71行 返回xr.open_dataset(文件名)

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

文件"/.../lib/python3.6/site-packages/xarray/backends/api.py",行 286,在open_dataset中 autoclose = autoclose)

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

文件"/.../lib/python3.6/site-packages/xarray/backends/netCDF4_.py", 275行,处于打开状态 ds = opener()

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

文件"/.../lib/python3.6/site-packages/xarray/backends/netCDF4_.py", _open_netcdf4_group中的第199行 ds = nc4.Dataset(文件名,mode = mode,** kwargs)

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

文件"netCDF4/_netCDF4.pyx",第2015行,在 netCDF4._netCDF4.Dataset.初始化

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

文件"netCDF4/_netCDF4.pyx",第1636行,在 netCDF4._netCDF4._ensure_nc_success

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

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

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

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

When I try to open the same netcdf file with h5py I get this error :

OSError:无法打开文件(对此文件禁用了文件锁定 系统(使用HDF5_USE_FILE_LOCKING环境变量进行覆盖), errno = 38,错误消息='...')

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)

  • your HDF5 library has been updated (1.10.1) (netcdf uses HDF5 under the hood)

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

your file system does not support the file locking that the HDF5 library uses.

为了读取您的hdf5或netcdf文件,您需要设置以下环境变量:

In order to read your hdf5 or netcdf files, you need set this environment variable :

 HDF5_USE_FILE_LOCKING=FALSE


供参考,在

添加了用于禁用SWMR文件锁定方案的机制.

Added a mechanism for disabling the SWMR file locking scheme.

HDF5 1.10.0(包括patch1)中使用的文件锁定调用
基础文件系统不支持文件时将失败
锁定或已禁用锁定的位置.禁用所有文件
锁定操作,一个名为
的环境变量 HDF5_USE_FILE_LOCKING可以设置为五个字符的字符串
'错误的'.这不会从根本上改变HDF5库
操作(除了打开/创建初始文件之外,SWMR是无锁的),
但用户在打开文件时必须更加小心
为了避免使用有问题的访问模式(即:多个编写器)>文件锁定旨在防止的访问模式.

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.

此外,文件锁定时发出的错误消息
操作将errno设置为ENOSYS(通常在文件锁定后进行
已禁用)已更新,以描述问题和可能的原因
分辨率更好.

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)

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

这篇关于\ [Errno -101 \] NetCDF:打开netcdf文件时出现HDF错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆