reVX.least_cost_xmission.layers.layer_creator.LayerCreator
- class LayerCreator(io_handler: LayeredTransmissionH5, masks: Masks, output_tiff_dir='.', dtype: dtype[Any] | None | Type[Any] | _SupportsDType[dtype[Any]] | str | Tuple[Any, int] | Tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | List[Any] | _DTypeDict | Tuple[Any, Any] = 'float32', cell_size=90)[source]
Bases:
BaseLayerCreator
Build layer based on tiff and user config.
- Parameters:
io_handler (
LayeredTransmissionH5
) – Transmission layer IO handlermasks (Masks) – Masks instance that can be used to retrieve multiple types of masks.
output_tiff_dir (path-like, optional) – Directory where cost layers should be saved as GeoTIFF. By default,
"."
.dtype (np.dtype, optional) – Data type for final dataset. By default,
float32
.cell_size (int, optional) – Side length of each cell, in meters. Cells are assumed to be square. By default,
CELL_SIZE
.
Methods
build
(layer_name, build_config[, ...])Combine multiple GeoTIFFs and vectors to a raster layer and save to GeoTIFF/HDF5 file.
Attributes
Layer shape.
- build(layer_name, build_config: Dict[str, LayerBuildConfig], values_are_costs_per_mile=False, write_to_h5=True, description=None)[source]
Combine multiple GeoTIFFs and vectors to a raster layer and save to GeoTIFF/HDF5 file.
- Parameters:
layer_name (str) – Name of layer to use in H5 and for output tiff.
build_config (LayerBuildComponents) – Dict of LayerBuildConfig keyed by GeoTIFF/vector filenames.
values_are_costs_per_mile (bool, default=False) – Option to convert values into costs per cell under the assumption that the resulting values arte costs in $/mile. By default,
False
, which writes raw values to TIFF/H5.write_to_h5 (bool, default=True) – Option to write the layer to H5 file after creation. By default,
True
.description (str, optional) – Optional description to store with this layer in the H5 file. By default,
None
.