reVX.utilities.exclusions.AbstractExclusionCalculatorInterface

class AbstractExclusionCalculatorInterface[source]

Bases: ABC

Abstract Exclusion Calculator Interface.

Methods

compute_generic_exclusions([max_workers])

Compute generic exclusions.

compute_local_exclusions(regulation_value, ...)

Compute local feature exclusions.

pre_process_regulations()

Reduce regulations to correct state and features.

Attributes

exclusion_merge_func

Function to merge overlapping exclusion layers.

no_exclusions_array

Array representing no exclusions.

abstract property no_exclusions_array

Array representing no exclusions.

Type:

np.array

abstract property exclusion_merge_func

Function to merge overlapping exclusion layers.

Type:

callable

abstract pre_process_regulations()[source]

Reduce regulations to correct state and features.

When implementing this method, make sure to update self._regulations.df.

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

Compute local feature exclusions.

This method should compute the exclusions using the information about the input county.

Parameters:
  • regulation_value (float | int) – Regulation value for county.

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

  • *args – Other arguments required for local exclusion calculation.

Returns:

  • exclusions (np.ndarray) – Array of exclusions.

  • slices (2-tuple of slice) – X and Y slice objects defining where in the original array the exclusion data should go.

abstract compute_generic_exclusions(max_workers=None)[source]

Compute generic exclusions.

This method should compute the exclusions using a generic regulation value (self._regulations.generic).

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