Skip to content

Commit bacd123

Browse files
Update readme
1 parent bc25409 commit bacd123

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

README.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,54 +36,55 @@ julia>] test
3636
```
3737

3838

39-
## Quick start (prep)
39+
## Quick start (single node)
4040

4141
```julia
4242
using YAML, DataFrames, CSV, Plots
4343
using Statistics
4444
using Streamfall, BlackBoxOptim
4545

4646

47-
# Load observations
48-
date_format = "YYYY-mm-dd"
49-
50-
# Load file which holds streamflow, precipitation and PET data
51-
obs_data = CSV.File("example_data.csv",
52-
comment="#",
53-
dateformat=date_format) |> DataFrame
47+
using CSV, DataFrames
48+
using Streamfall
5449

55-
# Historic observations
56-
Qo = obs_data[:, ["Date", "Gauge_Q"]]
50+
# Load data file which holds observed streamflow, precipitation and PET data
51+
obs_data = CSV.read("../test/data/cotter/climate/CAMELS-AUS_410730.csv", DataFrame; comment="#")
52+
# 18808×8 DataFrame
53+
# Row │ year month day Date 410730_P 410730_PET 410730_max_T 410730_Q
54+
# │ Int64 Int64 Int64 Date Float64 Float64 Float64 Float64
55+
# ───────┼─────────────────────────────────────────────────────────────────────────────────
56+
# 1 │ 1963 7 5 1963-07-05 0.204475 1.02646 6.80409 127.322
57+
# 2 │ 1963 7 6 1963-07-06 4.24377 0.790078 5.91556 110.224
58+
# 3 │ 1963 7 7 1963-07-07 5.20097 0.400584 3.02218 117.653
5759

58-
# Create climate data interface (all climate data are expected to have a "Date" column)
59-
climate_data = obs_data[:, ["Date", "Gauge_P", "Gauge_PET"]]
60-
climate = Climate(climate_data, "_P", "_PET")
61-
```
60+
# Streamfall expects Date, Precipitation (P), and flow (Q) columns for each gauge at a minimum.
61+
# Some rainfall-runoff models may also require Temmperature (T) data.
6262

63-
## Quick start (single node)
63+
Qo = extract_flow(obs_data, "410730")
64+
climate = extract_climate(obs_data)
6465

65-
```julia
66-
# Create a node (node type, node_name, sub-catchment area)
67-
hymod_node = create_node(SimpleHyModNode, "Gauge", 129.2)
68-
# gr4j_node = create_node(GR4JNode, "Gauge", 129.2)
69-
# ihacres_node = create_node(BilinearNode, "Gauge", 129.2)
66+
# Create a node (node type, node id, catchment/watershed area)
67+
hymod_node = create_node(SimpleHyModNode, "410730", 129.2);
7068

71-
# Calibrate a node for 30 seconds (uses the BlackBoxOptim package)
72-
# Default metric used is RMSE
69+
# Attempt to fit model parameters for 30 seconds
7370
calibrate!(hymod_node, climate, Qo; MaxTime=30)
7471

75-
# Basic overview plot (shows time series and Q-Q plot)
76-
# Uses a 365 day offset (e.g., 1 year burn-in period)
72+
# Run the fitted model
7773
run_node!(hymod_node, climate)
78-
quickplot(Qo[:, "Gauge_Q"], hymod_node, climate, "HyMod"; burn_in=366, limit=nothing)
7974

80-
# save figure
75+
# Display a basic overview plot (shows time series and Q-Q plot)
76+
# using a 365 day offset (e.g., 1 year burn-in period)
77+
quickplot(Qo, hymod_node, climate, "HyMod"; burn_in=366, limit=nothing)
78+
79+
# Save figure
8180
savefig("quick_example.png")
8281
```
8382

8483

8584
## Quick start (network of nodes)
8685

86+
!!! We are aware of bugs in the current implementation. These are being addressed.
87+
8788
```julia
8889
# Load and generate stream network
8990
network_spec = YAML.load_file("network.yml")

0 commit comments

Comments
 (0)