reVX.exclusions.max_height.max_height.HeightRestrictionExclusions

class HeightRestrictionExclusions(excl_fpath, regulations, features, hsds=False)[source]

Bases: AbstractBaseExclusionsMerger

Exclude whole regions where system height exceeds local limits.

Parameters:
  • excl_fpath (str) – Path to .h5 file containing exclusion layers, will also be the location of any new exclusion layers

  • regulations (~reVX.utilities.AbstractBaseRegulations subclass) – A regulations object used to extract exclusion regulation values.

  • features (str) – Path to file containing features to compute exclusions from.

  • hsds (bool, optional) – Boolean flag to use h5pyd to handle .h5 ‘files’ hosted on AWS behind HSDS. By default False.

Methods

compute_all_local_exclusions([max_workers])

Compute local exclusions for all counties either.

compute_exclusions([out_layer, out_tiff, ...])

Compute exclusions for all states either in serial or parallel.

compute_generic_exclusions(*__, **___)

Return no exclusions because this mode is local-only

compute_local_exclusions(regulation_value, ...)

Compute local height restrictions

pre_process_regulations()

Reduce regulations to only local maximum height entries.

run(excl_fpath, features_path, out_fn, ...)

Compute exclusions and write them to a geotiff.

Attributes

FEATURE_TYPES

description

Description to be added to excl H5.

exclusion_merge_func

Function to merge overlapping exclusion layers.

no_exclusions_array

Array representing no exclusions.

profile

Geotiff profile.

rasterizer

Rasterizer instance, if needed

regulations_table

Regulations table.

shape

Geotiff shape.

property description

Description to be added to excl H5.

Type:

str

property no_exclusions_array

Array representing no exclusions.

Type:

np.ndarray

property exclusion_merge_func

Function to merge overlapping exclusion layers.

Type:

callable

pre_process_regulations()[source]

Reduce regulations to only local maximum height entries.

static compute_local_exclusions(regulation_value, county, *args)[source]

Compute local height restrictions

Parameters:
  • regulation_value (float | int) – Height limit in meters.

  • county (geopandas.GeoDataFrame) – Regulations for a single county.

  • system_height (float | int) – Height of the system in meters.

  • rasterizer (Rasterizer) – Rasterizer object used to rasterize the exclusion features.

compute_generic_exclusions(*__, **___)[source]

Return no exclusions because this mode is local-only

compute_all_local_exclusions(max_workers=None)

Compute local exclusions for all counties either.

Parameters:

max_workers (int, optional) – Number of workers to use for exclusions computation, if 1 run in serial, if > 1 run in parallel with that many workers, if None run in parallel on all available cores. By default None.

Returns:

exclusions (ndarray) – Raster array of exclusions.

compute_exclusions(out_layer=None, out_tiff=None, replace=False, max_workers=None)

Compute exclusions for all states either in serial or parallel. Existing exclusions are computed if a regulations file was supplied during class initialization, otherwise generic exclusions are computed.

Parameters:
  • out_layer (str, optional) – Name to save rasterized exclusions under in .h5 file. If None, exclusions will not be written to the .h5 file. By default None.

  • out_tiff (str, optional) – Path to save geotiff containing rasterized exclusions. If None, exclusions will not be written to a geotiff file. By default None.

  • replace (bool, optional) – Flag to replace geotiff if it already exists. By default False.

  • max_workers (int, optional) – Number of workers to use for exclusion computation, if 1 run in serial, if > 1 run in parallel with that many workers, if None, run in parallel on all available cores. By default None.

Returns:

exclusions (ndarray) – Raster array of exclusions

property profile

Geotiff profile.

Type:

dict

property rasterizer

Rasterizer instance, if needed

Type:

Rasterizer

property regulations_table

Regulations table.

Returns:

geopandas.GeoDataFrame | None

classmethod run(excl_fpath, features_path, out_fn, regulations, max_workers=None, replace=False, out_layers=None, hsds=False, **kwargs)

Compute exclusions and write them to a geotiff. If a regulations file is given, compute local exclusions, otherwise compute generic exclusions. If both are provided, generic and local exclusions are merged such that the local exclusions override the generic ones.

Parameters:
  • excl_fpath (str) – Path to .h5 file containing exclusion layers, will also be the location of any new exclusion layers.

  • features_path (str) – Path to file or directory feature shape files. This path can contain any pattern that can be used in the glob function. For example, /path/to/features/[A]* would match with all the features in the directory /path/to/features/ that start with “A”. This input can also be a directory, but that directory must ONLY contain feature files. If your feature files are mixed with other files or directories, use something like /path/to/features/*.geojson.

  • out_fn (str) – Path to output geotiff where exclusion data should be stored.

  • regulations (~reVX.utilities.AbstractBaseRegulations subclass) – A regulations object used to extract exclusion regulation distances.

  • max_workers (int, optional) – Number of workers to use for exclusion computation, if 1 run in serial, if > 1 run in parallel with that many workers, if None, run in parallel on all available cores. By default None.

  • replace (bool, optional) – Flag to replace geotiff if it already exists. By default False.

  • out_layers (dict, optional) – Dictionary mapping feature file names (with extension) to names of layers under which exclusions should be saved in the excl_fpath .h5 file. If None or empty dictionary, no layers are saved to the h5 file. By default None.

  • hsds (bool, optional) – Boolean flag to use h5pyd to handle .h5 ‘files’ hosted on AWS behind HSDS. By default False.

  • **kwargs – Keyword args to exclusions calculator class.

property shape

Geotiff shape.

Type:

tuple