Skip to content

Commit 9c089e6

Browse files
committed
update documentation
1 parent 84faa40 commit 9c089e6

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

docs/source/examples.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ The configuration file ``config.yml`` and data for this example can be found `he
1212
from hydroecolstm.utility.plot import plot
1313
from hydroecolstm.data.read_config import read_config
1414
from hydroecolstm.model.create_model import create_model
15+
from hydroecolstm.interface.utility import write_yml_file
1516
from hydroecolstm.utility.evaluation_function import EvaluationFunction
1617
from hydroecolstm.data.read_data import read_forecast_data
1718
import matplotlib.pyplot as plt
1819
from pathlib import Path
1920
import torch
20-
21+
2122
#-----------------------------------------------------------------------------#
2223
# Set up, train, test model #
2324
#-----------------------------------------------------------------------------#
@@ -81,7 +82,8 @@ The configuration file ``config.yml`` and data for this example can be found `he
8182
torch.save(data, Path(config["output_directory"][0], "data.pt"))
8283
torch.save(model.state_dict(),
8384
Path(config["output_directory"][0], "model_state_dict.pt"))
84-
85+
write_yml_file(config = config,
86+
out_file=Path(config["output_directory"][0], "best_config.yml"))
8587
#-----------------------------------------------------------------------------#
8688
# Incase you close this file and open again, #
8789
# you can load your data, model as follows #
@@ -93,7 +95,7 @@ The configuration file ``config.yml`` and data for this example can be found `he
9395
"model_state_dict.pt")))
9496
9597
data = torch.load(Path(config["output_directory"][0], "data.pt"))
96-
98+
9799
98100
Multiple outputs simulation
99101
---------------------------
@@ -102,12 +104,11 @@ The configuration file ``config.yml`` and data for this example can be found `he
102104

103105
.. code-block:: python
104106
105-
# Import hydroecolstm function
106-
107107
from hydroecolstm.model_run import run_config
108108
from hydroecolstm.utility.plot import plot
109109
from hydroecolstm.data.read_config import read_config
110110
from hydroecolstm.model.create_model import create_model
111+
from hydroecolstm.interface.utility import write_yml_file
111112
from hydroecolstm.utility.evaluation_function import EvaluationFunction
112113
import matplotlib.pyplot as plt
113114
from pathlib import Path
@@ -151,14 +152,16 @@ The configuration file ``config.yml`` and data for this example can be found `he
151152
torch.save(data, Path(config["output_directory"][0], "data.pt"))
152153
torch.save(model.state_dict(),
153154
Path(config["output_directory"][0], "model_state_dict.pt"))
155+
write_yml_file(config = best_config,
156+
out_file=Path(config["output_directory"][0], "best_config.yml"))
154157
155158
#-----------------------------------------------------------------------------#
156159
# Incase you close this file and open again, #
157160
# you can load your data, model as follows #
158161
#-----------------------------------------------------------------------------#
159-
config = read_config("C:/hydroecolstm/examples/2_streamflow_isotope_simulation/config.yml")
162+
config = read_config("C:/hydroecolstm/examples/2_streamflow_isotope_simulation/results/best_config.yml")
160163
model = create_model(config)
161164
model.load_state_dict(torch.load(Path(config["output_directory"][0],
162165
"model_state_dict.pt")))
163166
data = torch.load(Path(config["output_directory"][0], "data.pt"))
164-
167+

examples/1_streamflow_simulation/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from hydroecolstm.utility.plot import plot
44
from hydroecolstm.data.read_config import read_config
55
from hydroecolstm.model.create_model import create_model
6+
from hydroecolstm.interface.utility import write_yml_file
67
from hydroecolstm.utility.evaluation_function import EvaluationFunction
78
from hydroecolstm.data.read_data import read_forecast_data
89
import matplotlib.pyplot as plt
@@ -72,7 +73,8 @@
7273
torch.save(data, Path(config["output_directory"][0], "data.pt"))
7374
torch.save(model.state_dict(),
7475
Path(config["output_directory"][0], "model_state_dict.pt"))
75-
76+
write_yml_file(config = config,
77+
out_file=Path(config["output_directory"][0], "best_config.yml"))
7678
#-----------------------------------------------------------------------------#
7779
# Incase you close this file and open again, #
7880
# you can load your data, model as follows #

examples/2_streamflow_isotope_simulation/main.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,4 @@
5858
model = create_model(config)
5959
model.load_state_dict(torch.load(Path(config["output_directory"][0],
6060
"model_state_dict.pt")))
61-
data = torch.load(Path(config["output_directory"][0], "data.pt"))
62-
63-
64-
65-
66-
67-
68-
69-
70-
71-
61+
data = torch.load(Path(config["output_directory"][0], "data.pt"))

0 commit comments

Comments
 (0)