title: squeeze function in numpy running out of memory
body: <p>I try to make a climatic map in python which I am not used to use but want to try if it is more handy than plotting in R. I use the example by
  <a href="http://joehamman.com/2013/10/12/plotting-netCDF-data-with-Python/" rel="nofollow noreferrer">http://joehamman.com/2013/10/12/plotting-netCDF-data-with-Python/</a> with my data.</p>
  <pre><code>from netCDF4 import Dataset
  import numpy as np
  
  myfil = &quot;xxxxx&quot;
  fh = Dataset(myfil, mode='r')
  lons = fh.variables['lon'][:]
  lats = fh.variables['lat'][:]
  tmean = fh.variables['Tmean_ANN'][:1]
  
  from mpl_toolkits.basemap import Basemap
  import matplotlib.pyplot as plt
  # Get some parameters for the Stereographic Projection
  
  lon0 = lons.mean()
  lats0 = lats.mean()
  
  
  
  m = Basemap(width=5000000,height=3500000,
              resolution='l',projection='stere',
              lat_ts=60,lat_0=lats0,lon_0=lon0)
  
  lon, lat = np.meshgrid(lons, lats, sparse=True)
  xi, yi = m(lon, lat)
  
  # Plot Data
  
  print(xi.shape)
  print(yi.shape)
  print(tmean.shape)
  </code></pre>
  <p>results</p>
  <pre><code>(1, 1142761)
  (1142761, 1)
  (1, 1069, 1069)
  </code></pre>
  <p>Trying to run this line</p>
  <pre><code>cs = m.contour(xi,yi, np.squeeze(tmean))
  </code></pre>
  <p>I got the error</p>
  <pre><code>cs = m.contour(xi,yi, np.squeeze(tmean))
  Traceback (most recent call last):
  
    File &quot;&lt;ipython-input-37-8be9f03a0e45&gt;&quot;, line 1, in &lt;module&gt;
      cs = m.contour(xi,yi, np.squeeze(tmean))
  
    File &quot;C:\ProgramData\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py&quot;, line 546, in with_transform
      return plotfunc(self,x,y,data,*args,**kwargs)
  
    File &quot;C:\ProgramData\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py&quot;, line 3566, in contour
      np.logical_or(np.greater(x,self.xmax+epsx),np.greater(y,self.ymax+epsy))
  
  MemoryError
  </code></pre>
  <p>Any help why do I got this. My hypothesis is that the dimension of <code>xi</code>  and <code>yi</code> is not compatible with <code>tmean</code> thus I got the error. The <code>np.sqeeze</code> function works with <code>tmean</code> data outside the <code>m.contour</code> function But I could not solve that for a while.</p>