Using Numeric 24.0b2 with Scientific.IO.NetCDF

bandw fred at
Fri Jul 1 01:22:20 CEST 2005

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.

NetCDF file simple.cdl (used to create with "ncgen")

netcdf simple {
num = 3 ;
float temp(num) ;

temp = 1, 2, 3 ;

Python script

import Numeric
from Scientific.IO.NetCDF import NetCDFFile

cdf_file1 = NetCDFFile("","r")
temp = cdf_file1.variables["temp"][:]
print min(temp), type(min(temp))

More information about the Python-list mailing list