From f88badf9683aff9b80e15662429a21586f7f48bf Mon Sep 17 00:00:00 2001 From: Robbi Bishop-Taylor Date: Fri, 22 Mar 2024 17:47:58 +1100 Subject: [PATCH] Make max/min freq and corr configurable via CLI --- intertidal/elevation.py | 3 +++ intertidal/extents.py | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/intertidal/elevation.py b/intertidal/elevation.py index a949682..645dc31 100644 --- a/intertidal/elevation.py +++ b/intertidal/elevation.py @@ -1213,6 +1213,9 @@ def intertidal_cli( freq=ds.qa_ndwi_freq, corr=ds.qa_ndwi_corr, reclassified_aclum=reclassified_aclum, + min_freq=min_freq, + max_freq=max_freq, + min_correlation=min_correlation, ) if exposure_offsets: diff --git a/intertidal/extents.py b/intertidal/extents.py index 4907b85..7bceb47 100644 --- a/intertidal/extents.py +++ b/intertidal/extents.py @@ -55,6 +55,9 @@ def extents( freq, corr, reclassified_aclum, + min_freq=0.01, + max_freq=0.99, + min_correlation=0.15, ): """ Classify coastal ecosystems into broad classes based @@ -128,7 +131,7 @@ def extents( """--------------------------------------------------------------------""" ## Set the upper and lower freq thresholds - upper, lower = 0.99, 0.01 + upper, lower = max_freq, min_freq # Set NaN values (i.e. pixels masked out over deep water) in frequency to 1 freq = freq.fillna(1) @@ -139,10 +142,10 @@ def extents( wet = freq > upper ##### Separate intermittent_tidal (intertidal) - intertidal = intermittent & (corr >= 0.15) + intertidal = intermittent & (corr >= min_correlation) ##### Separate intermittent_nontidal - intermittent_nontidal = intermittent & (corr < 0.15) + intermittent_nontidal = intermittent & (corr < min_correlation) ##### Separate high and low confidence intertidal pixels intertidal_hc = intertidal & dem.notnull()