Skip to content

Commit

Permalink
Make max/min freq and corr configurable via CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
robbibt authored Mar 22, 2024
1 parent 7a7dd6a commit f88badf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions intertidal/elevation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 6 additions & 3 deletions intertidal/extents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit f88badf

Please sign in to comment.