smashbox 1.0__py2.py3-none-any.whl → 1.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smashbox/.spyproject/config/backups/workspace.ini.bak +1 -1
- smashbox/.spyproject/config/workspace.ini +1 -1
- smashbox/mesh.hdf5 +0 -0
- smashbox/model/model.py +11 -5
- smashbox/test.py +53 -57
- smashbox/tools/tools.py +1 -1
- {smashbox-1.0.dist-info → smashbox-1.1.dist-info}/METADATA +4 -4
- {smashbox-1.0.dist-info → smashbox-1.1.dist-info}/RECORD +10 -9
- {smashbox-1.0.dist-info → smashbox-1.1.dist-info}/WHEEL +1 -1
- {smashbox-1.0.dist-info → smashbox-1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -4,7 +4,7 @@ save_data_on_exit = True
|
|
|
4
4
|
save_history = True
|
|
5
5
|
save_non_project_files = False
|
|
6
6
|
project_type = 'empty-project-type'
|
|
7
|
-
recent_files = ['tutorial_report.py', 'init/smashbox.py', 'model/model.py', 'stats/mystats.py', 'init/multimodel_statistics.py', 'stats/stats.py', 'init/param.py', 'test.py', 'test_average_stats.py', 'test_mesh.r', 'test_mesh_from_graffas.py', 'init/__init__.py', 'plot/plot.py']
|
|
7
|
+
recent_files = ['tutorial_report.py', 'init/smashbox.py', 'model/model.py', 'stats/mystats.py', 'init/multimodel_statistics.py', 'stats/stats.py', 'init/param.py', 'test.py', 'test_average_stats.py', 'test_mesh.r', 'test_mesh_from_graffas.py', 'init/__init__.py', 'plot/plot.py', 'tutorial_python.py']
|
|
8
8
|
|
|
9
9
|
[main]
|
|
10
10
|
version = 0.2.0
|
|
@@ -4,7 +4,7 @@ save_data_on_exit = True
|
|
|
4
4
|
save_history = True
|
|
5
5
|
save_non_project_files = False
|
|
6
6
|
project_type = 'empty-project-type'
|
|
7
|
-
recent_files = ['tutorial_report.py', 'init/smashbox.py', 'model/model.py', 'stats/mystats.py', 'init/multimodel_statistics.py', 'stats/stats.py', 'init/param.py', 'test.py', 'test_average_stats.py', 'test_mesh.r', 'test_mesh_from_graffas.py', 'init/__init__.py', 'plot/plot.py']
|
|
7
|
+
recent_files = ['tutorial_report.py', 'init/smashbox.py', 'model/model.py', 'stats/mystats.py', 'init/multimodel_statistics.py', 'stats/stats.py', 'init/param.py', 'test.py', 'test_average_stats.py', 'test_mesh.r', 'test_mesh_from_graffas.py', 'init/__init__.py', 'plot/plot.py', 'tutorial_python.py', 'tools/tools.py', 'model/mesh.py']
|
|
8
8
|
|
|
9
9
|
[main]
|
|
10
10
|
version = 0.2.0
|
smashbox/mesh.hdf5
ADDED
|
Binary file
|
smashbox/model/model.py
CHANGED
|
@@ -393,7 +393,13 @@ class model:
|
|
|
393
393
|
o_setup["read_prcp"] = True
|
|
394
394
|
o_setup["read_pet"] = True
|
|
395
395
|
|
|
396
|
-
self
|
|
396
|
+
# ~ if hasattr(self, "optimize_model") and self.optimize_model is not None:
|
|
397
|
+
# ~ previous_optimized_model_rr_parameters = self.optimize_model.rr_parameters.copy()
|
|
398
|
+
|
|
399
|
+
if not hasattr(self, "optimize_model") or self.optimize_model is None:
|
|
400
|
+
self.optimize_model = self._model(setup=o_setup, mesh=self.mymesh.mesh)
|
|
401
|
+
print(f"</> Getting parameters the default model `mysmashmodel` ...")
|
|
402
|
+
self.optimize_model.rr_parameters = self.mysmashmodel.rr_parameters.copy()
|
|
397
403
|
|
|
398
404
|
default_cost_option = {"end_warmup": o_setup["start_time"], "gauge": "all"}
|
|
399
405
|
if cost_options is not None:
|
|
@@ -662,7 +668,7 @@ class model:
|
|
|
662
668
|
def import_parameters(self, model=None):
|
|
663
669
|
"""
|
|
664
670
|
Import Geotiff parameter in Smash. This function wrap
|
|
665
|
-
smash.io.
|
|
671
|
+
smash.io.read_grid_parameters(). Path to the parameters is defined in
|
|
666
672
|
self._myparam.param.smash_parameters.
|
|
667
673
|
|
|
668
674
|
Parameter
|
|
@@ -691,15 +697,15 @@ class model:
|
|
|
691
697
|
if model is None:
|
|
692
698
|
model = self.mysmashmodel
|
|
693
699
|
|
|
694
|
-
smash.io.
|
|
700
|
+
smash.io.read_grid_parameters(
|
|
695
701
|
model=model,
|
|
696
|
-
|
|
702
|
+
path=self._myparam.param.smash_parameters,
|
|
697
703
|
)
|
|
698
704
|
|
|
699
705
|
def export_parameters(self, path: os.PathLike = "./output_smash_param"):
|
|
700
706
|
"""
|
|
701
707
|
Export Geotiff Smash parameter as Geotiff. This function wrap
|
|
702
|
-
smash.io.
|
|
708
|
+
smash.io.save_grid_parameters().
|
|
703
709
|
|
|
704
710
|
Parameters
|
|
705
711
|
----------
|
smashbox/test.py
CHANGED
|
@@ -4,20 +4,20 @@ if __name__ == "__main__":
|
|
|
4
4
|
|
|
5
5
|
from smashbox import tools
|
|
6
6
|
|
|
7
|
-
@tools.tools.autocast_args
|
|
8
|
-
def test(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
):
|
|
7
|
+
# @tools.tools.autocast_args
|
|
8
|
+
# def test(
|
|
9
|
+
# a: int | None = None,
|
|
10
|
+
# b: None | int = None,
|
|
11
|
+
# c: int | None = 1,
|
|
12
|
+
# d: int = 2,
|
|
13
|
+
# e: None = None,
|
|
14
|
+
# f: None | dict | tuple = None,
|
|
15
|
+
# g=1,
|
|
16
|
+
# ):
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
# print(a, b, c, d, e)
|
|
19
19
|
|
|
20
|
-
test(a=1.0, b=1.0, c=1.0, d=1.0, e=None, f=(2,), g=2)
|
|
20
|
+
# test(a=1.0, b=1.0, c=1.0, d=1.0, e=None, f=(2,), g=2)
|
|
21
21
|
|
|
22
22
|
# Main object creation
|
|
23
23
|
sb = smashbox.SmashBox()
|
|
@@ -29,20 +29,12 @@ if __name__ == "__main__":
|
|
|
29
29
|
"outlets_database",
|
|
30
30
|
"/home/maxime/DEV/smashbox/smashbox/asset/outlets/db_stations_example.csv",
|
|
31
31
|
)
|
|
32
|
-
|
|
33
|
-
sb.myparam.set_param(
|
|
34
|
-
"outlets_database_fields",
|
|
35
|
-
{"coord_x": "X_L93", "coord_y": "Y_L93", "area": "SURF", "id": "ID_HYDRO"},
|
|
36
|
-
) # change/update/set the value of the parameter 'outlets_database_fields'.
|
|
32
|
+
sb.myparam.set_param("outletsID", ["Y4604020"])
|
|
37
33
|
|
|
38
34
|
sb.myparam.set_param(
|
|
39
35
|
"smash_parameters", "/home/maxime/DEV/smashbox/smashbox/asset/params"
|
|
40
36
|
) # change the value of myparam used byRealCollobrier
|
|
41
37
|
|
|
42
|
-
# Read/write param
|
|
43
|
-
# sb.myparam.write_param("param.yaml") #write smashbox param
|
|
44
|
-
sb.myparam.load_param("param.yaml") # load smashbox param
|
|
45
|
-
|
|
46
38
|
# New model creation
|
|
47
39
|
sb.newmodel(
|
|
48
40
|
"RealCollobrier"
|
|
@@ -50,58 +42,62 @@ if __name__ == "__main__":
|
|
|
50
42
|
|
|
51
43
|
# create an second model with different parameters
|
|
52
44
|
sb.myparam.param.setup_file = "setup_rhax_gr5_dt3600.yaml"
|
|
53
|
-
sb.myparam.set_param(
|
|
54
|
-
"outlets_database_fields",
|
|
55
|
-
{"coord_x": "X", "coord_y": "Y", "area": "area", "id": "Nom"},
|
|
56
|
-
) # change/update/set the value of the parameter 'outlets_database_fields'.
|
|
57
|
-
sb.newmodel(
|
|
58
|
-
"Lez"
|
|
59
|
-
) # create a new model named RealCollobrier and copy the previous parameters used for mymodel1 (default behaviour, but it can turned off)
|
|
60
|
-
|
|
61
|
-
# Remove a model
|
|
62
|
-
sb.delmodel("Lez")
|
|
63
45
|
|
|
64
46
|
# Param associated to the model (hidden) has been copied
|
|
65
47
|
sb.RealCollobrier._myparam.list_param() # Notice that myparam is also stored in each model object. So you can access to the model param inside the model attribute.
|
|
66
|
-
sb.RealCollobrier._myparam.param.epsg
|
|
67
48
|
|
|
68
49
|
# Setup utilities
|
|
69
50
|
sb.RealCollobrier.mysetup.setup # print the setup to the screen
|
|
70
|
-
# sb.RealCollobrier.mysetup.write_setup("setup.yaml") #Write the Smash setup
|
|
71
|
-
sb.RealCollobrier.mysetup.load_setup("setup.yaml") # Read a custom Smash setup
|
|
72
51
|
sb.RealCollobrier.mysetup.update_setup(
|
|
73
52
|
{
|
|
74
53
|
"hydrological_module": "gr4",
|
|
75
|
-
"end_time": "2014-
|
|
54
|
+
"end_time": "2014-02-01 12:00",
|
|
76
55
|
"start_time": "2014-01-01 01:00",
|
|
77
56
|
"pet_directory": "/home/maxime/DATA/ETP-SFR-FRA-INTERA_L93",
|
|
78
57
|
"prcp_directory": "/home/maxime/DATA/PLUIE",
|
|
79
|
-
"qobs_directory": "/home/maxime/DATA/
|
|
58
|
+
"qobs_directory": "/home/maxime/DATA/QOBS_60min",
|
|
80
59
|
}
|
|
81
60
|
) # Change value of the Smash setup
|
|
82
61
|
sb.RealCollobrier.mysetup.setup # print the setup to the screen
|
|
83
62
|
|
|
84
|
-
#
|
|
85
|
-
|
|
86
|
-
sb.RealCollobrier.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
sb.RealCollobrier.
|
|
90
|
-
sb.RealCollobrier.
|
|
91
|
-
sb.RealCollobrier.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
63
|
+
sb.RealCollobrier.generate_mesh() # direct method to build the mesh (recommended)
|
|
64
|
+
|
|
65
|
+
sb.RealCollobrier.model()
|
|
66
|
+
|
|
67
|
+
sb.RealCollobrier.mysmashmodel.set_rr_parameters("cp", 500.0)
|
|
68
|
+
sb.RealCollobrier.mysmashmodel.set_rr_parameters("ct", 200.0)
|
|
69
|
+
sb.RealCollobrier.mysmashmodel.set_rr_parameters("llr", 50.0)
|
|
70
|
+
sb.RealCollobrier.mysmashmodel.set_rr_parameters("kexc", 0.0)
|
|
71
|
+
|
|
72
|
+
sb.RealCollobrier.optimize(
|
|
73
|
+
cost_options={"end_warmup": "2014-01-10 01:00", "gauge": "all"},
|
|
74
|
+
mapping="uniform",
|
|
75
|
+
optimizer="sbs",
|
|
76
|
+
optimize_options={
|
|
77
|
+
"bounds": {
|
|
78
|
+
"cp": [1, 1000],
|
|
79
|
+
"ct": [1, 1000],
|
|
80
|
+
"kexc": [-50, 50],
|
|
81
|
+
"llr": [1, 1000],
|
|
82
|
+
},
|
|
83
|
+
"termination_crit": {"maxiter": 10},
|
|
84
|
+
},
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
sb.RealCollobrier.optimize(
|
|
88
|
+
cost_options={"end_warmup": "2014-01-10 01:00", "gauge": "all"},
|
|
89
|
+
mapping="distributed",
|
|
90
|
+
optimizer="lbfgsb",
|
|
91
|
+
optimize_options={
|
|
92
|
+
"bounds": {
|
|
93
|
+
"cp": [1, 1000],
|
|
94
|
+
"ct": [1, 1000],
|
|
95
|
+
"kexc": [-50, 50],
|
|
96
|
+
"llr": [1, 1000],
|
|
97
|
+
},
|
|
98
|
+
"termination_crit": {"maxiter": 10},
|
|
99
|
+
},
|
|
100
|
+
)
|
|
105
101
|
|
|
106
102
|
# Stat utilities
|
|
107
103
|
|
smashbox/tools/tools.py
CHANGED
|
@@ -230,7 +230,7 @@ def check_asset_path(asset_dir: str = "", path: None | os.PathLike = None):
|
|
|
230
230
|
if len(matched_file) == 0:
|
|
231
231
|
raise ValueError(
|
|
232
232
|
f"'{path}' is not a valid {asset_dir} filename."
|
|
233
|
-
"Choice are: {os.listdir(mypath)}"
|
|
233
|
+
f"Choice are: {os.listdir(mypath)}"
|
|
234
234
|
)
|
|
235
235
|
else:
|
|
236
236
|
path = matched_file[0]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: smashbox
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: A python library developed by Hydris-hydrologie (https://www.hydris-hydrologie.fr/) to provide an technical environment for performing hydrological simulation with Smash. This library is preloaded with data (France only), comes with preconfigured setup, own some extra features such as the in-memory atmospheric data connector, has statistical and plot capabilities. Plot and stats functions can be used as a separate module with your own Smash model object.
|
|
5
|
-
Project-URL: Homepage, https://codeberg.org/maximejay/
|
|
6
|
-
Project-URL: Issues, https://codeberg.org/maximejay/
|
|
3
|
+
Version: 1.1
|
|
4
|
+
Summary: A python library developed by Hydris-hydrologie (https://www.hydris-hydrologie.fr/) and INRAE to provide an technical environment for performing hydrological simulation with Smash. This library is preloaded with data (France only), comes with preconfigured setup, own some extra features such as the in-memory atmospheric data connector, has statistical and plot capabilities. Plot and stats functions can be used as a separate module with your own Smash model object.
|
|
5
|
+
Project-URL: Homepage, https://codeberg.org/maximejay/smashbox
|
|
6
|
+
Project-URL: Issues, https://codeberg.org/maximejay/smashbox/issues
|
|
7
7
|
Author-email: Maxime Jay-Allemand <maxime.jay.allemand@hydris-hydrologie.fr>
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Keywords: hydro-smash,plot,smash,statistics
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
smashbox/__init__.py,sha256=JsR9IyTpFFzIWZ4DuH_Lp4xUVNTMSq55WrtS8TbOlXg,105
|
|
2
|
-
smashbox/
|
|
2
|
+
smashbox/mesh.hdf5,sha256=xQUVz1Kus1H2QUdYyt8opZUIUQnyaSlKKWaVyAaPYsc,49400
|
|
3
|
+
smashbox/test.py,sha256=H0GR1AnGrROnzNx0AZDP1PcM-NvKQh0m4Yti8ZqEMnw,15997
|
|
3
4
|
smashbox/test_average_stats.py,sha256=eN-qqv3IrPtQqLlzEY9DFz256bmO6gJmNBxag0JawhI,3944
|
|
4
5
|
smashbox/test_mesh.r,sha256=t-wUggd0s9SNwA9kLuSL99jVZLOwQT8NA_jT4fLwbSU,270
|
|
5
6
|
smashbox/test_mesh_from_graffas.py,sha256=XEcEU0Oq-qRFdwtdL8d0bfGs0mZMyEXqTyvDJTMtBfo,2011
|
|
@@ -12,11 +13,11 @@ smashbox/tutorial_report.py,sha256=3NDkU5Job07Sk60HkgnUyTg3g5XataqiwMylnCKIZ18,1
|
|
|
12
13
|
smashbox/.spyproject/config/codestyle.ini,sha256=8fTq7BM4axczcMEjMD_fGu8ibnYNOgyqxKy1u9HrCec,96
|
|
13
14
|
smashbox/.spyproject/config/encoding.ini,sha256=TwkxwYo4r4hIswOH9ntONulU1CvhbXWHNIrUodNGtvg,58
|
|
14
15
|
smashbox/.spyproject/config/vcs.ini,sha256=q0i41LLfEdBPFIgdXJC-VfqxvUir7HNqmLZC5xSJpYQ,85
|
|
15
|
-
smashbox/.spyproject/config/workspace.ini,sha256=
|
|
16
|
+
smashbox/.spyproject/config/workspace.ini,sha256=KvRF_shyCKbMbageLrTBUZqNwfNP2xu562fk30C4AOY,535
|
|
16
17
|
smashbox/.spyproject/config/backups/codestyle.ini.bak,sha256=8fTq7BM4axczcMEjMD_fGu8ibnYNOgyqxKy1u9HrCec,96
|
|
17
18
|
smashbox/.spyproject/config/backups/encoding.ini.bak,sha256=TwkxwYo4r4hIswOH9ntONulU1CvhbXWHNIrUodNGtvg,58
|
|
18
19
|
smashbox/.spyproject/config/backups/vcs.ini.bak,sha256=q0i41LLfEdBPFIgdXJC-VfqxvUir7HNqmLZC5xSJpYQ,85
|
|
19
|
-
smashbox/.spyproject/config/backups/workspace.ini.bak,sha256=
|
|
20
|
+
smashbox/.spyproject/config/backups/workspace.ini.bak,sha256=hRRxwX_R0DZdKHQyYmHzj8VJl0bYAjvyOccdssf45yc,500
|
|
20
21
|
smashbox/.spyproject/config/defaults/defaults-codestyle-0.2.0.ini,sha256=sBDq-XuV-kJkPVgrTY2z4RjZhhaAkaF19DbwlXUsYkk,72
|
|
21
22
|
smashbox/.spyproject/config/defaults/defaults-encoding-0.2.0.ini,sha256=6wfeMiG1iu4I31RHY5gZHZLJV41tJRB_5ikKYb2MLSo,34
|
|
22
23
|
smashbox/.spyproject/config/defaults/defaults-vcs-0.2.0.ini,sha256=pQ547hBbdtIQil95oXaL2-tfwRB_Ir98o02XQNwU8Go,61
|
|
@@ -48,7 +49,7 @@ smashbox/init/smashbox.py,sha256=jBhgbud4zr_4HHld9brN3JojNO8tevWRVVmK2uSjqsY,586
|
|
|
48
49
|
smashbox/model/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
49
50
|
smashbox/model/atmos_data_connector.py,sha256=srl1MZnBozi5iu-0G6bWxvLIfAyXfj9mv8-1h7f7aq4,20607
|
|
50
51
|
smashbox/model/mesh.py,sha256=3heNjTBTCRXVTARIZaKHsLFcvdVu3azxHmZ2z1pIpg0,7075
|
|
51
|
-
smashbox/model/model.py,sha256=
|
|
52
|
+
smashbox/model/model.py,sha256=uqzzlLO-rXKyopA_2DSdproxoGaqv9UOqnhnQgX881Y,33915
|
|
52
53
|
smashbox/model/setup.py,sha256=cyLemXFA89MXj4c4d70_jq8zZay7WQL1XA3lyEI61X0,3276
|
|
53
54
|
smashbox/plot/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
54
55
|
smashbox/plot/myplot.py,sha256=DYONa1Nb_X9g2zb5xtz0TXXNdZQX6SFXYJzeOATD2GY,42522
|
|
@@ -61,13 +62,13 @@ smashbox/stats/mystats.py,sha256=BwAH_Ni-fZCH80OFXbq7DDXwtVMF5yFP-plJfPrdqHg,653
|
|
|
61
62
|
smashbox/stats/stats.py,sha256=4olCJFYccepHtbokFlFCDIKmdkbDxvQYyUGz6mGy-Ks,64693
|
|
62
63
|
smashbox/tools/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
63
64
|
smashbox/tools/geo_toolbox.py,sha256=fWkYD-59uTOtEwMO0gO99biW8zhxypDzCWSK1s_-Vio,30834
|
|
64
|
-
smashbox/tools/tools.py,sha256=
|
|
65
|
+
smashbox/tools/tools.py,sha256=5syoZPNNrdmXBACWGt0HKY_xyczfmXr1-Y96KWcqfSA,14496
|
|
65
66
|
smashbox/tutorials/Python_tutorial.md,sha256=KHDzQDkuLcGS8qLKNZ8VqG5p8FsVx6rKc65PDoloFrk,4825
|
|
66
67
|
smashbox/tutorials/R_Graffas_tutorial.md,sha256=HmVW-JrZiUjVhDkTC05ikDOkpYWIE3JpWzrSsNQBUXc,7041
|
|
67
68
|
smashbox/tutorials/R_tutorial.md,sha256=OVCqlDniblkhP-BKYA5tW3EDipbX2_O20WJaFZwjUVQ,4981
|
|
68
69
|
smashbox/tutorials/__init__.py,sha256=pffqLm0vpwyjTzFROcLlIlRjRD_L3my6aot5xOECJ8c,139
|
|
69
70
|
smashbox/tutorials/generate_doc.md,sha256=UDvCUi0VqpJS62N9u2nC-jwvoyudc2H3UnJROv8hWcs,303
|
|
70
|
-
smashbox-1.
|
|
71
|
-
smashbox-1.
|
|
72
|
-
smashbox-1.
|
|
73
|
-
smashbox-1.
|
|
71
|
+
smashbox-1.1.dist-info/METADATA,sha256=iNMQh8HkqQy484T-wO5FiCOwb3E-qzB4sP5WVLBBDSg,54694
|
|
72
|
+
smashbox-1.1.dist-info/WHEEL,sha256=aha0VrrYvgDJ3Xxl3db_g_MDIW-ZexDdrc_m-Hk8YY4,105
|
|
73
|
+
smashbox-1.1.dist-info/licenses/LICENSE,sha256=5UaZXMTG9FPN_EpUZgNXme_27Tfq6VF-Zo2S6Kjgnu0,12166
|
|
74
|
+
smashbox-1.1.dist-info/RECORD,,
|
|
File without changes
|