[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

netcdf4-python

deadpickle

2/21/2010 1:47:00 AM

I'm trying to use the python module "netcdf4-python" to read a netcdf
file. So far I'm trying to do the basics and just open the script:

from netCDF4 import Dataset
rootgrp = Dataset('20060402-201025.netcdf', 'r',
format='NETCDF3_CLASSIC')
print rootgrp.file_format
rootgrp.close()

when I do this I get the exit code error (when I run in Scite):

>pythonw -u "netcdf_test.py"
>Exit code: -1073741819
or Python stops responding (in windows cmd).

I'm not sure what is wrong so if anyone as any ideas I would gladly
send you the netcdf file to try. Thanks.
1 Answer

matt.newville

2/21/2010 3:22:00 AM

0

On Feb 20, 7:47 pm, deadpickle <deadpic...@gmail.com> wrote:
> I'm trying to use the python module "netcdf4-python" to read a netcdf
> file. So far I'm trying to do the basics and just open the script:
>
> from netCDF4 import Dataset
> rootgrp = Dataset('20060402-201025.netcdf', 'r',
> format='NETCDF3_CLASSIC')
> print rootgrp.file_format
> rootgrp.close()
>
> when I do this I get the exit code error (when I run in Scite):
>
> >pythonw -u "netcdf_test.py"
> >Exit code: -1073741819
>
>  or Python stops responding (in windows cmd).
>
> I'm not sure what is wrong so if anyone as any ideas I would gladly
> send you the netcdf file to try. Thanks.

If the file is really of NetCDF3 format, scipy.io.netcdf should work.
Replace
netCDF4.Dataset(filename,'r',format='NETCDF3_CLASSIC')
with
scipy.io.netcdf.netcdf_open(filename,'r')

--Matt Newville