diff --git a/README.md b/README.md new file mode 100644 index 0000000..0230fde --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# Demonstration of a method for compact storage and recall of upstream-downstream relationships in the NHD Plus dataset + +## Dependencies + +``` +python --version +``` + +> Python 3.6.1 :: Anaconda custom (64-bit) + +``` +conda install -c conda-forge gdal +conda install 'icu=56.*' + +``` + +## Demo + +``` +python Tools/navigator_demo.py +``` + +> 2984 diff --git a/Tools/__init__.py b/Tools/__init__.py index dc7c5bc..d6e6915 100644 --- a/Tools/__init__.py +++ b/Tools/__init__.py @@ -1 +1,5 @@ +r"""This package demonstrates a method for compact storage and \ +recall of upstream-downstream relationships in the NHD Plus dataset +""" + __author__ = 'Jhook' diff --git a/Tools/navigator_demo.py b/Tools/navigator_demo.py index 0dd814a..08b4c19 100644 --- a/Tools/navigator_demo.py +++ b/Tools/navigator_demo.py @@ -1,12 +1,19 @@ -from Tools.attribution_and_accumulation import Navigator +"""This script shows how to calculate the number of reaches upstream of a target""" -region_id = '07' -topology_file = r"..\WatershedTopology\upstream_{}.npz".format(region_id) +import os +import sys +sys.path.append('attribution_and_accumulation') -region = Navigator(topology_file) +from attribution_and_accumulation import Navigator -test_reach = 4867727 +REGION_ID = '07' +TOPOLOGY_FILE = "upstream_{}.npz".format(REGION_ID) +TOPOLOGY_FILE = os.path.join("WatershedTopology", TOPOLOGY_FILE) -n = len(region.all_upstream(test_reach)) +REGION = Navigator(TOPOLOGY_FILE) -print(n) \ No newline at end of file +TEST_REACH = 4867727 + +N = len(REGION.all_upstream(TEST_REACH)) + +print(N)