revrt.costs.layer_creator.LayerCreator#
- class LayerCreator(io_handler, masks, input_layer_dir='.', output_tiff_dir='.', dtype='float32')[source]#
Bases:
BaseLayerCreatorBuild layer based on tiff and user config
- Parameters:
io_handler (
LayeredFile) – Layered file IO handler.masks (
Masks) – Masks instance that can be used to retrieve multiple types of masks.input_layer_dir (path-like, optional) – Directory to search for input layers in, if not found in current directory. By default,
'.'.output_tiff_dir (path-like, optional) – Directory where cost layers should be saved as GeoTIFF. By default,
".".dtype (
dtype, optional) – Data type for final dataset. By default,float32.
Methods
build(layer_name, build_config[, ...])Combine multiple GeoTIFFs and vectors to a raster layer
Attributes
Size of cell in layer file
Layer chunks (no band dimension)
path-like GeoTIFFs output dir
Layer shape
- build(layer_name, build_config, values_are_costs_per_mile=False, write_to_file=True, description=None, tiff_chunks='file', nodata=None, lock=None, **profile_kwargs)[source]#
Combine multiple GeoTIFFs and vectors to a raster layer
- 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, defaultFalse) – Option to convert values into costs per cell under the assumption that the resulting values are costs in $/mile. By default,False, which writes raw values to TIFF/H5.write_to_file (
bool, defaultTrue) –Option to write the layer to file after creation.
Important
This will overwrite existing layers with the same name already in the file.
By default,
True.description (
str, optional) – Optional description to store with this layer in the H5 file. By default,None.tiff_chunks (
intorstr, default"file") – Chunk size to use when reading the GeoTIFF file. This will be passed down as thechunksargument torioxarray.open_rasterio(). By default,"file".nodata (
intorfloat, optional) – Optional nodata value for output rasters. This value will be added to the layer’s attributes meta dictionary under the “nodata” key.lock (
boolor dask.distributed.Lock, optional) – Lock to use to write data to GeoTIFF using dask. If not supplied, a single process is used for writing data to disk. By default,None.**profile_kwargs –
Additional keyword arguments to pass into writing output rasters. The following attributes ar ignored (they are set using properties of the
LayeredFile):nodata
transform
crs
count
width
height