hobuinc / silvimetric

Apache License 2.0
8 stars 3 forks source link

FUSION compatibility: using height and cover height thresholds #72

Open bmcgaughey1 opened 6 months ago

bmcgaughey1 commented 6 months ago

Wanted to capture this somewhere so we can think about and discuss how to "fix":

FUSION/GridMetrics offers the ability to filter returns used to compute metrics using a height threshold (this option is used in 99% or use cases) and it requires a separate threshold for "cover" values. Use of the height threshold is complicated. Most metrics drop points below or equal to the threshold. Cover metrics use return (first and all) counts above the cover threshold and the total number of returns (first and all). For cover, there is a height filter in play as well as a return number filter (first returns above threshold/total first returns and first returns above threshold/total returns). The profile area metric and strata metrics use all returns regardless of the height threshold.

The current structure of the functions that compute metrics work on data for a single dimension. This makes it difficult to apply a height threshold to points when dimensions other than Z or HAG are passed (e.g., when computing metrics for intensity). I experimented with passing height and cover threshold values to the metric functions but then the functions apply the thresholds to all dimensions resulting in bogus metrics. We could also add the dimension type to the metric functions so they know whether or not to filter data using the thresholds but then the metric functions become less generic and it is still impossible to filter the returns used to compute intensity metrics based on Z or HAG.

I added additional command line args for initialize (--htthreshold and --coverthreshold) in the metrics branch. Looking at get_metrics() in shatter.py, it might make sense to add the height filtering to modify the cell_data prior to calling the metric functions. The filtering for FUSION/GridMetrics compatibility is only done using Z or, most often, HAG. For the Metric class in metrics.py, we could add flags indicating if the data needs to be filtered using the height and cover thresholds.

I am going to try to make these changes. Everything is local to my computer for now but I will push back to github when things are behaving.

kylemann16 commented 3 months ago

I believe this was addressed in the PR #84.

I think the last bit to do in relation to this would be adding the ability for a Metric to depend on another Metric. The infrastructure should all be in place to make this happen now that Filters are here, but still needs to be done.

Let me know if there is anything else from this that needs to be addressed!