title: How to create a smaller array from a larger array python
body: <p>I have a large 4D data set and need to create a smaller 4D array from it.  I am fairly new to python and am use to IDL or matlab.  I read in my values then using the where function I find the index numbers I need for each dimension from smaller 1D arrays.  I am trying to create a new array from these index numbers but I keep getting the shape mismatch error (can not be broacast to a single shape.</p>
  
  <pre><code>import numpy as n
  import matplotlib.pyplot as plt
  import Scientific.IO.NetCDF as S
  
  file=S.NetCDFFile('wspd.mon.mean.nc',mode='r') #Opening File
  Lat=file.variables['lat'].getValue()     # Reading in the latitude variables, 73
  Lon=file.variables['lon'].getValue()     # Reading in the longitude variables, 144
  Level=file.variables['level'].getValue() # Reading in the levels, 17 of them
  Defaulttime=file.variables['time'].getValue()   # Reading in the time, hrs since 1-1-1
  Defaultwindspeed=file.variables['wspd'].getValue()     # Reading in the windspeed(time, level, lat, lon)
  
  Time=n.arange(len(Defaulttime))/12.+1948  #Creates time array into readable years with 12 months
  goodtime=n.where((Time&gt;=1948)&amp;(Time&lt;2013)) #Creates a time array for the years that I want, 1948-2012, since 2013 only has until October, I will not be using that data.
  goodlat=n.where((Lat&gt;=35)&amp;(Lat&lt;=50))  #Latitudes where the rockies and plains are in the US
  plainslon=n.where((Lon&gt;=275)&amp;(Lon&lt;=285))
  
  Windspeedsplains=Defaultwindspeed[goodtime,:,goodlat,plainslon]
  </code></pre>
  
  <p>The error below is generated by the line above (last line of code).</p>
  
  <pre><code>&gt;&gt;&gt;ValueError: shape mismatch: objects cannot be broadcast to a single shape
  </code></pre>