deltametrics.plan.OpeningAnglePlanform¶
- class deltametrics.plan.OpeningAnglePlanform(*args, **kwargs)¶
Planform for handling the Shaw Opening Angle Method.
This Planform (called OAP for short) is a wrapper/handler for the input and output from the
shaw_opening_angle_method()
. The OAP is a convenient way to manage extraction of a shoreline or a delta topset area.Moreover, the OAP can be used as the input for many types of Mask objects, so it is often computationally advantageous to compute this Planform once, and then use it to create many different types of masks.
Examples
Instantiate the OpeningAnglePlanform from an inverted binary mask of elevation data (i.e., from an
ElevationMask
).Note that the below example is the most verbose method for creating the OAP. Consider available static methods.
>>> golfcube = dm.sample_data.golf() >>> _EM = dm.mask.ElevationMask( ... golfcube['eta'][-1, :, :], ... elevation_threshold=0)
>>> # extract a mask of area below sea level as the >>> # inverse of the ElevationMask >>> below_mask = ~(_EM.mask)
>>> OAP = dm.plan.OpeningAnglePlanform(below_mask)
The OAP stores information computed from the
shaw_opening_angle_method()
. See the two properties of the OAPbelow_mask
andopening_angles
.- __init__(*args, **kwargs)¶
Init.
EXPECTS A BINARY OCEAN MASK AS THE INPUT!
Note
needs docstring.
Methods
__init__
(*args, **kwargs)Init.
from_ElevationMask
(ElevationMask, **kwargs)Create an OpeningAnglePlanform from an ElevationMask.
from_arrays
(*args)Create directly from arrays.
from_elevation_data
(elevation_data, **kwargs)Create an OpeningAnglePlanform from elevation data.
from_mask
(UnknownMask, **kwargs)Wraps
from_ElevationMask
.show
([var, ax, title, ticks, colorbar, ...])Show the planform.
Attributes
Mask for below sea level pixels.
Alias to opening_angles.
The public data field.
Planform name.
Maximum opening angle view of the sea from a pixel.
Alias to opening_angles.
Planform shape.
- __getitem__(slc)¶
Slice the planform.
Implements basic slicing for SpecialtyPlanform by passing the slc to self.data. I.e., the returned slice is
self.data[slc]
.
- property below_mask¶
Mask for below sea level pixels.
This is the starting point for the Opening Angle Method solution.
See figure in main docstring for visual example.
- property composite_array¶
Alias to opening_angles.
This is the array that a contour is extracted from using some threshold value when making land and shoreline masks.
- property data¶
The public data field.
This attribute must be implemented as an alias to another attribute. The choice of field is up to the developer.
- static from_ElevationMask(ElevationMask, **kwargs)¶
Create an OpeningAnglePlanform from an ElevationMask.
Note
Keyword arguments are passed to the OpeningAnglePlanform, and thus passed to
shaw_opening_angle_method()
.- Parameters:
ElevationMask (
ElevationMask
) – TheElevationMask
to be used to create the OpeningAnglePlanform.
Examples
>>> golfcube = dm.sample_data.golf() >>> _EM = dm.mask.ElevationMask( ... golfcube['eta'][-1, :, :], ... elevation_threshold=0) >>> OAP = dm.plan.OpeningAnglePlanform.from_ElevationMask( ... _EM)
- static from_arrays(*args)¶
Create directly from arrays.
Warning
not implemented.
- static from_elevation_data(elevation_data, **kwargs)¶
Create an OpeningAnglePlanform from elevation data.
This process creates an ElevationMask from the input elevation array, and proceeds to make the OAP from the below sea level mask.
Note
Keyword arguments are passed to the ElevationMask and to the OpeningAnglePlanform, and thus passed to
shaw_opening_angle_method()
.Important
The elevation_threshold argument is implicitly required in this method, because it is required to instantiate an
ElevationMask
from elevation data.- Parameters:
elevation_data (
ndarray
) – The elevation data to create the ElevationMask that is in turn used to create the OpeningAnglePlanform.
Examples
>>> golfcube = dm.sample_data.golf() >>> OAP = dm.plan.OpeningAnglePlanform.from_elevation_data( ... golfcube['eta'][-1, :, :], ... elevation_threshold=0)
- static from_mask(UnknownMask, **kwargs)¶
Wraps
from_ElevationMask
.
- property name¶
Planform name.
Helpful to differentiate multiple Planform objects.
- property opening_angles¶
Maximum opening angle view of the sea from a pixel.
See figure in main docstring for visual example.
- property sea_angles¶
Alias to opening_angles.
This alias is implemented for backwards compatability, and should not be relied on. Use opening_angles instead.
- property shape¶
Planform shape.
- show(var=None, ax=None, title=None, ticks=False, colorbar=True, colorbar_label=False)¶
Show the planform.
Display a field of the planform, called by attribute name.
- Parameters:
var (
str
) – Which field to show. Must be an attribute of the planform. show will look for another attribute describing theVariableInfo
for that attribute namedself._<var>_varinfo
and use that to style the plot, if found. If this VariableInfo is not found, the default is used.label (
bool
, str, optional) – Display a label of the variable name on the plot. Default is False, display nothing. Iflabel=True
, the label name from theVariableSet
is used. Other arguments are attempted to coerce to str, and the literal is diplayed.colorbar (
bool
, optional) – Whether a colorbar is appended to the axis.colorbar_label (
bool
, str, optional) – Display a label of the variable name along the colorbar. Default is False, display nothing. Iflabel=True
, the label name from theVariableSet
is used. Other arguments are attempted to coerce to str, and the literal is diplayed.ax (
Axes
object, optional) – A matplotlib Axes object to plot the section. Optional; if not provided, a call is made toplt.gca()
to get the current (or create a new) Axes object.