reVX.least_cost_xmission.layers.masks.Masks

class Masks(io_handler: LayeredTransmissionH5, masks_dir='.')[source]

Bases: object

Create, load, and store masks to determine land and sea.

Parameters:
  • io_handler (LayeredTransmissionH5) – Transmission IO handler

  • masks_dir (path-like, optional) – Directory for storing/finding mask GeoTIFFs. By default, '.'.

Methods

create_masks(land_mask_shp_f[, save_tiff, ...])

Create the offshore and land mask layers from a polygon land vector file.

load_masks()

Load the mask layers from GeoTIFFs.

Attributes

LANDFALL_MASK_FNAME

One pixel width line at shore

LAND_MASK_FNAME

Raw mask - landfall mask

OFFSHORE_MASK_FNAME

Offshore mask filename

RAW_LAND_MASK_FNAME

Rasterized land vector

dry_mask

Dry cells mask, does not include landfall cells

dry_plus_mask

Dry cells mask, includes landfall cells

landfall_mask

Landfalls cells mask, only one cell wide

wet_mask

Wet cells mask, does not include landfall cells

wet_plus_mask

Wet cells mask, includes landfall cells

LANDFALL_MASK_FNAME = 'landfall_mask.tif'

One pixel width line at shore

RAW_LAND_MASK_FNAME = 'raw_land_mask.tif'

Rasterized land vector

LAND_MASK_FNAME = 'land_mask.tif'

Raw mask - landfall mask

OFFSHORE_MASK_FNAME = 'offshore_mask.tif'

Offshore mask filename

property landfall_mask: ndarray[Any, dtype[bool_]]

Landfalls cells mask, only one cell wide

Type:

MaskArr

property wet_mask: ndarray[Any, dtype[bool_]]

Wet cells mask, does not include landfall cells

Type:

MaskArr

property dry_mask: ndarray[Any, dtype[bool_]]

Dry cells mask, does not include landfall cells

Type:

MaskArr

property dry_plus_mask: ndarray[Any, dtype[bool_]]

Dry cells mask, includes landfall cells

Type:

MaskArr

property wet_plus_mask: ndarray[Any, dtype[bool_]]

Wet cells mask, includes landfall cells

Type:

MaskArr

create_masks(land_mask_shp_f: str, save_tiff: bool = True, reproject_vector: bool = True)[source]

Create the offshore and land mask layers from a polygon land vector file.

Parameters:
  • mask_shp_f (str) – Full path to land polygon gpgk or shp file

  • save_tiff (bool, optional) – Save mask as tiff if true. By default, True.

  • reproject_vector (bool, optional) – Reproject CRS of vector to match template raster if True. By default, True.

load_masks()[source]

Load the mask layers from GeoTIFFs. This does not need to be called if self.create_masks() was run previously. Mask files must be in the current directory.