w4h.visualization module¶
The visualization module contains functions for creating plots and data vizualizations from outputs from w4h.run()
- w4h.visualization.plot_cross_section(dataset, profile=None, profile_direction=None, xcoord='x', ycoord='y', mapped_variable='Depth_to_Bedrock', cross_section_variable='Model_Layers', surface_elevation_variable='Surface_Elevation', bedrock_elevation_variable='Bedrock_Elevation', layer_elevation_coordinate='layer_elevs', show_layers=True, return_profile_dicts=False, elev_unit='feet', convert_elevation_to=None, title=None, verbose=False, **kwargs)[source]¶
Function to plot cross section profiles for datasets with properly configured coordinates and variables. This is intended to work “out of the box” with the xarray.Datasets output from w4h.run()
- Parameters:
- datasetxarray.Dataset
The xarray.Dataset with the proper data variables. Works “out of the box” with outputs from w4h.run().
- profileNone, shapely.Linestring, list of coordinates, or geopandas.GeoDataFrame, optional
The profile(s) for which to create the cross sections. If None, by default creates one X profile and one Y profile in the middle of each dimension, by default None
- profile_directionlist of str, optional
List of strings (list is same length as profile) indicating the direction to use for the profile. If None, will be [‘WE’, ‘SN’] to fit with profile=None defaults, by default None
- xcoordstr, optional
Name of x coordinate, by default ‘x’
- ycoordstr, optional
Name of y coordinate, by default ‘y’
- mapped_variablestr, optional
Name of variable to show in main map, by default ‘Depth_to_Bedrock’
- cross_section_variablestr, optional
Name of variable to use for cross section profiles, by default ‘Model_Layers’
- surface_elevation_variablestr, optional
Variable to use for the surface elevation, by default ‘Surface_Elevation’
- bedrock_elevation_variablestr, optional
Variable to use for the bedrock elevation, by default ‘Bedrock_Elevation’
- layer_elevation_coordinatestr, optional
Coordinate name to use for the layer elevations. This should be a non-indexed coordinate with the shape of the x, y, and layer coordinates, by default ‘layer_elevs’
- show_layersbool, optional
Whether to plot the layer boundaries on the cross section, by default True
- return_profile_dictsbool, optional
Whether to return the profile dictionaries, rather than the matplotlib.Figure, by default False
- elev_unitstr, optional
Unit of elevation for the elevation data, by default ‘feet’
- convert_elevation_tostr, optional
If None (default), does not convert elevation. Otherwise, will convert elevation to specified unit. Only conversion between ‘ft’ and ‘meters’ supported.
- titlestr, optional
Title to use for the output figure. If None, will be derived from variable names, by default None
- verbosebool, optional
Whether to print information about process to terminal, by default False
- Returns:
- matplotlib.Figure
Matplotlib.Figure instance is returned, unles return_profile_dicts is True. If return_profile_dicts=True, then a list of dicts with information about the profiles is returned.