[SciPy-User] numpy.squeeze not squeezing
Robert Kern
robert.kern at gmail.com
Wed Sep 30 17:16:39 EDT 2009
On Wed, Sep 30, 2009 at 15:44, Bruce Ford <bruce at clearscienceinc.com> wrote:
> Squeeze doesn't seem to be squeezing. What am I missing?
>
> An array extracted from a NetCDF3 file using NetCDF4 is shaped: (248,1,181.360)
>
> I want it to be shaped (248,181,360)
>
> out = np.squeeze(in)
> print out.shape
>
> yeilds ()
>
> Am I missing a step?
It works for me:
In [1]: x = np.empty((248,1,181,360))
In [2]: np.squeeze(x).shape
Out[2]: (248, 181, 360)
Can you give us a minimal, self-contained script that demonstrates the
problem? Being self-contained will probably be impossible, but even
seeing such a minimal script will be helpful even if we can't run it
with your data file.
--
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