Skip to content

Plot shapefile/catchment utility function #484

@BSchilperoort

Description

@BSchilperoort

For demo notebooks or in a student thesis it can be nice to show the catchment that is being modeled on a map. This would reduce the clutter and can implement a consistent and clean API to plot.

Something like;

def plot_catchment(
    shape: Path | str,
    lat_bounds: tuple[float, float] | None,
    lon_bounds: tuple[float, float] | None,
    ax: matplotlib.axis.Axis | None,
) -> tuple[matplotlib.figure.Figure, matplotlib.axis.Axis] | None:
    # Load shape / geometry

    if ax:
        # plot in existing axis
    else:
        # create cartopy mat plot, add shapefile
        # also add country borders, coastline, sea, rivers.

    if lat_bounds and lon_bounds:
        # apply bounds (set_xlim, set_ylim)
    else:
        # infer appropriate bounds, apply

    if ax is None:
        return fig, axis # return figure and axis so users can add to/modify plot

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions