Using Numeric 24.0b2 with Scientific.IO.NetCDF

bandw fred at ucar.edu
Wed Jul 6 19:04:02 EDT 2005


I am having more problems with 24.0b2.  Consider the NetCDF file:

netcdf very_simple {
dimensions:
        num = 2 ;
variables:
        float T(num) ;
          T:mv = 5.0f ;
data:
 T = 1., 2. ;
}

and the python script:

import Numeric
from Scientific.IO.NetCDF import NetCDFFile
file = NetCDFFile("simple.nc","r")
T = file.variables["T"]

a = T.mv
print "T.mv = ", a
print "type(T.mv) = ", type(a)
print "len(T.mv) = ", len(a)
print "T.mv[0] = ", a[0]
print "len(T.mv[0]) = ", len(a[0])
print "type(T.mv[0]) = ", type(a[0])

which produces the output:

T.mv =  [ 5.]
type(T.mv) =  <type 'array'>
len(T.mv) =  1
T.mv[0] =  5.0
len(T.mv[0]) =  1
type(T.mv[0]) =  <type 'array'>

I can see no reason why T.mv[0] should be typed as an array.




More information about the Python-list mailing list