[PYTHON MATRIX-SIG] Data i/o and Numeric module

Kyle Schalm kschalm@geog.ubc.ca
Mon, 9 Dec 1996 18:58:35 -0800 (PST)


>djc@lct.com (Duncan Child) writes:

>> Am I right in thinking that it would be better for me to code/use an
>> extension that imports data directly into Numeric arrays rather than an 
>> extension to load my data into intermediate Python lists?

>> Is there any documentation or existing code that could act as a template?

> The netCDF/python interface might be useful:
>
>  NetCDF:
>  http://www.unidata.ucar.edu/packages/netcdf/
>  python interface:
>  http://snow.cit.cornell.edu/noon/ncmodule.html
>

[snippety-snip]

> 
> The version of the Python interface code at the above URL is not NumPy
> aware, so there must be room for further i/o optimisation. Note:
> the python code presently also requires Unidata's UDUNITS package
> to be installed. 
> 
 
there is a numpy-aware version at http://www.geog.ubc.ca/~kschalm
this one reads netcdf data right into numpy arrays, without going
through lists. one would use the 'get' method of the variable object:

import nc # the netcdf module
a = nc.open('data.nc', nc.NOWRITE)
p = a.var('pressure').get()

more details are in the demo at the same location.

--Kyle

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================