wolfhece 2.1.126__py3-none-any.whl → 2.1.128__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.
- wolfhece/PyConfig.py +77 -4
- wolfhece/PyDraw.py +765 -13
- wolfhece/PyPalette.py +36 -0
- wolfhece/PyParams.py +2 -2
- wolfhece/PyVertexvectors.py +560 -64
- wolfhece/apps/version.py +1 -1
- wolfhece/coupling/hydrology_2d.py +295 -192
- wolfhece/eikonal.py +505 -0
- wolfhece/hydrology/Catchment.py +48 -48
- wolfhece/hydrology/PyWatershed.py +93 -93
- wolfhece/lagrange_multiplier.py +205 -0
- wolfhece/lazviewer/laz_viewer.py +28 -3
- wolfhece/math_parser/calculator.py +1 -0
- wolfhece/pybridges.py +2 -2
- wolfhece/pypolygons_scen.py +2 -2
- wolfhece/scenario/config_manager.py +12 -12
- wolfhece/wolf_array.py +1048 -42
- wolfhece/wolfresults_2D.py +204 -13
- {wolfhece-2.1.126.dist-info → wolfhece-2.1.128.dist-info}/METADATA +2 -3
- {wolfhece-2.1.126.dist-info → wolfhece-2.1.128.dist-info}/RECORD +23 -21
- {wolfhece-2.1.126.dist-info → wolfhece-2.1.128.dist-info}/WHEEL +1 -1
- {wolfhece-2.1.126.dist-info → wolfhece-2.1.128.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.126.dist-info → wolfhece-2.1.128.dist-info}/top_level.txt +0 -0
wolfhece/hydrology/Catchment.py
CHANGED
@@ -143,7 +143,7 @@ class Catchment:
|
|
143
143
|
|
144
144
|
# Read the input files
|
145
145
|
# read the Main File
|
146
|
-
self.paramsInput = Wolf_Param(to_read=False,toShow=False)
|
146
|
+
self.paramsInput = Wolf_Param(to_read=False, toShow=False)
|
147
147
|
self.paramsInput.ReadFile(os.path.join(self.workingDir,'Main_model.param'))
|
148
148
|
# Get the version of WOLFHydro
|
149
149
|
self.change_version(self.paramsInput.get_param("General information", "Version WOLFHydo"))
|
@@ -343,7 +343,7 @@ class Catchment:
|
|
343
343
|
self._fill_cloud_retentionbasin()
|
344
344
|
|
345
345
|
def get_subBasin(self, id_sorted_or_name:int | str) -> SubBasin:
|
346
|
-
"""
|
346
|
+
"""
|
347
347
|
This method returns the subbasin object associated with the sorted id or name given in argument.
|
348
348
|
|
349
349
|
The sorted id is the one given by the Fortran code.
|
@@ -620,7 +620,7 @@ class Catchment:
|
|
620
620
|
|
621
621
|
def get_retentionbasin_zones(self)-> Zones:
|
622
622
|
""" This method returns a Zones instance of the retention basins. """
|
623
|
-
|
623
|
+
|
624
624
|
zones = Zones()
|
625
625
|
for curRB in self.retentionBasinDict.values():
|
626
626
|
curRB:RetentionBasin
|
@@ -1857,7 +1857,7 @@ class Catchment:
|
|
1857
1857
|
# paramsInput.ApplytoMemory(None)
|
1858
1858
|
paramsInput.SavetoFile(None)
|
1859
1859
|
|
1860
|
-
|
1860
|
+
|
1861
1861
|
def _correct_Umax_from_old_model(self, adapt_with_rain:bool=True):
|
1862
1862
|
fileName = "simul_soil.param"
|
1863
1863
|
which="Umax"
|
@@ -1870,7 +1870,7 @@ class Catchment:
|
|
1870
1870
|
|
1871
1871
|
paramsInput = Wolf_Param(to_read=False,toShow=False)
|
1872
1872
|
paramsInput.ReadFile(fileToModif)
|
1873
|
-
|
1873
|
+
|
1874
1874
|
if adapt_with_rain:
|
1875
1875
|
myInterval = paramsInput.get_param("Distributed production model parameters", "Time span soil", default_value=0.0)
|
1876
1876
|
if myInterval==0.0:
|
@@ -1888,7 +1888,7 @@ class Catchment:
|
|
1888
1888
|
k = paramsInput.get_param("Horton parameters", "k", default_value=0.0)
|
1889
1889
|
if k==0.0:
|
1890
1890
|
continue
|
1891
|
-
|
1891
|
+
|
1892
1892
|
U_max = maxRain/k
|
1893
1893
|
|
1894
1894
|
paramsInput.change_param("Distributed production model parameters", which, U_max)
|
@@ -1951,7 +1951,7 @@ class Catchment:
|
|
1951
1951
|
isOk, directory = check_path(directory, self.workingDir)
|
1952
1952
|
if isOk<0:
|
1953
1953
|
logging.error(_("ERROR : measuring station data path not present! "))
|
1954
|
-
fileName = os.path.join(directory, self.paramsInput.get_param("Measuring stations SPW", "Filename"))
|
1954
|
+
fileName = os.path.join(directory, self.paramsInput.get_param("Measuring stations SPW", "Filename"))
|
1955
1955
|
|
1956
1956
|
|
1957
1957
|
if os.path.exists(fileName):
|
@@ -2305,11 +2305,11 @@ class Catchment:
|
|
2305
2305
|
|
2306
2306
|
|
2307
2307
|
return timeDelays
|
2308
|
-
|
2308
|
+
|
2309
2309
|
|
2310
2310
|
def get_timeDelays_inlets(self, ref:str = "") -> dict[str, float]:
|
2311
|
-
|
2312
|
-
|
2311
|
+
|
2312
|
+
|
2313
2313
|
if(ref==""):
|
2314
2314
|
junctionKey = self.junctionOut
|
2315
2315
|
else:
|
@@ -2317,7 +2317,7 @@ class Catchment:
|
|
2317
2317
|
if junctionKey is None:
|
2318
2318
|
logging.error("ERROR : Wrong reference to extract timeDelay !")
|
2319
2319
|
return
|
2320
|
-
|
2320
|
+
|
2321
2321
|
junctionKey = self.junctionOut
|
2322
2322
|
refObj = self.catchmentDict[junctionKey]
|
2323
2323
|
time_delays_inlets = refObj.get_timeDelays_inlets()
|
@@ -2535,14 +2535,14 @@ class Catchment:
|
|
2535
2535
|
if self.charact_watrshd.to_update_times:
|
2536
2536
|
self.charact_watrshd.update_times(self.time_wolf_array)
|
2537
2537
|
|
2538
|
-
|
2538
|
+
|
2539
2539
|
def get_all_x_production(self, selection_by_iD: list = [], to_save:bool=True, to_plot:bool=False) -> dict:
|
2540
2540
|
"""
|
2541
2541
|
Retrieves the x production values for all sub-basins or a specific selection of sub-basins.
|
2542
2542
|
|
2543
2543
|
Args:
|
2544
|
-
selection_by_iD (list, optional): A list of sub-basin IDs to retrieve x production values for.
|
2545
|
-
If empty, retrieves x production values for all sub-basins.
|
2544
|
+
selection_by_iD (list, optional): A list of sub-basin IDs to retrieve x production values for.
|
2545
|
+
If empty, retrieves x production values for all sub-basins.
|
2546
2546
|
Defaults to [].
|
2547
2547
|
|
2548
2548
|
Returns:
|
@@ -2560,23 +2560,23 @@ class Catchment:
|
|
2560
2560
|
cur_key = self.get_key_catchmentDict(curID)
|
2561
2561
|
curBasin: SubBasin = self.catchmentDict[cur_key]
|
2562
2562
|
all_x[curID] = curBasin.collect_x_from_production()
|
2563
|
-
|
2563
|
+
|
2564
2564
|
if to_save:
|
2565
2565
|
rd.write_excel_from_dict(all_x, path=self.workingDir, fileName="PostProcess/all_x.xlsx", time=self.time)
|
2566
2566
|
|
2567
2567
|
return all_x
|
2568
|
-
|
2569
2568
|
|
2570
|
-
|
2569
|
+
|
2570
|
+
def get_all_fractions(self, plt_dict:dict[str:np.array]={},selection_by_iD: list = [],
|
2571
2571
|
to_save:bool=True, to_plot:bool=False,
|
2572
|
-
summary:str=None, summary_interval:list[datetime.datetime]=None,
|
2572
|
+
summary:str=None, summary_interval:list[datetime.datetime]=None,
|
2573
2573
|
add_info:dict[dict[str,float]]={}) -> dict:
|
2574
2574
|
"""
|
2575
2575
|
Retrieves the physical flux fractions values for all sub-basins or a specific selection of sub-basins.
|
2576
2576
|
|
2577
2577
|
Args:
|
2578
|
-
selection_by_iD (list, optional): A list of sub-basin IDs to retrieve fractions values for.
|
2579
|
-
If empty, retrieves fractions values for all sub-basins.
|
2578
|
+
selection_by_iD (list, optional): A list of sub-basin IDs to retrieve fractions values for.
|
2579
|
+
If empty, retrieves fractions values for all sub-basins.
|
2580
2580
|
Defaults to [].
|
2581
2581
|
|
2582
2582
|
Returns:
|
@@ -2598,7 +2598,7 @@ class Catchment:
|
|
2598
2598
|
summary_fractions = {}
|
2599
2599
|
summary_dict = {}
|
2600
2600
|
if selection_by_iD == []:
|
2601
|
-
summary_fractions = {curBasin.name: curBasin.get_summary_fractions(summary=summary, interval=summary_interval)
|
2601
|
+
summary_fractions = {curBasin.name: curBasin.get_summary_fractions(summary=summary, interval=summary_interval)
|
2602
2602
|
for curBasin in self.subBasinDict.values()}
|
2603
2603
|
else:
|
2604
2604
|
for curID in selection_by_iD:
|
@@ -2628,9 +2628,9 @@ class Catchment:
|
|
2628
2628
|
else:
|
2629
2629
|
summary_dict[key_add].append(np.nan)
|
2630
2630
|
|
2631
|
-
|
2632
2631
|
|
2633
|
-
|
2632
|
+
|
2633
|
+
# summary_dict = {cur_key: [cur_dict[cur_key] for cur_dict in summary_fractions.values() if cur_key in cur_dict]
|
2634
2634
|
# for cur_dict in summary_fractions.values() for cur_key in cur_dict}
|
2635
2635
|
# all_fractions["Summary"] = summary_dict
|
2636
2636
|
|
@@ -2641,7 +2641,7 @@ class Catchment:
|
|
2641
2641
|
self.plot_all_fractions(all_fractions)
|
2642
2642
|
|
2643
2643
|
return all_fractions
|
2644
|
-
|
2644
|
+
|
2645
2645
|
|
2646
2646
|
def plot_all_fractions(self, all_fractions:dict[str:np.array]={}, selection_by_iD:list=[], to_show:bool=False, writeDir:str="", range_data:list[datetime.datetime]=[]):
|
2647
2647
|
|
@@ -2655,7 +2655,7 @@ class Catchment:
|
|
2655
2655
|
for curID in selection_by_iD:
|
2656
2656
|
cur_key = self.get_key_catchmentDict(curID)
|
2657
2657
|
curBasin: SubBasin = self.catchmentDict[cur_key]
|
2658
|
-
curBasin.plot_all_fractions(to_show=False, writeDir=writeDir, range_data=range_data)
|
2658
|
+
curBasin.plot_all_fractions(to_show=False, writeDir=writeDir, range_data=range_data)
|
2659
2659
|
|
2660
2660
|
if to_show:
|
2661
2661
|
plt.show()
|
@@ -2667,8 +2667,8 @@ class Catchment:
|
|
2667
2667
|
Retrieves the x production values for all sub-basins or a specific selection of sub-basins.
|
2668
2668
|
|
2669
2669
|
Args:
|
2670
|
-
selection_by_iD (list, optional): A list of sub-basin IDs to retrieve x production values for.
|
2671
|
-
If empty, retrieves x production values for all sub-basins.
|
2670
|
+
selection_by_iD (list, optional): A list of sub-basin IDs to retrieve x production values for.
|
2671
|
+
If empty, retrieves x production values for all sub-basins.
|
2672
2672
|
Defaults to [].
|
2673
2673
|
|
2674
2674
|
Returns:
|
@@ -2691,15 +2691,15 @@ class Catchment:
|
|
2691
2691
|
rd.write_excel_from_dict(all_iv, path=self.workingDir, fileName="PostProcess/all_iv.xlsx", time=self.time)
|
2692
2692
|
|
2693
2693
|
return all_iv
|
2694
|
-
|
2695
|
-
|
2694
|
+
|
2695
|
+
|
2696
2696
|
def activate_all_internal_variables(self, selection_by_iD: list = [])->dict:
|
2697
2697
|
"""
|
2698
2698
|
Activates all internal variables for all sub-basins or a specific selection of sub-basins.
|
2699
2699
|
|
2700
2700
|
Args:
|
2701
|
-
selection_by_iD (list, optional): A list of sub-basin IDs to activate internal variables for.
|
2702
|
-
If empty, activates internal variables for all sub-basins.
|
2701
|
+
selection_by_iD (list, optional): A list of sub-basin IDs to activate internal variables for.
|
2702
|
+
If empty, activates internal variables for all sub-basins.
|
2703
2703
|
Defaults to [].
|
2704
2704
|
|
2705
2705
|
Returns:
|
@@ -2722,8 +2722,8 @@ class Catchment:
|
|
2722
2722
|
Checks the presence of internal variables for all sub-basins or a specific selection of sub-basins.
|
2723
2723
|
|
2724
2724
|
Args:
|
2725
|
-
selection_by_iD (list, optional): A list of sub-basin IDs to check the presence of internal variables for.
|
2726
|
-
If empty, checks the presence of internal variables for all sub-basins.
|
2725
|
+
selection_by_iD (list, optional): A list of sub-basin IDs to check the presence of internal variables for.
|
2726
|
+
If empty, checks the presence of internal variables for all sub-basins.
|
2727
2727
|
Defaults to [].
|
2728
2728
|
|
2729
2729
|
Returns:
|
@@ -2743,7 +2743,7 @@ class Catchment:
|
|
2743
2743
|
all_x[curID] = curBasin.check_presence_of_iv()
|
2744
2744
|
|
2745
2745
|
return all_x
|
2746
|
-
|
2746
|
+
|
2747
2747
|
|
2748
2748
|
def get_all_Qtest(self, selection_by_iD: list = [], nb_atttempts:int=-1) :
|
2749
2749
|
|
@@ -2755,17 +2755,17 @@ class Catchment:
|
|
2755
2755
|
# curBasin: SubBasin = self.catchmentDict[cur_key]
|
2756
2756
|
# q_test = curBasin.get_all_Qtest(nb_atttempts)
|
2757
2757
|
q_test = [
|
2758
|
-
self.catchmentDict[self.get_key_catchmentDict(curID)].get_all_Qtest(nb_atttempts)
|
2758
|
+
self.catchmentDict[self.get_key_catchmentDict(curID)].get_all_Qtest(nb_atttempts)
|
2759
2759
|
for curID in selection_by_iD ]
|
2760
2760
|
|
2761
2761
|
return q_test
|
2762
|
-
|
2762
|
+
|
2763
2763
|
|
2764
2764
|
def _get_simulation_intervals(self):
|
2765
2765
|
"""
|
2766
2766
|
This procedure is getting the simulation intervals of the current module.
|
2767
2767
|
"""
|
2768
|
-
|
2768
|
+
|
2769
2769
|
nb_interv = self.paramsInput.get_param("Simulation intervals", "Nb", default_value=0)
|
2770
2770
|
simulation_intervals = []
|
2771
2771
|
for i in range(1, nb_interv+1):
|
@@ -2776,18 +2776,18 @@ class Catchment:
|
|
2776
2776
|
simulation_intervals.append((di,df))
|
2777
2777
|
|
2778
2778
|
return simulation_intervals
|
2779
|
-
|
2779
|
+
|
2780
2780
|
|
2781
2781
|
def _set_simulation_intervals(self, simulation_intervals:list[tuple[datetime.datetime,datetime.datetime]]):
|
2782
2782
|
"""
|
2783
2783
|
This procedure is setting the simulation intervals of the current module.
|
2784
2784
|
"""
|
2785
|
-
|
2785
|
+
|
2786
2786
|
self.paramsInput.change_param("Simulation intervals", "Nb", len(simulation_intervals))
|
2787
2787
|
for i, interval in enumerate(simulation_intervals):
|
2788
2788
|
self.paramsInput.change_param("Simulation intervals", "Date begin "+str(i+1), interval[0].strftime(cst.DATE_FORMAT_HYDRO))
|
2789
2789
|
self.paramsInput.change_param("Simulation intervals", "Date end "+str(i+1), interval[1].strftime(cst.DATE_FORMAT_HYDRO))
|
2790
|
-
|
2790
|
+
|
2791
2791
|
self.paramsInput.SavetoFile(None)
|
2792
2792
|
self.paramsInput.Reload(None)
|
2793
2793
|
|
@@ -2795,7 +2795,7 @@ class Catchment:
|
|
2795
2795
|
@property
|
2796
2796
|
def simulation_intervals(self) ->list[tuple[datetime.datetime,datetime.datetime]]:
|
2797
2797
|
return self._get_simulation_intervals()
|
2798
|
-
|
2798
|
+
|
2799
2799
|
|
2800
2800
|
@simulation_intervals.setter
|
2801
2801
|
def simulation_intervals(self, value:list[tuple[datetime.datetime,datetime.datetime]]):
|
@@ -2806,29 +2806,29 @@ class Catchment:
|
|
2806
2806
|
"""
|
2807
2807
|
This procedure is getting the temporal parameters of the current module.
|
2808
2808
|
"""
|
2809
|
-
|
2809
|
+
|
2810
2810
|
return (self.dateBegin, self.dateEnd)
|
2811
|
-
|
2812
|
-
|
2811
|
+
|
2812
|
+
|
2813
2813
|
def _set_temporal_parameters(self, simulation_intervals:tuple[datetime.datetime,datetime.datetime]):
|
2814
2814
|
"""
|
2815
2815
|
This procedure is setting the temporal parameters of the current module.
|
2816
2816
|
"""
|
2817
|
-
|
2817
|
+
|
2818
2818
|
self.dateBegin = simulation_intervals[0]
|
2819
2819
|
self.dateEnd = simulation_intervals[1]
|
2820
2820
|
|
2821
2821
|
self.paramsInput.change_param("Temporal Parameters", "Start date time", self.dateBegin.strftime(cst.DATE_FORMAT_HYDRO))
|
2822
2822
|
self.paramsInput.change_param("Temporal Parameters", "End date time", self.dateEnd.strftime(cst.DATE_FORMAT_HYDRO))
|
2823
|
-
|
2823
|
+
|
2824
2824
|
self.paramsInput.SavetoFile(None)
|
2825
2825
|
self.paramsInput.Reload(None)
|
2826
2826
|
|
2827
|
-
|
2827
|
+
|
2828
2828
|
@property
|
2829
2829
|
def temporal_parameters(self) ->tuple[datetime.datetime, datetime.datetime]:
|
2830
2830
|
return self._get_temporal_parameters()
|
2831
|
-
|
2831
|
+
|
2832
2832
|
|
2833
2833
|
@temporal_parameters.setter
|
2834
2834
|
def temporal_parameters(self, value:tuple[datetime.datetime,datetime.datetime]):
|