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