Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonlinear routing #23

Merged
merged 8 commits into from
Jun 1, 2024
Merged
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Install river-route from source using conda/mamba such as with the following com
```bash
git clone https://github.com/rileyhales/river-route
cd river-route
mamba env create -f environment.yml
mamba env create -f environment.yaml
mamba activate rr
python setup.py install
```
Expand All @@ -25,7 +25,7 @@ import river_route as rr

(
rr
.Muskingum('/path/to/config.yml')
.MuskingumCunge('/path/to/config.yaml')
.route()
)
```
Expand All @@ -37,7 +37,7 @@ import river_route as rr

(
rr
.Muskingum(**{
.MuskingumCunge(**{
'routing_params_file': '/path/to/routing_params.parquet',
'connectivity_file': '/path/to/connectivity.parquet',
'runoff_file': '/path/to/runoff.nc',
Expand Down Expand Up @@ -125,7 +125,7 @@ graph LR
a[Calculate LHS & LHS<sup>-1</sup>] --> b
b[Divide Runoff Data by \n Number of Steps] --> c
c[Iterate On Runoff Intervals] --> d
d[Solving Matrix \n Muskingum] --> e
d[Solving Matrix \n MuskingumCunge] --> e
e[Enforce Min and Max Q] --> f & c
f[Write Outflows to Disk] --> g
g[Cache Final State]
Expand Down Expand Up @@ -175,8 +175,8 @@ index.
| Column | Data Type | Description |
|--------|-----------|---------------------------------------------------------------------------|
| rivid | integer | Unique ID of a river segment |
| k | float | the k parameter of the Muskingum Cunge routing equation length / velocity |
| x | float | the x parameter of the Muskingum Cunge routing equation. x : [0, 0.5] |
| k | float | the k parameter of the MuskingumCunge Cunge routing equation length / velocity |
| x | float | the x parameter of the MuskingumCunge Cunge routing equation. x : [0, 0.5] |

### Connectivity File

Expand Down
10 changes: 4 additions & 6 deletions config_files/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
"connectivity_file": "",
"runoff_file": "",
"outflow_file": "",
"routing": "",
"lhs_file": "",
"lhsinv_file": "",
"adj_file": "",
"dt_routing": "",
"dt_outflows": "",
"min_q": "",
"max_q": "",
"qinit_file": "",
"rinit_file": "",
"qfinal_file": "",
"rfinal_file": "",
"positive_flow": true,
"initial_state_file": "",
"final_state_file": "",
"log": false,
"log_stream": "",
"log_level": "",
Expand Down
21 changes: 21 additions & 0 deletions config_files/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Required Watershed Files
routing_params_file: ''
connectivity_file: ''
adj_file: '' # Optional - if it does not exist, it will be cached at this location
# Routing Input and Output
runoff_file: ''
outflow_file: ''
# Compute Options - Optional
routing: 'linear'
positive_flow: True
dt_routing: 0
dt_outflows: 0
# initial and final state files - Optional
initial_state_file: ''
final_state_file: ''
# simulation management and debugging - Optional
log: False
progress_bar: False
log_level: 'DEBUG'
log_stream: ''
job_name: ''
25 changes: 0 additions & 25 deletions config_files/config.yml

This file was deleted.

12 changes: 5 additions & 7 deletions config_files/descriptions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ lhsinv_file,string,Path where the LHS inverse matrix should be cached.
adj_file,string,Path where the adjacency matrix should be cached.
dt_routing,number,Time interval in seconds between routing computations.
dt_outflows,number,Time interval in seconds between writing flows to disc.
min_q,number,Minimum flow value allowed after each routing computation.
max_q,number,Maximum flow value allowed after each routing computation.
qinit_file,string,Path to the initial flows file.
rinit_file,string,Path to the initial runoff file.
qfinal_file,string,Path where the final flows file should be saved.
rfinal_file,string,Path where the final runoff file should be saved.
log,boolean,whether or not to display log messages defaulting to False
routing,string,Either 'linear' or 'nonlinear' routing- default 'linear'.
positive_flows,boolean,Force minimum flow value to be >= 0.
initial_state_file,string,Path to the file with initial state values.
final_state_file,string,Path to the file with final state values.
log,boolean,whether to display log messages defaulting to False
log_stream,string,the destination for logged messages: stdout stderr or a file path. default to stdout
log_level,string,Level of logging: either 'debug' 'info' 'warning' 'error' or 'critical'.
job_name,string,A name for this job to be printed in debug statements.
Expand Down
1 change: 1 addition & 0 deletions environment.yml → environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies:
- dask
- fastparquet
- matplotlib
- natsort
- netcdf4
- networkx
- numpy
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dask
fastparquet
matplotlib
natsort
netcdf4
networkx
numpy
Expand Down
Loading