[SciPy-user] Problem reading NetCDF File
Ludovic DROUINEAU
ludovic.drouineau at ifremer.fr
Fri Jan 30 07:22:03 EST 2009
Hi all,
When I try to open a NetCDF file, I have the following error:
File "C:\Python25\lib\site-packages\scipy\io\netcdf.py", line 194, in
_read_values
count = n * bytes[nc_type-1]
IndexError: list index out of range
My code is:
from scipy.io import netcdf
nc = netcdf.netcdf_file ('test.nc', 'r')
Here is the header of the netcdf file:
netcdf test {
dimensions:
time = UNLIMITED ; // (33635 currently)
variables:
double measureTS(time) ;
measureTS:element_name = "measure time" ;
measureTS:cardinalitymin = 1 ;
measureTS:cardinalitymax = 1 ;
measureTS:comment = "time of measure as determined by the GPS" ;
measureTS:long_name = "measure timestamp" ;
measureTS:units = "day since 1899-12-30T00:00:00 UTC" ;
measureTS:shortunits = "days" ;
measureTS:positive = "up" ;
measureTS:C_format = "%14.7f" ;
measureTS:axis = "T" ;
measureTS:measuretimedata = "measureTS" ;
measureTS:valid_max = 100000. ;
measureTS:valid_min = 30000. ;
measureTS:precision = 12 ;
measureTS:scale = 7 ;
measureTS:_FillValue = 0. ;
measureTS:missing_value = 0. ;
measureTS:scale_factor = 1. ;
measureTS:add_offset = 0. ;
measureTS:element_version = "1.0" ;
measureTS:valid_range = "30000.000000,100000.000000" ;
double lat(time) ;
lat:element_name = "latitude" ;
lat:cardinalitymin = 1 ;
lat:cardinalitymax = 1 ;
lat:comment = "latitude of the fix for the reference geodetic
system" ;
lat:long_name = "latitude" ;
lat:units = "degree_north" ;
lat:shortunits = "°" ;
lat:positive = "up" ;
lat:C_format = "%11.7f" ;
lat:axis = "Y" ;
lat:coordinates = "measureTS" ;
lat:measuretimedata = "measureTS" ;
lat:valid_max = 90. ;
lat:valid_min = -90. ;
lat:precision = 9 ;
lat:scale = 7 ;
lat:_FillValue = -100. ;
lat:missing_value = -100. ;
lat:scale_factor = 1. ;
lat:add_offset = 0. ;
lat:element_version = "1.0" ;
lat:valid_range = "-90.000000,90.000000" ;
double long(time) ;
long:element_name = "longitude" ;
long:cardinalitymin = 1 ;
long:cardinalitymax = 1 ;
long:comment = "longitude of the fix for the reference geodetic
system" ;
long:long_name = "longitude" ;
long:units = "degree_east" ;
long:shortunits = "°" ;
long:positive = "up" ;
long:C_format = "%12.7f" ;
long:axis = "X" ;
long:coordinates = "measureTS" ;
long:measuretimedata = "measureTS" ;
long:valid_max = 180. ;
long:valid_min = -180. ;
long:precision = 10 ;
long:scale = 7 ;
long:_FillValue = -200. ;
long:missing_value = -200. ;
long:scale_factor = 1. ;
long:add_offset = 0. ;
long:element_version = "1.0" ;
long:valid_range = "-180.000000,180.000000" ;
double alt(time) ;
alt:element_name = "altitude" ;
alt:cardinalitymin = 0 ;
alt:cardinalitymax = 1 ;
alt:comment = "altitude of the fix above the reference ellipsoïd" ;
alt:long_name = "altitude" ;
alt:units = "m" ;
alt:shortunits = "m" ;
alt:positive = "up" ;
alt:C_format = "%9.3f" ;
alt:axis = "Z" ;
alt:coordinates = "measureTS lat long" ;
alt:measuretimedata = "measureTS" ;
alt:valid_max = 30000000. ;
alt:valid_min = -1000000. ;
alt:precision = 7 ;
alt:scale = 3 ;
alt:_FillValue = -10000000. ;
alt:missing_value = -10000000. ;
alt:scale_factor = 1. ;
alt:add_offset = 0. ;
alt:element_version = "1.0" ;
alt:valid_range = "-1000000.000000,30000000.000000" ;
byte prec(time) ;
prec:element_name = "horizontal position precision code" ;
prec:cardinalitymin = 0 ;
prec:cardinalitymax = 1 ;
prec:comment = "precision of the position as determined by the
GPS or the acquisition server" ;
prec:long_name = "precision" ;
prec:units = "dimensionless" ;
prec:shortunits = "dimensionless" ;
prec:positive = "up" ;
prec:coordinates = "measureTS lat long" ;
prec:measuretimedata = "measureTS" ;
prec:valid_max = 9. ;
prec:valid_min = 0. ;
prec:precision = 1 ;
prec:scale = 0 ;
prec:_FillValue = -1b ;
prec:missing_value = -1. ;
prec:scale_factor = 1. ;
prec:add_offset = 0. ;
prec:element_version = "1.0" ;
prec:valid_range = "0.000000,9.000000" ;
byte mode(time) ;
mode:element_name = "GPS mode" ;
mode:cardinalitymin = 0 ;
mode:cardinalitymax = 1 ;
mode:comment = "mode used by the GPS to compute the fix in NMEA
norm" ;
mode:long_name = "GPS mode" ;
mode:units = "dimensionless" ;
mode:shortunits = "dimensionless" ;
mode:positive = "up" ;
mode:coordinates = "measureTS lat long" ;
mode:measuretimedata = "measureTS" ;
mode:valid_max = 7. ;
mode:valid_min = 0. ;
mode:precision = 1 ;
mode:scale = 0 ;
mode:_FillValue = -1b ;
mode:missing_value = -1. ;
mode:scale_factor = 1. ;
mode:add_offset = 0. ;
mode:element_version = "1.1" ;
mode:valid_range = "0.000000,7.000000" ;
float gndcourse(time) ;
gndcourse:element_name = "course" ;
gndcourse:cardinalitymin = 0 ;
gndcourse:cardinalitymax = 1 ;
gndcourse:comment = "heading of the speed vector of the GPS
antenna relative to the reference geodetic system (i.e. ground)" ;
gndcourse:long_name = "ground course" ;
gndcourse:units = "degree" ;
gndcourse:shortunits = "°" ;
gndcourse:positive = "up" ;
gndcourse:C_format = "%5.2f" ;
gndcourse:coordinates = "measureTS lat long" ;
gndcourse:measuretimedata = "measureTS" ;
gndcourse:valid_max = 360. ;
gndcourse:valid_min = 0. ;
gndcourse:precision = 4 ;
gndcourse:scale = 2 ;
gndcourse:_FillValue = -1.f ;
gndcourse:missing_value = -1. ;
gndcourse:scale_factor = 1. ;
gndcourse:add_offset = 0. ;
gndcourse:element_version = "1.0" ;
gndcourse:valid_range = "0.000000,360.000000" ;
float gndspeed(time) ;
gndspeed:element_name = "speed (ground)" ;
gndspeed:cardinalitymin = 0 ;
gndspeed:cardinalitymax = 1 ;
gndspeed:comment = "module of speed of GPS antenna relative to
the reference geodetic system (i.e. ground)" ;
gndspeed:long_name = "ground speed" ;
gndspeed:units = "knot" ;
gndspeed:shortunits = "kn" ;
gndspeed:positive = "up" ;
gndspeed:C_format = "%5.2f" ;
gndspeed:coordinates = "measureTS lat long" ;
gndspeed:measuretimedata = "measureTS" ;
gndspeed:valid_max = 200. ;
gndspeed:valid_min = 0. ;
gndspeed:precision = 4 ;
gndspeed:scale = 2 ;
gndspeed:_FillValue = -1.f ;
gndspeed:missing_value = -1. ;
gndspeed:scale_factor = 1. ;
gndspeed:add_offset = 0. ;
gndspeed:element_version = "1.0" ;
gndspeed:valid_range = "0.000000,200.000000" ;
double time(time) ;
time:long_name = "acquisition time" ;
time:units = "days since 1899-12-30 00:00:00 UTC" ;
time:calendar = "gregorian" ;
time:axis = "T" ;
time:_FillValue = 0. ;
// global attributes:
:history = "TECHSAS v.2.35 - 2006-09-23T02:56:27 UTC
2007-02-25T22:39:21Z" ;
:source = "Acquisition of AQUA1" ;
:conventions = "CF-1.0." ;
:creationtime = "2007-02-25T22:39:21Z" ;
:device_deviceid = "PP_AQUA1" ;
:device_devicename = "AQUA1" ;
:device_position = "passerelle" ;
:device_installdate = "2001-09-10T10:30:00Z" ;
:device_latestcalibrationdate = "2001-09-10T10:30:00Z" ;
:device_workingparameters = "WGS84" ;
:device_sourcetype = "gps gyr" ;
:firstframetime = "2007-02-25T22:39:21Z" ;
:lastframetime = "2007-02-26T07:59:56Z" ;
:device_X = 24.6 ;
:device_Y = 0.6 ;
:device_Z = -31. ;
:frame_name = "position" ;
:frame_major = "1" ;
:frame_minor = "1" ;
:frame_sourcetype = "gps" ;
:frame_period = 1. ;
:title = "Techsas 2.321" ;
:institution = "Ifremer" ;
:reference = "http://www.ifremer.fr" ;
}
Thank you in advance for your replies.
--
Ludovic DROUINEAU
NSE/ILE
Ifremer Centre de Brest
BP 70 - 29280 Plouzané
tél. 33 (0)2 98 22 40 94
email Ludovic.Drouineau at ifremer.fr
More information about the SciPy-User
mailing list