Created
February 13, 2021 21:06
-
-
Save richpsharp/f6cf9c8cc6ceadca2b57a3fe66ea1680 to your computer and use it in GitHub Desktop.
Floodplain extraction with custom power parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Tracer for floodplain extraction function with custom parameters.""" | |
import logging | |
import os | |
import sys | |
from inspring.floodplain_extraction.floodplain_extraction import floodplain_extraction_custom_power_params | |
logging.basicConfig( | |
level=logging.DEBUG, | |
format=( | |
'%(asctime)s (%(relativeCreated)d) %(processName)s %(levelname)s ' | |
'%(name)s [%(funcName)s:%(lineno)d] %(message)s'), | |
stream=sys.stdout) | |
LOGGER = logging.getLogger(__name__) | |
logging.getLogger('taskgraph').setLevel(logging.INFO) | |
WORKSPACE_DIR = 'workspace' | |
def main(): | |
"""Entry point.""" | |
os.makedirs(WORKSPACE_DIR, exist_ok=True) | |
min_flow_accum_threshold = 1000 | |
dem_path = "sample_data/MERIT DEM Pro Agua Purus Acre clip2.tif" | |
target_stream_vector_path = os.path.join( | |
WORKSPACE_DIR, f'stream_segments_fa{min_flow_accum_threshold}.gpkg') | |
target_watershed_boundary_vector_path = os.path.join( | |
WORKSPACE_DIR, f'subwatersheds_fa{min_flow_accum_threshold}.gpkg') | |
a_wl_param = 6.0767536444489645 | |
b_wl_param = 0.0432410932254994 | |
a_wl_bf_param = 2.133889375163801 | |
b_wl_bf_param = 0.07925612762615052 | |
target_floodplain_raster_path = os.path.join(WORKSPACE_DIR, ( | |
f'floodplain_' | |
f'a_wl_param{a_wl_param}_' | |
f'b_wl_param{b_wl_param}_' | |
f'a_wl_bf_param{a_wl_bf_param}_' | |
f'b_wl_bf_param{b_wl_bf_param}_' | |
f'fa{min_flow_accum_threshold}.tif')) | |
floodplain_extraction_custom_power_params( | |
a_wl_param, | |
b_wl_param, | |
a_wl_bf_param, | |
b_wl_bf_param, | |
min_flow_accum_threshold, | |
dem_path, | |
target_stream_vector_path, | |
target_watershed_boundary_vector_path, | |
target_floodplain_raster_path) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment