netsse.tools.viz.plot_bathymetry#
- netsse.tools.viz.plot_bathymetry(depths, shp_dict, ax, cmap='Blues_r')#
Plots the bathymetry map for a given area.
The function plots the bathymetry map for a given area using the shapefiles contained in the dictionary shp_dict. The shapefiles are sorted by depth, from the surface to the bottom.
- Parameters:
depths (list) – List of the depths in the shapefiles for the specified area.
shp_dict (dict) – Dictionary containing the shapefiles.
ax (matplotlib.axes) – Axes object to plot on.
cmap (str, optional) –
Colormap to use for the plot. Default is
'Blues_r'.Note
Other colormap options include
'plasma','inferno','magma','viridis'. Visit the Matplotlib documentation for an overview of the options.
- Returns:
ax (matplotlib.axes._subplots.AxesSubplot) – The axes object with the plot.
colormap (matplotlib.colors.ListedColormap) – The colormap used for the plot.
See also
netsse.model.bathymetry.load_bathymetryRetrieve and read bathymetry shapefiles.
Example
import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature from netsse.model.bathymetry import load_bathymetry from netsse.tools.viz import plot_bathymetry depths, shp_dict = load_bathymetry(lonmin=-5, lonmax=15, latmin=35, latmax=45) fig, ax = plt.subplots(subplot_kw={'projection':ccrs.Mercator(central_longitude=5,min_latitude=35,max_latitude=45)},figsize=(6,6)) ax.set_extent([-5, 15, 35, 45], crs=ccrs.PlateCarree()) ax, colormap = plot_bathymetry(depths, shp_dict, ax) ax.add_feature(cfeature.LAND,edgecolor='black',facecolor='gainsboro',alpha=0.5)