Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions Tools/__init__.py
Original file line number Diff line number Diff line change
@@ -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'
21 changes: 14 additions & 7 deletions Tools/navigator_demo.py
Original file line number Diff line number Diff line change
@@ -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)
TEST_REACH = 4867727

N = len(REGION.all_upstream(TEST_REACH))

print(N)