def main(): fname = iris.sample_data_path('rotated_pole.nc') temperature = iris.load_strict(fname) # Calculate the lat lon range and buffer it by 10 degrees lat_range, lon_range = iris.analysis.cartography.lat_lon_range(temperature) lat_range = lat_range[0] - 10, lat_range[1] + 10 lon_range = lon_range[0] - 10, lon_range[1] + 10 # Plot #1: Point plot showing data values & a colorbar plt.figure() iplt.map_setup(temperature, lat_range=lat_range, lon_range=lon_range) points = qplt.points(temperature, c=temperature.data) cb = plt.colorbar(points, orientation='horizontal') cb.set_label(temperature.units) iplt.gcm().drawcoastlines() plt.show() # Plot #2: Contourf of the point based data plt.figure() iplt.map_setup(temperature, lat_range=lat_range, lon_range=lon_range) qplt.contourf(temperature, 15) iplt.gcm().drawcoastlines() plt.show() # Plot #3: Contourf overlayed by coloured point data plt.figure() iplt.map_setup(temperature, lat_range=lat_range, lon_range=lon_range) qplt.contourf(temperature) iplt.points(temperature, c=temperature.data) iplt.gcm().drawcoastlines() plt.show() # For the purposes of this example, add some bounds to the latitude and longitude temperature.coord('grid_latitude').guess_bounds() temperature.coord('grid_longitude').guess_bounds() # Plot #4: Block plot plt.figure() iplt.map_setup(temperature, lat_range=lat_range, lon_range=lon_range) iplt.pcolormesh(temperature) iplt.gcm().bluemarble() iplt.gcm().drawcoastlines() plt.show()
def main(): # Enable a future option, to ensure that the netcdf load works the same way # as in future Iris versions. iris.FUTURE.netcdf_promote = True # Load some test data. fname = iris.sample_data_path('rotated_pole.nc') air_pressure = iris.load_cube(fname) # Plot #1: Point plot showing data values & a colorbar plt.figure() points = qplt.points(air_pressure, c=air_pressure.data) cb = plt.colorbar(points, orientation='horizontal') cb.set_label(air_pressure.units) plt.gca().coastlines() iplt.show() # Plot #2: Contourf of the point based data plt.figure() qplt.contourf(air_pressure, 15) plt.gca().coastlines() iplt.show() # Plot #3: Contourf overlayed by coloured point data plt.figure() qplt.contourf(air_pressure) iplt.points(air_pressure, c=air_pressure.data) plt.gca().coastlines() iplt.show() # For the purposes of this example, add some bounds to the latitude # and longitude air_pressure.coord('grid_latitude').guess_bounds() air_pressure.coord('grid_longitude').guess_bounds() # Plot #4: Block plot plt.figure() plt.axes(projection=ccrs.PlateCarree()) iplt.pcolormesh(air_pressure) plt.gca().stock_img() plt.gca().coastlines() iplt.show()
def main(): fname = iris.sample_data_path('rotated_pole.nc') temperature = iris.load_cube(fname) # Plot #1: Point plot showing data values & a colorbar plt.figure() points = qplt.points(temperature, c=temperature.data) cb = plt.colorbar(points, orientation='horizontal') cb.set_label(temperature.units) plt.gca().coastlines() plt.show() # Plot #2: Contourf of the point based data plt.figure() qplt.contourf(temperature, 15) plt.gca().coastlines() plt.show() # Plot #3: Contourf overlayed by coloured point data plt.figure() qplt.contourf(temperature) iplt.points(temperature, c=temperature.data) plt.gca().coastlines() plt.show() # For the purposes of this example, add some bounds to the latitude and longitude temperature.coord('grid_latitude').guess_bounds() temperature.coord('grid_longitude').guess_bounds() # Plot #4: Block plot plt.figure() ax = plt.axes(projection=ccrs.PlateCarree()) iplt.pcolormesh(temperature) plt.gca().stock_img() plt.gca().coastlines() plt.show()
def test_xaxis_labels(self): qplt.points(self.cube, coords=("str_coord", "bar")) self.assertBoundsTickLabels("xaxis")
def test_alignment(self): cube = self._small() qplt.contourf(cube) #qplt.outline(cube) qplt.points(cube) self.check_graphic()
def test_xaxis_labels(self): qplt.points(self.cube, coords=('str_coord', 'bar')) self.assertBoundsTickLabels('xaxis')