Python Forum

Full Version: error with netcdf4 package
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I would appreciate very much your help.

I have created my env miniconda on Linux:

conda create --name Python36-env python=3.6

conda activate Python36-env

conda install netcdf4

Then I am trying to run my script as:

python example.py

And I get the error:

File "Data_extraction.py", line 13, in <module>
nf = Dataset(mapIn,'r') #read netcdf file
File "netCDF4/_netCDF4.pyx", line 2321, in netCDF4._netCDF4.Dataset.__init__
File "netCDF4/_netCDF4.pyx", line 1885, in netCDF4._netCDF4._ensure_nc_success
FileNotFoundError: [Errno 2] No such file or directory: b'Y:/damdam/example.nc'

Lines in my script regarding netcfd4:

from netCDF4 import Dataset
mapIn='Y:/damdam/example.nc'
nf = Dataset(mapIn,'r')
ids = len(nf.variables['river_cell'][:]) etc.

so when I do: conda list, I see that I have my netcdf4 installed but when running on the server I get an error. If I run it locally I do not have any problem. That was the reason why I created virtual env on a server but the problem is still there.

Any suggestion? Thanks a lot,

Cheers

Marc