0

I'm trying to open a netCDF file in edit mode in Python using the netCDF4 library. The error I'm getting is this: OSError: [Errno -101] NetCDF: HDF error: b'example.nc' OS: Ubuntu 22:04 IDE: VS Code It's also worth noticing that I'm using the Jupyter in vs code. My Code:

import netCDF4 as nc
import h5py
import os
os.getcwd()
file = 'example.nc'
dataset = nc.Dataset(file, 'r+')

Full error:

OSError                                   Traceback (most recent call last)
Cell In[3], line 6
      4 os.getcwd()
      5 file = 'example.nc'
----> 6 dataset = nc.Dataset(file, 'r+') # Open the netCDF file in read mode
      7 print(dataset)

File src/netCDF4/_netCDF4.pyx:2463, in netCDF4._netCDF4.Dataset.__init__()

File src/netCDF4/_netCDF4.pyx:2026, in netCDF4._netCDF4._ensure_nc_success()

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

I already gave checked if the file has write-to-read permissions and it has. So that's not problem probaly. Image of the Error

  • Have you looked at this question asking the same thing? It's likely your problem is the same https://stackoverflow.com/questions/49317927/errno-101-netcdf-hdf-error-when-opening-netcdf-file – Grismar Jul 03 '23 at 09:35
  • Yes I already saw that question unfortunately it didn't solve my problem – Abigor111 Jul 03 '23 at 10:10
  • Without access to the file that is causing you problems ('example.nc'), it will be very hard to say what the actual problem is. Can you share it somewhere, or share a smaller file that has the same issue? – Grismar Jul 03 '23 at 10:48
  • https://drive.google.com/file/d/1VDS-r-E7WTU1Ed6IdTaUMjGTua5UG_vQ/view?usp=sharing – Abigor111 Jul 03 '23 at 10:55

0 Answers0