[PYTHON MATRIX-SIG] How time-consuming is array()?

Jim Hugunin hugunin@mit.edu
Tue, 29 Oct 1996 15:03:07 -0500


> Now I have some functions in my analysis-pack and encounter, that most
> time is spent in reading the data, although I use the netcdf-package
> of Bill Noon.
> 
> With this package I can read binary NetCDF-files, but the fields are
> returned as nested lists.
> 
> X=array((f_head.var('xp')),Float32)
> 
> Is the translation from a list to an array very timeconsuming or is
> the reading in the NetCDF-package the costly operation?

I've read some of the later posts, but I'd just like to add a few comments.

array(nested_list) has not been optimized for speed (nor is it likely to
be).  It has been written in a very general fashion to support fairly
arbitrary nested sequence objects (the only objects on which it works very
efficiently are other arrays).  If somebody really has a need and wants to
contribute a highly optimized "fromlist" function I'd be willing to add it
(though I don't think this is necessary).

Kyle Schalm's modified NetCDF module is obviously the right solution here. 
I'd advise anybody who's using NetCDF and NumPy to get his version and use
it.

My two cents worth - Jim

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

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