import matplotlib.pyplot import glint2 import sys # Simple script to plot the polygons of a grid # m.greenland2.grid2 fname = sys.argv[1] if len(sys.argv) > 2 : vname = sys.argv[2] else : vname = 'grid' nc = netCDF4.Dataset(fname) grid = glint2.pyGrid(nc, vname) grid1 = glint2.pyGrid(nc, 'm.grid1') nc.close() # Plot multiple plots on one page figure = matplotlib.pyplot.figure(figsize=(8.5,11)) ax = figure.add_subplot(111) #mymap = giss.basemap.greenland_laea(ax) mymap = giss.basemap.north_laea(ax) grid.plot(mymap, linewidth=.5) grid1.plot(mymap, linewidth=.5, color='r') mymap.drawcoastlines() # Also show on screen figure.savefig('x.ps')
subprocess.call(['../../sbin/overlap', 'greenland_2x2_5.nc', 'searise_g20.nc']) if 2 in steps : # =============== Step 2: Plot grid outlines # Set up the page figure = matplotlib.pyplot.figure(figsize=(11,8.5)) # figure.set_size_inches(11., 8.5) # US Letter figure.set_size_inches(8.267,11.692) # A4 # -------- First plot: grid1 # Read the grid nc = netCDF4.Dataset(grid1_name + '.nc', 'r') grid1 = glint2.pyGrid(nc, 'grid') nc.close() # Plot it! ax = figure.add_subplot(131) basemap = giss.basemap.greenland_laea(ax=ax) grid1.plot(basemap) # ---------- Second plot: grid2 # Read the grid nc = netCDF4.Dataset('searise_g20.nc', 'r') grid2 = glint2.pyGrid(nc, 'grid') nc.close() ax = figure.add_subplot(132) basemap = giss.basemap.greenland_laea(ax=ax)
# Usage: plot_grid <grid-file.nc> [var-name] # var-name default = 'grid' # Simple script to plot the polygons of a grid # m.greenland2.grid2 fname = sys.argv[1] if len(sys.argv) > 2 : vname = sys.argv[2] else : vname = 'grid' nc = netCDF4.Dataset(fname) grid = glint2.pyGrid(nc, vname) nc.close() # Plot multiple plots on one page figure = matplotlib.pyplot.figure(figsize=(8.5,11)) ax = figure.add_subplot(111) mymap = giss.basemap.greenland_laea(ax) #mymap = giss.basemap.north_laea(ax) grid.plot(mymap, linewidth=.5) mymap.drawcoastlines() # Also show on screen figure.savefig('x.pdf') matplotlib.pyplot.show()
import matplotlib.pyplot import glint2 import sys # Simple script to plot the polygons of a grid # m.greenland2.grid2 fname = sys.argv[1] if len(sys.argv) > 2: vname = sys.argv[2] else: vname = 'grid' nc = netCDF4.Dataset(fname) grid = glint2.pyGrid(nc, vname) grid1 = glint2.pyGrid(nc, 'm.grid1') nc.close() # Plot multiple plots on one page figure = matplotlib.pyplot.figure(figsize=(8.5, 11)) ax = figure.add_subplot(111) #mymap = giss.basemap.greenland_laea(ax) mymap = giss.basemap.north_laea(ax) grid.plot(mymap, linewidth=.5) grid1.plot(mymap, linewidth=.5, color='r') mymap.drawcoastlines() # Also show on screen figure.savefig('x.ps')