Methods to plot data defined on Landlab grids.
imshow_grid (grid, values, \*\*kwds) |
Prepare a map view of data over all nodes or cells in the grid. |
imshow_grid_at_cell (grid, values, \*\*kwds) |
Map view of grid data over all grid cells. |
imshow_grid_at_node (grid, values, \*\*kwds) |
Prepare a map view of data over all nodes in the grid. |
imshow_grid
(grid, values, **kwds)[source]¶Prepare a map view of data over all nodes or cells in the grid.
Data is plotted as colored cells. If at=’node’, the surrounding cell is shaded with the value at the node at its center. If at=’cell’, the cell is shaded with its own value. Outer edges of perimeter cells are extrapolated. Closed elements are colored uniformly (default black, overridden with kwd ‘color_for_closed’); other open boundary nodes get their actual values.
values can be a field name, a regular array, or a masked array. If a masked array is provided, masked entries will be treated as if they were Landlab CLOSED_BOUNDARYs. Used together with the color_at_closed=None keyword (i.e., “transparent”), this can allow for construction of overlay layers in a figure (e.g., only defining values in a river network, and overlaying it on another landscape).
Use matplotlib functions like xlim, ylim to modify your plot after calling
imshow_grid()
, as desired.
This function happily works with both regular and irregular grids.
Construction
imshow_grid(grid, values, plot_name=None, var_name=None,
var_units=None, grid_units=None,
symmetric_cbar=False, cmap='pink',
limits=(values.min(), values.max()),
vmin=values.min(), vmax=values.max(),
allow_colorbar=True, colorbar_label=None,
norm=[linear], shrink=1.,
color_for_closed='black',
color_for_background=None,
show_elements=False)
Parameters: | grid : ModelGrid
values : array_like, masked_array, or str
at : str, {‘node’, ‘cell’}
plot_name : str, optional
var_name : str, optional
var_units : str, optional
grid_units : tuple of str, optional
symmetric_cbar : bool
cmap : str
limits : tuple of float
vmin, vmax: floats
allow_colorbar : bool
colorbar_label : str or None
norm : matplotlib.colors.Normalize
shrink : float
color_for_closed : str or None
color_for_background : color str or other color declaration, or None
show_elements : bool
output : None, string, or bool
|
---|
imshow_grid_at_cell
(grid, values, **kwds)[source]¶Map view of grid data over all grid cells.
Prepares a map view of data over all cells in the grid.
Method can take any of the same **kwds
as imshow_grid_at_node()
.
Construction
imshow_grid_at_cell(grid, values, plot_name=None, var_name=None,
var_units=None, grid_units=None,
symmetric_cbar=False, cmap='pink',
limits=(values.min(), values.max()),
vmin=values.min(), vmax=values.max(),
allow_colorbar=True, colorbar_label=None,
norm=[linear], shrink=1.,
color_for_closed='black',
color_for_background=None,
show_elements=False, output=None)
Parameters: | grid : ModelGrid
values : array_like, masked_array, or str
plot_name : str, optional
var_name : str, optional
var_units : str, optional
grid_units : tuple of str, optional
symmetric_cbar : bool
cmap : str
limits : tuple of float
vmin, vmax: floats
allow_colorbar : bool
colorbar_label : str or None
norm : matplotlib.colors.Normalize
shrink : float
color_for_closed : str or None
color_for_background : color str or other color declaration, or None
show_elements : bool
output : None, string, or bool
|
---|---|
Raises: | ValueError
|
imshow_grid_at_node
(grid, values, **kwds)[source]¶Prepare a map view of data over all nodes in the grid.
Data is plotted as cells shaded with the value at the node at its center. Outer edges of perimeter cells are extrapolated. Closed elements are colored uniformly (default black, overridden with kwd ‘color_for_closed’); other open boundary nodes get their actual values.
values can be a field name, a regular array, or a masked array. If a masked array is provided, masked entries will be treated as if they were Landlab CLOSED_BOUNDARYs. Used together with the color_at_closed=None keyword (i.e., “transparent”), this can allow for construction of overlay layers in a figure (e.g., only defining values in a river network, and overlaying it on another landscape).
Use matplotlib functions like xlim, ylim to modify your plot after calling
imshow_grid()
, as desired.
This function happily works with both regular and irregular grids.
Construction
imshow_grid_at_node(grid, values, plot_name=None, var_name=None,
var_units=None, grid_units=None,
symmetric_cbar=False, cmap='pink',
limits=(values.min(), values.max()),
vmin=values.min(), vmax=values.max(),
allow_colorbar=True,
norm=[linear], shrink=1.,
color_for_closed='black',
color_for_background=None,
show_elements=False, output=None)
Parameters: | grid : ModelGrid
values : array_like, masked_array, or str
plot_name : str, optional
var_name : str, optional
var_units : str, optional
grid_units : tuple of str, optional
symmetric_cbar : bool
cmap : str
limits : tuple of float
vmin, vmax: floats
allow_colorbar : bool
colorbar_label : str or None
norm : matplotlib.colors.Normalize
shrink : float
color_for_closed : str or None
color_for_background : color str or other color declaration, or None
show_elements : bool
output : None, string, or bool
|
---|
Extract and plot channel long profiles.
Plotting functions to extract and plot channel long profiles. Call all three functions in sequence from the main code.
The functions will return the long profile nodes, return distances upstream of those nodes, and plot the long profiles, respectively. The former two are, by necessity, ragged lists of arrays - the number of channels, then the nodes in that channel.
This module selects channels by taking the largest possible drainages crossing the grid boundaries. You can specify how many different channels it handles using the number_of_channels parameter in the channel_nodes function (default is 1). This may lead to strange outputs if the drainage structure of the output changes mid-run (e.g., channel piracy). This may be modified in the future.
analyze_channel_network_and_plot
(grid, elevations='topographic__elevation', drainage_area='drainage_area', flow_receiver='flow__receiver_node', links_to_flow_receiver='flow__link_to_receiver_node', number_of_channels=1, starting_nodes=None, threshold=None)[source]¶This function wraps the other three present here, and allows a single-line call to plot long profiles. As typical elsewhere, the inputs can be field names or arrays.
Note the key new parameter starting_nodes. This (optionally) can be a Python list of node IDs marking the start of each profile. If it is not provided, the profiles with the largest terminal drainage area will be used instead.
Both lists are number_of_channels long. -
colors.py
Created on Mon Jan 18 13:28:17 2016
@author: gtucker