@@ -11,21 +11,25 @@ network = YAML.load_file(joinpath(DATA_PATH, "hymod_network.yml"))
1111sn = create_network (" HyMod Network" , network)
1212
1313# Load climate data
14- date_format = " YYYY-mm-dd"
15- obs_data = CSV. File (joinpath (DATA_PATH, " leaf_river_data.csv" ),
16- comment= " #" ,
17- dateformat= date_format) |> DataFrame
14+ obs_data = CSV. read (
15+ joinpath (DATA_PATH, " leaf_river_data.csv" ),
16+ DataFrame,
17+ comment= " #" ,
18+ dateformat= " YYYY-mm-dd"
19+ )
1820
1921hist_streamflow = obs_data[:, " leaf_river_outflow" ]
22+ rename! (obs_data, [" leaf_river_outflow" => " leaf_river" ])
23+
2024climate_data = obs_data[:, [" Date" , " leaf_river_P" , " leaf_river_ET" ]]
2125climate = Climate (climate_data, " _P" , " _ET" )
2226
2327# This will set node parameters to the optimal values found
2428metric = (obs, sim) -> 1.0 - Streamfall. NNSE (obs, sim)
25- calibrate! (sn, climate, hist_streamflow; metric= metric, MaxTime= 90 .0 )
29+ calibrate! (sn, climate, obs_data, metric; MaxTime= 180 .0 )
2630
2731# Save calibrated network spec to file
28- Streamfall. save_network_spec (sn, " hymod_example_calibrated.yml" )
32+ Streamfall. save_network (sn, " hymod_example_calibrated.yml" )
2933
3034# Run the model as a single system
3135run_basin! (sn, climate)
@@ -42,4 +46,3 @@ obs = hist_streamflow[:, "leaf_river_outflow"]
4246
4347plot (obs)
4448plot! (node. outflow)
45-
0 commit comments