src.eval.raster_grid_evaluatorpp
Classes
|
- class src.eval.raster_grid_evaluatorpp.RasterGridEvaluatorPP(**kwargs)
- Author:
Alberto M. Esmoris Pena
C++-accelerated raster-grid evaluator drop-in replacement for
RasterGridEvaluator.Generates one raster-like 2D grid per requested specification by delegating the heavy reducer sweep to the typed C++ entry points exposed by
pyvl3dpp(one ofevaluate_raster_grid_dd,_df,_fd,_ffdepending on the structure / feature precision selectors) and the chained per-grid post-processors to the C++ kernels behindsrc.eval.raster.raster_postproc. The legacy JSON schema is preserved as much as possible.The
hillshadingpost-processor is computed by the same C++ Horn kernel as the newhillshadekey (the legacy earthpy code path is NOT used by PP).The four non-relational reducers (
mean,median,min,max) accept a grid spec that omitstarget_relational; the six relational-using reducers (binary_mask,binary_mask_nofeats,recount,recount_nofeats,relative_recount,relative_recount_nofeats) still raise a byte-identical PP-prefixed legacy message.
- Variables:
plot_path (str) – The path to write the raster.
conditions (list of dict or None) – The list of global conditional filters applied before any grid digestion.
grids (list of dict) – The many grid specifications.
crs (str) – The coordinate reference system (CRS).
xres (float) – The cell size along the x-axis.
yres (float) – The cell size along the y-axis.
grid_iter_step (int) – How many rows at most must be considered per iteration when generating the raster-like grid.
reverse_rows (bool) – Whether to reverse the rows of the grid (
True) or not (False).radius_expr (str) – An expression defining the radius of the neighborhood centered on each cell. In this expression
lrepresents the greatest cell size, i.e., \(\max \; \{\mathrm{xres}, \mathrm{yres}\}\).nthreads (int) – How many threads must be used by the C++ sweep.
-1means as many threads as available cores.tree_type (str) – Selector consumed by the underlying
NeighborhoodComputer("auto"by default).
- RELATIONAL_MISSING_MSG = 'RasterGridEvaluatorPP failed because no target relational specification was given.'
- static extract_eval_args(spec)
Extract the arguments to initialize/instantiate a
RasterGridEvaluatorPPfrom a key-word specification (mirrors the legacyRasterGridEvaluator.extract_eval_args()plus the new keytree_type).- Parameters:
spec (dict) – The key-word specification containing the arguments.
- Returns:
The arguments to initialize/instantiate a
RasterGridEvaluatorPP.- Return type:
dict
- __init__(**kwargs)
Initialize/instantiate a
RasterGridEvaluatorPP.- Parameters:
kwargs – The attributes for the
RasterGridEvaluatorPP.
- eval(pcloud)
Evaluate the point cloud as a raster-like 2D grid using the C++-accelerated reducer sweep and post-processor chain.
- Parameters:
pcloud (
PointCloud) – The point cloud to be evaluated.- Returns:
The raster grid obtained after computing the evaluation.
- Return type:
- __call__(pcloud, **kwargs)
Evaluate with extra logic that is convenient for pipeline- based execution; mirrors the legacy
RasterGridEvaluator.__call__()(lines 174-196).See
evaluator.Evaluator.eval().- Parameters:
pcloud (
PointCloud) – The point cloud that must be evaluated through raster-like grid analysis.kwargs – Extra arguments such as
out_prefixused by the plotting step.
- Returns:
Nothing.
- eval_args_from_state(state)
Obtain the arguments to call the
RasterGridEvaluatorPPfrom the current pipeline’s state (mirrors the legacy implementation).- Parameters:
state (
SimplePipelineState) – The pipeline’s state.- Returns:
The dictionary of arguments for calling
RasterGridEvaluatorPP.- Return type:
dict
- apply_global_filter(X, F, pcloud)
Filter the given structure and feature spaces at a global level (mirrors legacy lines 846-876 but routes the per- condition filter through the extracted
apply_condition_filter()free function).- Parameters:
X (
np.ndarray) – The structure space matrix of point-wise coordinates.F (
np.ndarrayor None) – The feature space matrix, orNone.pcloud (
PointCloud) – The point cloud being filtered; its features are queried to resolve per-condition value names.
- Returns:
The filtered structure and feature spaces.
- Return type:
tuple of
np.ndarray