Skip to content

Commit

Permalink
upgraded Python libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
mheberger committed Nov 16, 2023
1 parent 22db3f2 commit 1fe84cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,9 @@
# Units are decimal degrees (sorry, not a proper distance measurement, this feature could be improved!)
# 0.1° is about 11 km near the equator, and about 8 km near at a latitude of 45°
MAX_DIST = 0.075

# Threshold for number of upstream pixels that defines a stream
# These values worked will in my testing, but you might try changing if the
# outlet is not getting snapped to a river centerline properly
THRESHOLD_SINGLE = 500
THRESHOLD_MULTIPLE = 5000
5 changes: 2 additions & 3 deletions py/merit_detailed.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,12 @@ def split_catchment(wid: str, basin: int, lat: float, lng: float, catchment_poly
# In most other circumstances (num unit catchments > 1), a much larger value gives better results.
# The values here work OK, but I did not test very extensively...
# Using a minimum value like 500 prevents the script from finding little tiny watersheds.
# TODO: turn these into parameters in config.py
if bSingleCatchment:
numpixels = 500
numpixels = THRESHOLD_SINGLE
else:
# Case where there are 2 or more unit catchments in the watershed
# setting this value too low causes incorrect results and weird topology problems in the output
numpixels = 5000
numpixels = THRESHOLD_MULTIPLE

if VERBOSE: print("Using threshold of {} for number of upstream pixels.".format(numpixels))

Expand Down

0 comments on commit 1fe84cb

Please sign in to comment.