title: Interpolation points data into 2-d shapefile with matplotlib
body: <h3>Background</h3>
  
  <p>With point csv data containing <code>lat</code>, <code>lon</code> and <code>conc</code>( the concentration of some air pollutants) representing the monitoring sites, I want to interpolate the original point data into 2-d distribution figure.  </p>
  
  <p>Here is my original  point distribution, it's the air quality monitoring network covering China.  </p>
  
  <p><a href="https://i.stack.imgur.com/tStnt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tStnt.png" alt="enter image description here"></a>  </p>
  
  <p>The color are decided by the specific value for each monitoring sites.  </p>
  
  <p>I have uploaded the csv data <a href="https://drive.google.com/file/d/0B7FE0kxAL8kQWkRQRDczaXRCTkE/view?usp=sharing" rel="nofollow noreferrer">here</a>, any one interested can download it. </p>
  
  <p>The different colors of scatter points indicate the varying value among those sites.  </p>
  
  <p>The shapefile can be downloaded  <a href="https://drive.google.com/open?id=0B7FE0kxAL8kQM2E2Qm51RzRUWFU" rel="nofollow noreferrer">here</a></p>
  
  <h3>My attempt</h3>
  
  <p>To achieve my target which get a 2-d distribution map from these data, I use scipy.interpolate method.  </p>
  
  <pre><code>df = pd.read_csv("./the data file")
  xt,yt = df["lon"].values, df['lat'].values
  zt =  df['value'].values
  hfunc = interpolate.interp2d(xt,yt,zt)
  
  xx = np.linspace(110, 120, 40)
  yy = np.linspace(25,45, 40)
  sh = (40*40,2)
  grids = np.zeros(40*40*2).reshape(*sh)
  k = 0
  for j in range(0,yy.shape[0],1):
      for i in range(0,xx.shape[0],1):
          grids[k] = np.array([xx[i],yy[j]])
          k+=1
  xx,yy = zip(*grids)
  CONC = np.zeros(len(xx))
  for i,(x,y) in enumerate(zip(xx,yy)):
      CONC[i] = hfunc(x,y)
  
  CONC = CONC.reshape(40,40) 
  </code></pre>
  
  <p>I have tested the hfunc, but there are some value larger than 40000. The original maximum are no larger than 400. I think there must be some error in my code.  </p>
  
  <p><a href="https://i.stack.imgur.com/ryBj4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ryBj4.png" alt="enter image description here"></a>  </p>
  
  <p>One spot are much larger than anywhere.  </p>
  
  <p>Any advices or guide would be appreciate!</p>