Skip to content

Commit 18c0680

Browse files
Tentative documentation
1 parent 4d9fd03 commit 18c0680

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Revisiting weighted ensembles
2+
3+
In the previous section, a simple approach to developing ensembles of models is introduced.
4+
5+
Findings in Arsenault et al. (2015) and Wan et al. (2021) suggest that combinations of
6+
models and objective functions are better than a single model and objective, even with a
7+
simple arithmetic averaging approach.
8+
9+
While in the previous section two model types are applied, they both were calibrated with
10+
the same objective function. Here, we revisit the example applying the non-parametric
11+
formulation of the Kling-Gupta Efficiency metric (npKGE) as it is regarded as being better
12+
suited for low-flow conditions to one of the models in the ensemble.
13+
14+
An alternative could involve Box-Cox transformed flows.
15+
16+
```julia
17+
using CSV, Plots
18+
using DataFrames
19+
using Streamfall
20+
21+
climate = Climate("../test/data/campaspe/climate/climate.csv", "_rain", "_evap")
22+
23+
# Historic flows and dam level data
24+
obs_data = CSV.read(
25+
"../test/data/cotter/climate/CAMELS-AUS_410730.csv",
26+
DataFrame;
27+
comment="#"
28+
)
29+
30+
Qo = extract_flow(obs_data, "410730")
31+
climate = extract_climate(obs_data)
32+
33+
# Create one instance each of IHACRES_CMD and GR4J
34+
ihacres_node = create_node(IHACRESBilinearNode, "410730", 129.2)
35+
gr4j_node = create_node(GR4JNode, "410730", 129.2)
36+
symhyd_node = create_node(SYMHYDNode, "410730", 129.2)
37+
hymod_node = create_node(SimpleHyModNode, "410730", 129.2)
38+
39+
# Calibrate with different objective functions
40+
# NmKGE for IHACRES and NnpKGE for GR4J
41+
calibrate!(ihacres_node, climate, Qo, (obs, sim) -> 1.0 .- Streamfall.NmKGE(obs, sim); MaxTime=180)
42+
calibrate!(gr4j_node, climate, Qo, (obs, sim) -> 1.0 .- Streamfall.NnpKGE(obs, sim); MaxTime=180)
43+
calibrate!(symhyd_node, climate, Qo, Streamfall.RMSE; MaxTime=180)
44+
calibrate!(hymod_node, climate, Qo, (obs, sim) -> Streamfall.inverse_metric(obs, sim, (obs, sim) -> 1.0 .- Streamfall.NmKGE(obs, sim); comb_method=mean))
45+
46+
# Create an ensemble
47+
ensemble = create_node(GREnsembleNode, [ihacres_node, gr4j_node, symhyd_node, hymod_node])
48+
49+
# Calibrate the ensemble weights
50+
# calibrate!(ensemble, climate, Qo, (obs, sim) -> 1.0 .- Streamfall.NmKGE(obs, sim); MaxTime=180)
51+
calibrate!(ensemble, climate, Qo, Streamfall.RMSE)
52+
```
53+
54+
55+
```julia
56+
# run_node!(ihacres_node, climate)
57+
# run_node!(gr4j_node, climate)
58+
run_node!(ensemble, climate)
59+
60+
burn_in = 365
61+
burn_dates = timesteps(climate)[burn_in:end]
62+
burn_obs = Qo[burn_in:end, "410730"]
63+
64+
ensemble_qp = quickplot(burn_obs, ensemble.outflow[burn_in:end], climate, "GRC Ensemble", true)
65+
66+
ensemble_xs = temporal_cross_section(burn_dates, burn_obs, ensemble.outflow[burn_in:end]; title="GRC Ensemble (IHACRES-GR4J)")
67+
68+
plot(ensemble_qp, ensemble_xs; layout=(2, 1), size=(800, 600))
69+
```
70+
71+
## Additional remarks
72+
73+
The approach to weighting and averaging model outputs also play a role with both identifying
74+
Granger–Ramanathan average variant C (GRC) to be the most performant with respect to the
75+
Nash-Sutcliffe Efficiency metric.
76+
77+
While GRC is not offered in Streamfall it could hypothetically be implemented by the user.
78+
79+
## References
80+
81+
1. Arsenault, R., Gatien, P., Renaud, B., Brissette, F., Martel, J.-L., 2015. \
82+
A comparative analysis of 9 multi-model averaging approaches in hydrological continuous \
83+
streamflow simulation. Journal of Hydrology 529, 754–767. \
84+
https://doi.org/10.1016/j.jhydrol.2015.09.001
85+
86+
2. Wan, Y., Chen, J., Xu, C.-Y., Xie, P., Qi, W., Li, D., Zhang, S., 2021. Performance \
87+
dependence of multi-model combination methods on hydrological model calibration strategy \
88+
and ensemble size. Journal of Hydrology 603, 127065. \
89+
https://doi.org/10.1016/j.jhydrol.2021.127065

0 commit comments

Comments
 (0)