Extract#

silvimetric.commands.extract.extract(config: ExtractConfig) None#

Pull data from database for each desired metric and output them to rasters

Parameters:

config – ExtractConfig.

silvimetric.commands.extract.get_metrics(data_in: DataFrame, storage: Storage) None | DataFrame#

Reruns a metric over this cell. Only called if there is overlapping data.

Parameters:
  • data_in – Dataframe to be rerun.

  • storage – Base storage object.

Returns:

Combined dict of attribute and newly derived metric data.

silvimetric.commands.extract.handle_overlaps(config: ExtractConfig, storage: Storage, indices: ndarray) DataFrame#

Handle cells that have overlapping data. We have to re-run metrics over these cells as there’s no other accurate way to determined metric values. If there are no overlaps, this will do nothing.

Parameters:
  • config – ExtractConfig.

  • storage – Database storage object.

  • indices – Indices with overlap.

Returns:

Dataframe of rerun data.

silvimetric.commands.extract.write_tif(xsize: int, ysize: int, data: ndarray, name: str, config: ExtractConfig) None#

Write out a raster with GDAL

Parameters:
  • xsize – Length of X plane.

  • ysize – Length of Y plane.

  • data – Data to write to raster.

  • name – Name of raster to write.

  • config – ExtractConfig.