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
| import numpy | |
| import matplotlib.pyplot | |
| slope_in_radians_list = numpy.linspace(0.089, 0.785, 100) | |
| beta_list = [] | |
| m_list = [] | |
| for slope_in_radians in slope_in_radians_list: | |
| beta = ((numpy.sin(slope_in_radians) / 0.0896) / | |
| (3 * numpy.sin(slope_in_radians)**0.8 + 0.56)) | |
| m_list.append(beta/(1+beta)) |
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
| """InVEST Sediment Delivery Ratio (SDR) module. | |
| The SDR method in this model is based on: | |
| Winchell, M. F., et al. "Extension and validation of a geographic | |
| information system-based method for calculating the Revised Universal | |
| Soil Loss Equation length-slope factor for erosion risk assessments in | |
| large watersheds." Journal of Soil and Water Conservation 63.3 (2008): | |
| 105-111. | |
| """ | |
| import os |
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
| clear all | |
| close all | |
| addpath(genpath(pwd)) | |
| % channel init threshold [km2] | |
| Ad_ini=1; | |
| % length threshold [m] |
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
| """SQLAlchemy models for STAC view.""" | |
| from ..db import db | |
| class Job(db.Model): | |
| """Stores info about a non-trivial running job invoked from the API.""" | |
| __tablename__ = "job_table" | |
| job_id = db.Column(db.String, primary_key=True) |
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
| """Run pollination model on a variety of scenarios | |
| All data should be in a "data" subdirectory in the same directory as this | |
| script. | |
| Run it with docker as the following: | |
| docker container run -it --rm --name pollination_kelley -v `pwd`:/usr/local/workspace therealspring/inspring:latest pollination_simulations.py | |
| """ |
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 NDR watershed processing.""" | |
| import argparse | |
| import glob | |
| import logging | |
| import multiprocessing | |
| import os | |
| import shutil | |
| import subprocess | |
| import threading | |
| import urllib |
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 | |
| import pygeoprocessing | |
| import pygeoprocessing.routing | |
| import numpy | |
| logging.basicConfig( |
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, |
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""" | |
| """ | |
| def floodplain_extraction( | |
| t_return_parameter, | |
| min_flow_accum_threshold, | |
| dem_path, | |
| stream_gauge_vector_path, | |
| gauge_table_path, | |
| gauge_id_field, |
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
| import time | |
| import numpy | |
| def mask_op(array_a, array_b, nodata): | |
| result = numpy.full(array_a.shape, nodata, dtype=numpy.float) | |
| valid_mask = numpy.ones(array_a.shape, dtype=numpy.bool) | |
| valid_mask &= (array_a != nodata) & (array_b != nodata) | |
| result[valid_mask] = array_a[valid_mask]+array_b[valid_mask] | |
| return result |