[SciPy-User] scipy.io.netcdf question

Phil Morefield philmorefield@yahoo....
Tue Aug 24 15:37:49 CDT 2010


A question for scipy experts:

I'm trying to read in a very large three dimensional NetCDF file and 
failing. The code is simple:

import numpy
from scipy.io import netcdf

ncFile = netcdf.netcdf_file(my_input_file,"r")

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Python25\lib\site-packages\scipy\io\netcdf.py", line 43, in __init__
    self._parse()
  File "C:\Python25\lib\site-packages\scipy\io\netcdf.py", line 79, in _parse
    self._var_array()
  File "C:\Python25\lib\site-packages\scipy\io\netcdf.py", line 135, in 
_var_array
    self.variables[name] = self._read_var()
  File "C:\Python25\lib\site-packages\scipy\io\netcdf.py", line 180, in 
_read_var
    attributes = self._att_array()
  File "C:\Python25\lib\site-packages\scipy\io\netcdf.py", line 119, in 
_att_array
    attributes[name] = self._read_values(n, nc_type)
  File "C:\Python25\lib\site-packages\scipy\io\netcdf.py", line 193, in 
_read_values
    count = n * bytes[nc_type-1]
IndexError: list index out of range
 
I went into the scipy code and determined that the variable 'nc_type' is being 
passed to _read_values with a value of 1333097057, while the list object 'bytes' 
only holds six items. That explains the "list index out of range". My suspicion 
is that some identifying information is wrong with my NetCDF file, but I can't 
figure out where the 'nc_type' variable comes from exactly, so I'm just 
guessing.

I'd really appreciate some help with this. Any ideas? 

Thanks!


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100824/9b186870/attachment.html 


More information about the SciPy-User mailing list