Test map layouts """ from pycmbs.mapping import SingleMap from pycmbs.data import Data import matplotlib.pyplot as plt plt.close('all') file='testdata.nc' d=Data(file,'tmp',read=True) import cartopy.crs as ccrs fig = plt.figure(figsize=(8,10)) ax1= fig.add_subplot(2,1,1) ax2= fig.add_subplot(2,1,2) # map only with colorbars m = SingleMap(d, ax=ax1, backend='basemap') # this is supposed to make a baemap plot with stripes m.plot(colorbar_orientation='vertical', vmin=0., vmax=30., proj_prop={'projection':'robin', 'lon_0':0.}, title='with Basemap') m1 = SingleMap(d, ax=ax2, backend='cartopy') # this is supposed to make a baemap plot with stripes m1.plot(colorbar_orientation='vertical', vmin=0., vmax=30., proj_prop={'projection':'robin', 'lon_0':0.}, title='with Cartopy') plt.show()
#~ AMZ 7 (20.000S, 66.377W) (1.239S, 79.729W) (11.439N, 68.800W) (11.439N, 50.000W) (20.000S, 50.000W) #~ CAM 6 (11.439N, 68.800W) (1.239S, 79.729W) (28.566N, 118.323W) (28.566N, 90.315W) tmp = np.ones((180, 360)) d = Data(None, None) d.data = np.ma.array(tmp, mask=tmp!=tmp) d.cell_area = np.ones_like(tmp) lon = np.arange(-180., 180.) + 0.5 lat = np.arange(-90., 90.) + 0.5 d.lon, d.lat = np.meshgrid(lon, lat) # Basemap plots m = SingleMap(d) # this is supposed to make a baemap plot with stripes m.backend = 'basemap' # overwrite default m._draw = m._draw_basemap m.plot(polygons=[P1, P2], proj_prop={'projection':'robin', 'lon_0':0.}, vmin_polygons=0., vmax_polygons=250.) plt.title('Basemap') # cartopy plots m1 = SingleMap(d, backend='cartopy') m1.plot(polygons=[P1, P2], proj_prop={'projection':'robin', 'lon_0':0.}, vmin_polygons=0., vmax_polygons=250.) plt.title('Cartopy') plt.show()
import matplotlib.pyplot as plt plt.close('all') file = 'testdata.nc' d = Data(file, 'tmp', read=True) import cartopy.crs as ccrs fig = plt.figure(figsize=(8, 10)) ax1 = fig.add_subplot(2, 1, 1) ax2 = fig.add_subplot(2, 1, 2) # map only with colorbars m = SingleMap( d, ax=ax1, backend='basemap') # this is supposed to make a baemap plot with stripes m.plot(colorbar_orientation='vertical', vmin=0., vmax=30., proj_prop={ 'projection': 'robin', 'lon_0': 0. }, title='with Basemap') m1 = SingleMap( d, ax=ax2, backend='cartopy') # this is supposed to make a baemap plot with stripes m1.plot(colorbar_orientation='vertical', vmin=0.,
#~ #~ #~ #~ map_plot(d, ax=ax1, colorbar_orientation='vertical', nclasses=34, cticks=[-20.,0., 10.], cticklabels=['A','B','C'], show_zonal=True, use_basemap=True) #~ #~ #~ map_difference(d, d1, show_zonal=False, use_basemap=True) #~ #~ #~ #~ plt.show() #~ stop # map only with colorbars m = SingleMap(d, backend='basemap') #~ m.plot(colorbar_orientation='horizontal', vmin=10., vmax=30., proj_prop={'projection':'robin', 'lon_0':0.}) #~ m.plot(colorbar_orientation='horizontal', vmin=10., vmax=30., proj_prop={'projection':'mercator', 'central_longitude' : 50., 'central_latitude' : 40, 'extent' : {'xmin' : 20., 'xmax' : 70, 'ymin' : -60., 'ymax' : 50.}}) m.plot_around_coordinate(11., 40., 30.) stop mx = SingleMap(d, backend='imshow') mx.plot(colorbar_orientation='horizontal', vmin=10., vmax=20.) m1 = SingleMap(d) m1.plot(colorbar_orientation='vertical')