Using Numeric 24.0b2 with Scientific.IO.NetCDF

Robert Kern rkern at
Fri Jul 1 01:45:07 CEST 2005

bandw wrote:
> I am having a problem using Numeric-24.0b2 in conjunction with
> the NetCDF module from ScientificPython (version 2.4.9).
> This problem does not surface using Numeric-23.8. The problem
> arises in using the "min" function on a NetCDF floating array.
> In 23.8, the "min" function returns a floating scalar, while in
> 24.0b2 it returns an *array* of length "1". Below I list a
> simple NetCDF file and a Python script that illustrate the
> problem. When I run the script using 23.8, I get the result:
> 1.0 <type 'float'>
> whereas using 24.0b2 I get:
> 1.0 <type 'array'>
> This creates a backward incompatibility that breaks several of
> my codes.

Call float(temp) if you really need a Python float. The change was 
intentional such that A[i] would always be an array regardless of the 
shape of A. This greatly simplifies certain types of code although the 
change does have its transition costs for some specific pieces of older 
code like yours.

BTW, you don't want to use the builtin min(). That iterates over the 
array as if it were a Python list. Use minimum.reduce().

Robert Kern
rkern at

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

More information about the Python-list mailing list