python plot map with geolocation arrays

Solutions on MaxInterview for python plot map with geolocation arrays by the best coders in the world

showing results for - "python plot map with geolocation arrays"
Evann
09 Mar 2016
1from mpl_toolkits.basemap import Basemap
2from mpl_toolkits.basemap import addcyclic
3import matplotlib.pyplot as plt
4import numpy as np
5
6map = Basemap(projection='sinu', 
7              lat_0=0, lon_0=0)
8
9lons = np.arange(30, 390, 30)
10lats = np.arange(0, 100, 10)
11
12data = np.indices((lats.shape[0], lons.shape[0]))
13data = data[0] + data[1]
14
15data , lons = addcyclic(data, lons)
16
17lons, data = map.shiftdata(lons, datain = data, lon_0=0)
18
19llons, llats = np.meshgrid(lons, lats)
20
21x, y = map(llons, llats)
22
23map.contourf(x, y, data)
24
25map.drawcoastlines()
26plt.show()
27