Masking operations

The package makes available routines for masking out attributes of the delta.

This class is defined in deltametrics.mask.

Mask lexicon and use

Computing masks efficiently

If you are creating multiple masks for the same planform data (e.g., for the same time slice of data for the physical domain), it is computationally advantageous to create a single OpeningAnglePlanform, and use this OAP to create other masks.

For example:

>>> golfcube = dm.sample_data.golf()
>>> OAP = dm.plan.OpeningAnglePlanform.from_elevation_data(
...     golfcube['eta'][-1, :, :],
...     elevation_threshold=0)
>>> lm = dm.mask.LandMask.from_OAP(OAP)
>>> sm = dm.mask.ShorelineMask.from_OAP(OAP)
>>> fig, ax = plt.subplots(2, 2)
>>> golfcube.show_plan('eta', t=-1, ax=ax[0, 0])
>>> ax[0, 1].imshow(OAP.sea_angles, vmax=180, cmap='jet')
>>> lm.show(ax=ax[1, 0])
>>> sm.show(ax=ax[1, 1])

(png, hires.png)

../../_images/index-1.png

Note

needs to be expanded!

Trimming masks before input to metrics and functions

Sometimes it is helpful to trim a mask, essentially replacing values with a different value, before using the mask for analysis or input to functions.

(png, hires.png)

../../_images/index-2.png

Mask types

ElevationMask(*args, elevation_threshold[, …])

Elevation mask.

FlowMask(*args, flow_threshold[, cube_key])

Flow field mask.

LandMask(*args[, angle_threshold])

Identify a binary mask of the delta topset.

ShorelineMask(*args[, angle_threshold])

Identify the shoreline as a binary mask.

WetMask(*args, **kwargs)

Compute the wet mask.

ChannelMask(*args[, is_mask])

Identify a binary channel mask.

EdgeMask(*args, **kwargs)

Identify the land-water edges.

CenterlineMask(*args[, method])

Identify channel centerline mask.

BaseMask(mask_type, *args, **kwargs)

Low-level base class to be inherited by all mask objects.

ThresholdValueMask(*args, threshold[, cube_key])

Threshold value mask.

GeometricMask(*args[, origin])

Create simple geometric masks.