|
4 | 4 | "cell_type": "markdown",
|
5 | 5 | "metadata": {},
|
6 | 6 | "source": [
|
7 |
| - "## Plot Wflow results" |
| 7 | + "## Plot Wflow outputs" |
8 | 8 | ]
|
9 | 9 | },
|
10 | 10 | {
|
11 | 11 | "cell_type": "markdown",
|
12 | 12 | "metadata": {},
|
13 | 13 | "source": [
|
14 |
| - "**HydroMT** provides a simple interface to model results from which we can make beautiful plots:\n", |
| 14 | + "**HydroMT** provides a simple interface to model outputs from which we can make beautiful plots:\n", |
15 | 15 | "\n",
|
16 |
| - "- Results layers are saved to the model `results` component as a dictionnary of `xarray.Dataset` or `xarray.DataArray`.\n", |
| 16 | + "- Wflow gridded outputs are saved to the model `output_grid` component as a `xarray.Dataset`.\n", |
| 17 | + "- Wflow netcdf scalar outputs are saved to the model `output_scalar` component as a `xarray.Dataset`.\n", |
| 18 | + "- Wflow csv outputs are saved to the model `output_csv` component as a dict of `xarray.DataArray`.\n", |
17 | 19 | "\n",
|
18 |
| - "These plots can be useful to analyze the model results or also compare model runs with different settings (different precipitation source or different parameters values)." |
| 20 | + "These plots can be useful to analyze the model outputs or also compare model runs with different settings (different precipitation source or different parameters values)." |
19 | 21 | ]
|
20 | 22 | },
|
21 | 23 | {
|
|
40 | 42 | "cell_type": "markdown",
|
41 | 43 | "metadata": {},
|
42 | 44 | "source": [
|
43 |
| - "### Read the model run(s) results" |
| 45 | + "### Read the model run(s) outputs" |
44 | 46 | ]
|
45 | 47 | },
|
46 | 48 | {
|
47 | 49 | "cell_type": "markdown",
|
48 | 50 | "metadata": {},
|
49 | 51 | "source": [
|
50 |
| - "The **wflow_piave_subbasin** model was run using the default global data sources of the hydromt_wflow plugin. The different variables to save after the wflow were set in a separate wflow configuration file: *wflow_sbm_results.toml*.\n", |
| 52 | + "The **wflow_piave_subbasin** model was run using the default global data sources of the hydromt_wflow plugin. The different variables to save were set in a separate wflow configuration file: *wflow_sbm_results.toml*.\n", |
51 | 53 | "\n",
|
52 | 54 | "A second run of the model was also done, where the KsatHorFrac parameter of wflow was set to 10 (instead of the default 100 value) using an alternative configuration file: *wflow_sbm_results2.toml*.\n",
|
53 | 55 | "\n",
|
|
95 | 97 | "cell_type": "markdown",
|
96 | 98 | "metadata": {},
|
97 | 99 | "source": [
|
98 |
| - "Wflow can save different types of outputs (netcdf gridded output, netcdf scalar netcdf, csv scalar timeseries) that are also reflected in the organisation of the HydroMT `results` component:\n", |
| 100 | + "Wflow can save different types of outputs (netcdf gridded output, netcdf scalar netcdf, csv scalar timeseries) that are also reflected in the organisation of the HydroMT-Wflow different `output` components:\n", |
99 | 101 | "\n",
|
100 |
| - "* a **\"output\" xarray.Dataset** for the gridded netcdf file (output section of the TOML)\n", |
101 |
| - "* a **\"netcdf\" xarray.Dataset** for the netcdf point timeseries file (netcdf section of the TOML)\n", |
102 |
| - "* different **hydromt.GeoDataArrays for the csv file** , one per column (csv section and csv.column sections of the TOML). The xy coordinates are the coordinates of the station or of the representative point of the subcatch/area. The variable name in the GeoDataArray corresponds to the csv header attribute or header_map when available.\n", |
| 102 | + "* a **\"output_grid\" hydromt.RasterDataset** for the gridded netcdf file (output.netcdf_grid section of the TOML)\n", |
| 103 | + "* a **\"output_scalar\" xarray.Dataset** for the netcdf point timeseries file (output.netcdf_scalar section of the TOML)\n", |
| 104 | + "* different **hydromt.GeoDataArrays for the csv file** , one per column (output.csv section and csv.column sections of the TOML). The xy coordinates are the coordinates of the station or of the representative point of the subcatch/area. The variable name in the GeoDataArray corresponds to the csv header attribute or header_map when available.\n", |
103 | 105 | "\n",
|
104 |
| - "Below you can see how to access to the results of *run1* and its contents:" |
| 106 | + "Below you can see how to access to the different outputs of *run1* and its contents:" |
105 | 107 | ]
|
106 | 108 | },
|
107 | 109 | {
|
|
111 | 113 | "outputs": [],
|
112 | 114 | "source": [
|
113 | 115 | "model1 = runs[\"run1\"][\"model\"]\n",
|
114 |
| - "model1.results" |
| 116 | + "model1.output_grid.data" |
| 117 | + ] |
| 118 | + }, |
| 119 | + { |
| 120 | + "cell_type": "code", |
| 121 | + "execution_count": null, |
| 122 | + "metadata": {}, |
| 123 | + "outputs": [], |
| 124 | + "source": [ |
| 125 | + "model1.output_scalar.data" |
| 126 | + ] |
| 127 | + }, |
| 128 | + { |
| 129 | + "cell_type": "code", |
| 130 | + "execution_count": null, |
| 131 | + "metadata": {}, |
| 132 | + "outputs": [], |
| 133 | + "source": [ |
| 134 | + "model1.output_csv.data" |
115 | 135 | ]
|
116 | 136 | },
|
117 | 137 | {
|
|
188 | 208 | "# Plots\n",
|
189 | 209 | "from hydromt.stats import skills\n",
|
190 | 210 | "\n",
|
191 |
| - "station_ids = list(runs[mainrun][\"model\"].results[result_name].index.values)\n", |
| 211 | + "station_ids = list(runs[mainrun][\"model\"].output_csv.data[result_name].index.values)\n", |
192 | 212 | "\n",
|
193 | 213 | "for i, st in enumerate(station_ids):\n",
|
194 | 214 | " n = 2\n",
|
|
201 | 221 | "\n",
|
202 | 222 | " for r in runs_subset:\n",
|
203 | 223 | " run = runs[r]\n",
|
204 |
| - " run_i = run[\"model\"].results[result_name].sel(index=st)\n", |
| 224 | + " run_i = run[\"model\"].output_csv.data[result_name].sel(index=st)\n", |
205 | 225 | " # Stats\n",
|
206 | 226 | " nse_i = skills.nashsutcliffe(run_i, obs_i).values.round(2)\n",
|
207 | 227 | " kge_i = skills.kge(run_i, obs_i)[\"kge\"].values.round(2)\n",
|
|
224 | 244 | "\n",
|
225 | 245 | " for r in runs_subset:\n",
|
226 | 246 | " run = runs[r]\n",
|
227 |
| - " run_i = run[\"model\"].results[result_name].sel(index=st)\n", |
| 247 | + " run_i = run[\"model\"].output_csv.data[result_name].sel(index=st)\n", |
228 | 248 | " run_i.cumsum().plot.line(\n",
|
229 | 249 | " ax=axes[1],\n",
|
230 | 250 | " x=\"time\",\n",
|
|
242 | 262 | "cell_type": "markdown",
|
243 | 263 | "metadata": {},
|
244 | 264 | "source": [
|
245 |
| - "You can see on the discharge plots legends that some statistical criteria were computed using the fictional observations and the model runs results.\n", |
| 265 | + "You can see on the discharge plots legends that some statistical criteria were computed using the fictional observations and the model runs outputs.\n", |
246 | 266 | "\n",
|
247 |
| - "These statistics were computed using the **stats** module of HydroMT. You can find the available statisctics functions in the [documentation](https://deltares.github.io/hydromt/latest/user_guide/methods_stats.html).\n", |
| 267 | + "These statistics were computed using the **stats** module of HydroMT. You can find the available statisctics functions in the [documentation](https://deltares.github.io/hydromt/stable/guides/advanced_user/methods_stats.html).\n", |
248 | 268 | "\n",
|
249 |
| - "And finally once the `results` are loaded, you can use them to derive more statistics or plots to further analyze your model." |
| 269 | + "And finally once the `outputs` are loaded, you can use them to derive more statistics or plots to further analyze your model." |
250 | 270 | ]
|
251 | 271 | }
|
252 | 272 | ],
|
|
0 commit comments