[SciPy-User] numpy.squeeze not squeezing
Robert Kern
robert.kern at gmail.com
Wed Sep 30 18:21:26 EDT 2009
2009/9/30 Bruce Ford <bruce at clearscienceinc.com>:
> print type(swh1) #gave <type 'numpy.ndarray'>
>
> print type(swh) #gave <type 'netCDF4.Variable'>
Ah, yes. The latter is what I meant.
Yup, my diagnosis is correct. np.squeeze() is interpreting swh as a
scalar (or rank 0 array) with dtype=object rather than an array. You
will have to get a real ndarray from the Variable. I am not familiar
with the netcdf4 API, so you will have to refer to its documentation
on how to do that. It won't be as simple as np.asarray(swh), I am
afraid.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-User
mailing list