Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error using netCDF4 python module

Tags:

python

netcdf

I am using netCDF4 and python 3.4.

I run the following line of code in order to start writing a new netCDF file that I will be filling with data later in my code following netcdf4 documentation. I however keep getting this error...

File "netCDF4.pyx", line 1466, in netCDF4.Dataset.__init__ (netCDF4.c:19692) RuntimeError: Permission denied

from netCDF4 import Dataset
rootgrp = Dataset('test.nc', 'w', format='NETCDF4')

Any help will be most appreciated.

like image 303
Almidas Avatar asked Sep 12 '26 11:09

Almidas


2 Answers

The "Permission denied" part of the error leads me to believe you don't have permissions to write to the current directory (wherever you are when you run your script).

Check your permissions and/or try giving a full path to put the file in a directory you know you can write to.

like image 96
DopplerShift Avatar answered Sep 14 '26 02:09

DopplerShift


dataset.close()

or close ide and delete file 'netCDF4.pyx'

maybe a file exist there, so can't write it.

like image 25
Cho Avatar answered Sep 14 '26 01:09

Cho