def world_map(values_input_summer, lons, lats, ind): if __name__ == '__main__': """Plot temperature difference""" mp = Basemap(llcrnrlon=-180., llcrnrlat=-60., urcrnrlon=180., urcrnrlat=90., projection='cyl') # map.fillcontinents(color='coral',lake_color='w') mp.drawcoastlines() # x, y = map(lons[0:50,50], lats[0:50,50]) # c = Values_input_annual[0:50,50] # map.scatter(x, y, marker='s', color='b') x, y = lons, lats xx = np.ndarray.flatten(x) yy = np.ndarray.flatten(y) c = values_input_summer cc = np.ndarray.flatten(c) mp.drawmapboundary(fill_color='w') # map.fillcontinents(color='#cc9966',lake_color='#99ffff') mp.drawparallels(np.arange(-60, 90, 30), labels=[1, 1, 0, 0]) mp.drawmeridians(np.arange(-180, 180, 60), labels=[0, 0, 0, 1]) # map.hexbin(xx, yy, C=cc, cmap='YlOrBr') # map.hexbin(xx, yy, C=cc, cmap=mpl.cm.cool) mp.hexbin(xx, yy, C=cc, gridsize=(134, 80), cmap='RdBu_r', extent=(-180, 180, -60, 90)) mp.colorbar(location='bottom', pad=0.3) if ind == 0: mp.title = plt.title(r'$\Delta T_{ca}(^oC)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_Tca.png') elif ind == 1: mp.title = plt.title(r'$\Delta T_{ref}(^oC)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_Tref.png') elif ind == 2: mp.title = plt.title(r'$\Delta SWGBT$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_SWGBT.png') else: mp.title = plt.title(r'$\Delta SWGBT_{ref}$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_SWGBT2.png') return fig
['NV',38.4199,-117.1219], ['NY',42.1497,-74.9384], ['OH',40.3736,-82.7755], ['OK',35.5376,-96.9247], ['OR',44.5672,-122.1269], ['PA',40.5773,-77.2640], ['RI',41.6772,-71.5101], ['SC',33.8191,-80.9066], ['SD',44.2853,-99.4632], ['TN',35.7449,-86.7489], ['TX',31.1060,-97.6475], ['UT',40.1135,-111.8535], ['VA',37.7680,-78.2057], ['VT',44.0407,-72.7093], ['WA',47.3917,-121.5708], ['WI',44.2563,-89.6385], ['WV',38.4680,-80.9696], ['WY',42.7475,-107.2085]] for i in range(len(state2LatLong)): # Get the x,y coordinate for the geoplot. Note: It's Long / Lat. x, y = geoMap(state2LatLong[i][2],state2LatLong[i][1]) geoMap.plot(x,y,'ro') geoMap.text(x+10000,y+10000,state2LatLong[i][0], bbox=dict(facecolor='yellow',alpha=0.5)) # Adjust size of image geoMap.gcf().set_size_inches(12.0,8.0) # Add Title and show. geoMap.title("US Map with Labels") geoMap.show()
def fun(values_input, lons2, lats2, ind2): """Urban rural difference""" m = Basemap(llcrnrlon=-180., llcrnrlat=-60., urcrnrlon=180., urcrnrlat=90., projection='cyl') # map.fillcontinents(color='coral',lake_color='w') m.drawcoastlines() # x, y = map(lons[0:50,50], lats[0:50,50]) # c = Values_input_annual[0:50,50] # map.scatter(x, y, marker='s', color='b') x, y = lons2, lats2 xx = np.ndarray.flatten(x) yy = np.ndarray.flatten(y) c = values_input cc = np.ndarray.flatten(c) m.drawmapboundary(fill_color='w') # map.fillcontinents(color='#cc9966',lake_color='#99ffff') m.drawparallels(np.arange(-60, 90, 30), labels=[1, 1, 0, 0]) m.drawmeridians(np.arange(-180, 180, 60), labels=[0, 0, 0, 1]) # map.hexbin(xx, yy, C=cc, cmap='YlOrBr') # map.hexbin(xx, yy, C=cc, cmap=mpl.cm.cool) m.hexbin(xx, yy, C=cc, gridsize=(134, 80), cmap='RdBu_r', extent=(-180, 180, -60, 90)) m.colorbar(location='bottom', pad=0.3) if ind2 == 0: m.title = plt.title(r'$\Delta \alpha$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_alpha.png') elif ind2 == 1: m.title = plt.title(r'$\Delta r_{s}(s/m)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_rs.png') elif ind2 == 2: m.title = plt.title(r'$\Delta r_{a}(s/m)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_ra.png') elif ind2 == 3: m.title = plt.title(r'$\Delta r_{a}^\'(s/m)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_ra_prime.png') elif ind2 == 4: m.title = plt.title(r'$\Delta G(W/m^2)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_G.png') elif ind2 == 5: m.title = plt.title(r'$\Delta R_n^*(W/m^2)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_Rn_str.png') elif ind2 == 6: m.title = plt.title(r'$\Delta H(W/m^2)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_Qh.png') else: m.title = plt.title(r'$\Delta L_e(W/m^2)$', fontsize=20) fig = plt.gcf() plt.show() fig.savefig('figures/figure_nighttime_summer_Qle.png') return