Calculation base classes¶
- class pyForMetrix.metrix.FileMetrics(lasfiles, silent=True, pbars=True)¶
- __init__(lasfiles, silent=True, pbars=True)¶
Class to calculate metrics on a file basis
- Parameters:
lasfiles –
listof input las-Files to consider. Note that the scanning (finding the points inside the plots) can be sped up siginificantly by providing .lax-Files, which can be generated e.g. using lasindex, part of the LASTools (https://rapidlasso.com/lastools/, proprietory software with free/open components).silent –
booleanwhether to print output or notpbars –
booleanwhether to display progress bars or not
- calc_custom_metrics(metrics: MetricCalculator, metric_options=None)¶
Calculates given metrics for points contained in the polygons given during construction of this class.
- Parameters:
- Returns:
a
pandas.DataFramecontaining the metrics for each polygon in the input.
- class pyForMetrix.metrix.Metrics¶
- class pyForMetrix.metrix.PlotMetrics(lasfiles, plot_polygons, silent=True, pbars=True)¶
- __init__(lasfiles, plot_polygons, silent=True, pbars=True)¶
Class to calculate metrics on a plot (polygon) basis
- Parameters:
lasfiles –
listof input las-Files to consider. Note that the scanning (finding the points inside the plots) can be sped up siginificantly by providing .lax-Files, which can be generated e.g. using lasindex, part of the LASTools (https://rapidlasso.com/lastools/, proprietory software with free/open components).plot_polygons –
geopandas.GeoDataFramearray containing the geometries (polygons) of interestsilent –
booleanwhether to print output or notpbars –
booleanwhether to display progress bars or not
- calc_custom_metrics(metrics: MetricCalculator, metric_options=None)¶
Calculates given metrics for points contained in the polygons given during construction of this class.
- Parameters:
- Returns:
a
pandas.DataFramecontaining the metrics for each polygon in the input.
- class pyForMetrix.metrix.RasterMetrics(points, raster_size, percentiles=numpy.arange, p_zabovex=None, silent=True, pbars=True, raster_min=None, raster_max=None, origin=None)¶
- __init__(points, raster_size, percentiles=numpy.arange, p_zabovex=None, silent=True, pbars=True, raster_min=None, raster_max=None, origin=None)¶
Class to calculate metrics on a raster (cell) basis.
- Parameters:
points –
dictcontaining keys ‘points’ and potentially other attributes, which are :numpy:ndarray s containing the points.raster_size –
floatraster cell size used for calculationpercentiles – deprecated
p_zabovex – deprecated
silent – deprecated
pbars –
boolwhether to show progress bars or notraster_min –
numpy.ndarrayof shape (2,) with the minimum x/y coordinates for the raster (default: derive from point cloud)raster_max –
numpy.ndarrayof shape (2,) with the maximum x/y coordinates for the raster (default: derive from point cloud)origin –
numpy.ndarrayof shape (2,) with the origin x/y coordinates (pixel center) for the raster (default: same as raster_min)
- calc_custom_metrics(metrics: MetricCalculator, metric_options=None)¶
Calculates the given metrics on the point cloud this class was initialized on.
- Parameters:
- Returns:
An
xarray.Datasetcontaining the metric(s) in a raster grid
- calc_custom_metrics_parallel(metrics, n_chunks=16, n_processes=4, pbar_position=0, multiprocessing_point_threshold=10000, metric_options=None)¶
Calculates the given metrics on the point cloud this class was initialized on, in parallel. Parallelization is achieved by spawning multiple processes for subsets of the raster cells. Note that it might be faster to parallelize over input datasets, if they are chunked.
- Parameters:
metrics – see
calc_custom_metrics()n_chunks – number of chunks to split the valid raster cells into (more chunks decrease memory usage)
n_processes – number of processes to work on the chunks (more processes increase memory usage)
pbar_position – deprecated
multiprocessing_point_threshold – number of raster cells at which multiprocessing should be started. For relatively small datasets, the overhead of spawning extra processes outweights the benefit. Ideal setting depends on the features that are calculated
metric_options – see
calc_custom_metrics()
- Returns:
An
xarray.Datasetcontaining the metric(s) in a raster grid