wolfhece 2.2.41__py3-none-any.whl → 2.2.42__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/PyDraw.py +73 -19
- wolfhece/apps/version.py +1 -1
- wolfhece/mesh2d/wolf2dprev.py +45 -17
- wolfhece/models/walous_ocs.pal +49 -0
- wolfhece/pywalous.py +200 -139
- wolfhece/wolf_array.py +148 -78
- {wolfhece-2.2.41.dist-info → wolfhece-2.2.42.dist-info}/METADATA +1 -1
- {wolfhece-2.2.41.dist-info → wolfhece-2.2.42.dist-info}/RECORD +11 -10
- {wolfhece-2.2.41.dist-info → wolfhece-2.2.42.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.41.dist-info → wolfhece-2.2.42.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.41.dist-info → wolfhece-2.2.42.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -3697,13 +3697,20 @@ class WolfMapViewer(wx.Frame):
|
|
3697
3697
|
self._uts_menu = wx.Menu()
|
3698
3698
|
self._ocs_menu = wx.Menu()
|
3699
3699
|
|
3700
|
-
self._uts_crop = self._uts_menu.Append(wx.ID_ANY, _("Crop on active array"), _("Crop active array"))
|
3701
|
-
self._uts_cropscreen = self._uts_menu.Append(wx.ID_ANY, _("Crop on screen"), _("Crop screen"))
|
3700
|
+
self._uts_crop = self._uts_menu.Append(wx.ID_ANY, _("Crop on active array"), _("Crop UTS data (vectorized - shp, gpkg) on the active array extent"))
|
3701
|
+
self._uts_cropscreen = self._uts_menu.Append(wx.ID_ANY, _("Crop on screen"), _("Crop UTS data (vectorized - shp, gpkg) on the current screen extent"))
|
3702
3702
|
self._uts_map = self._uts_menu.Append(wx.ID_ANY, _("Map active array (WAL_UTS -> Manning)"), _("Map Walous UTS active array to Manning's n"))
|
3703
3703
|
self._uts_legend = self._uts_menu.Append(wx.ID_ANY, _("Legend"), _("Legend"))
|
3704
3704
|
|
3705
|
-
self.
|
3706
|
-
self.
|
3705
|
+
self._ocs_crop_10m_2023 = self._ocs_menu.Append(wx.ID_ANY, _("Crop on active array (prepared data 10 m - 2023)"), _("Crop OCS data (matrix - geotif) on the active array extent using prepared 10m data"))
|
3706
|
+
self._ocs_cropscreen_10m_2023 = self._ocs_menu.Append(wx.ID_ANY, _("Crop on screen (prepared data 10 m - 2023)"), _("Crop OCS data (matrix - geotif) on the current screen extent using prepared 10m data"))
|
3707
|
+
self._ocs_menu.AppendSeparator()
|
3708
|
+
self._ocs_crop_10m_2020 = self._ocs_menu.Append(wx.ID_ANY, _("Crop on active array (prepared data 10 m - 2020)"), _("Crop OCS data (matrix - geotif) on the active array extent using prepared 10m data"))
|
3709
|
+
self._ocs_cropscreen_10m_2020 = self._ocs_menu.Append(wx.ID_ANY, _("Crop on screen (prepared data 10 m - 2020)"), _("Crop OCS data (matrix - geotif) on the current screen extent using prepared 10m data"))
|
3710
|
+
self._ocs_menu.AppendSeparator()
|
3711
|
+
self._ocs_crop = self._ocs_menu.Append(wx.ID_ANY, _("Crop on active array"), _("Crop OCS data (matrix - geotif) on the active array extent"))
|
3712
|
+
self._ocs_cropscreen = self._ocs_menu.Append(wx.ID_ANY, _("Crop on screen"), _("Crop OCS data (matrix - geotif) on the current screen extent"))
|
3713
|
+
self._ocs_menu.AppendSeparator()
|
3707
3714
|
self._ocs_map = self._ocs_menu.Append(wx.ID_ANY, _("Map active array (WAL_OCS -> Hydrology)"), _("Map Walous OCS active array to Hydrology's landuse classification"))
|
3708
3715
|
self._ocs_map = self._ocs_menu.Append(wx.ID_ANY, _("Map active array (WAL_OCS -> Manning)"), _("Map Walous OCS active array to Manning's n"))
|
3709
3716
|
self._ocs_legend = self._ocs_menu.Append(wx.ID_ANY, _("Legend"), _("Legend"))
|
@@ -3832,9 +3839,9 @@ class WolfMapViewer(wx.Frame):
|
|
3832
3839
|
|
3833
3840
|
itemlabel = item.ItemLabel
|
3834
3841
|
|
3835
|
-
if
|
3842
|
+
if _("Crop on active array") in itemlabel or _("Crop on screen") in itemlabel:
|
3836
3843
|
|
3837
|
-
if
|
3844
|
+
if _("Crop on screen") in itemlabel:
|
3838
3845
|
|
3839
3846
|
bounds = self.get_canvas_bounds(gridsize=1.)
|
3840
3847
|
|
@@ -3868,14 +3875,24 @@ class WolfMapViewer(wx.Frame):
|
|
3868
3875
|
from .pywalous import update_palette_walous_ocs
|
3869
3876
|
|
3870
3877
|
if self._walous_OCS_filepath is None:
|
3871
|
-
dlg = wx.FileDialog(self, _("Choose the Walous OCS Tif file"), wildcard="Tif file (*.tif)|*.tif|all (*.*)|*.*", style=wx.FD_OPEN)
|
3872
|
-
if dlg.ShowModal() == wx.ID_CANCEL:
|
3873
|
-
dlg.Destroy()
|
3874
|
-
return
|
3875
3878
|
|
3876
|
-
|
3877
|
-
|
3879
|
+
if itemlabel in [_("Crop on active array (prepared data 10 m - 2023)"), _("Crop on screen (prepared data 10 m - 2023)")]:
|
3880
|
+
self._walous_OCS_filepath = toys_dataset('Walous_OCS', 'WALOUS_2023_lbt72_10m.tif')
|
3881
|
+
elif itemlabel in [_("Crop on active array (prepared data 10 m - 2020)"), _("Crop on screen (prepared data 10 m - 2020)")]:
|
3882
|
+
self._walous_OCS_filepath = toys_dataset('Walous_OCS', 'WALOUS_2020_lbt72_10m.tif')
|
3878
3883
|
|
3884
|
+
else:
|
3885
|
+
dlg = wx.FileDialog(self, _("Choose the Walous OCS Tif file"), wildcard="Tif file (*.tif)|*.tif|all (*.*)|*.*", style=wx.FD_OPEN)
|
3886
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
3887
|
+
dlg.Destroy()
|
3888
|
+
return
|
3889
|
+
|
3890
|
+
self._walous_OCS_filepath = Path(dlg.GetPath())
|
3891
|
+
dlg.Destroy()
|
3892
|
+
|
3893
|
+
if self._walous_OCS_filepath is None or not Path(self._walous_OCS_filepath).exists():
|
3894
|
+
logging.error(_('No Walous OCS file -- Please set it'))
|
3895
|
+
return
|
3879
3896
|
|
3880
3897
|
dlg = wx.FileDialog(self, _("Choose the output file"), wildcard="Geotif (*.tif)|*.tif|all (*.*)|*.*", style=wx.FD_SAVE, defaultDir=str(def_outdrir))
|
3881
3898
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
@@ -3885,8 +3902,33 @@ class WolfMapViewer(wx.Frame):
|
|
3885
3902
|
output = Path(dlg.GetPath())
|
3886
3903
|
dlg.Destroy()
|
3887
3904
|
|
3905
|
+
header_OCS = header_wolf.read_header(self._walous_OCS_filepath)
|
3906
|
+
if header_OCS.dx != spatial_res:
|
3907
|
+
# Adapt bounds to ensure that the rebin will be correct.
|
3908
|
+
# If spatial_res is a multiple of header_OCS.dx, no need to change bounds.
|
3909
|
+
# If not, change the bounds to ensure that the crop will include data in all footprints.
|
3910
|
+
|
3911
|
+
# Convert bvounds to list to be able to modify it
|
3912
|
+
bounds = [list(bounds[0]), list(bounds[1])]
|
3913
|
+
|
3914
|
+
if (bounds[0][0] - header_OCS.origx) % header_OCS.dx != 0:
|
3915
|
+
bounds[0][0] = header_OCS.origx + ((bounds[0][0] - header_OCS.origx) // header_OCS.dx) * header_OCS.dx
|
3916
|
+
if (bounds[0][1] - bounds[0][0]) % header_OCS.dx != 0:
|
3917
|
+
bounds[0][1] = bounds[0][0] + ((bounds[0][1] - bounds[0][0]) // header_OCS.dx + 1) * header_OCS.dx
|
3918
|
+
if (bounds[1][0] - header_OCS.origy) % header_OCS.dy != 0:
|
3919
|
+
bounds[1][0] = header_OCS.origy + ((bounds[1][0] - header_OCS.origy) // header_OCS.dy) * header_OCS.dy
|
3920
|
+
if (bounds[1][1] - bounds[1][0]) % header_OCS.dy != 0:
|
3921
|
+
bounds[1][1] = bounds[1][0] + ((bounds[1][1] - bounds[1][0]) // header_OCS.dy + 1) * header_OCS.dy
|
3922
|
+
|
3888
3923
|
locwalous = WolfArray(fname=self._walous_OCS_filepath,
|
3889
|
-
crop = bounds)
|
3924
|
+
crop = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]])
|
3925
|
+
|
3926
|
+
if locwalous.dx != spatial_res:
|
3927
|
+
locwalous.rebin(spatial_res / locwalous.dx, operation='min')
|
3928
|
+
logging.info(_('Rebin to {} m because original data are {} m').format(spatial_res, locwalous.dx))
|
3929
|
+
locwalous = WolfArray(mold=locwalous, crop = self.active_array.get_bounds())
|
3930
|
+
|
3931
|
+
locwalous.write_all(output)
|
3890
3932
|
|
3891
3933
|
if Path(output).exists():
|
3892
3934
|
logging.info(_('File {} created').format(output))
|
@@ -3904,6 +3946,7 @@ class WolfMapViewer(wx.Frame):
|
|
3904
3946
|
elif ret == wx.ID_YES:
|
3905
3947
|
walousarray = WolfArray(fname=output)
|
3906
3948
|
update_palette_walous_ocs(walousarray.mypal)
|
3949
|
+
walousarray.reset_plot()
|
3907
3950
|
self.add_object('array', newobj=walousarray, id = 'walous_ocs_crop')
|
3908
3951
|
dlg.Destroy()
|
3909
3952
|
|
@@ -3920,6 +3963,10 @@ class WolfMapViewer(wx.Frame):
|
|
3920
3963
|
logging.warning(_('No active array -- Please activate data first'))
|
3921
3964
|
return
|
3922
3965
|
|
3966
|
+
if self.active_array.wolftype != WOLF_ARRAY_FULL_SINGLE:
|
3967
|
+
logging.error(_('Active array is not a Float32 array -- Please change it to Float32 before mapping'))
|
3968
|
+
return
|
3969
|
+
|
3923
3970
|
vals = self.active_array.get_unique_values()
|
3924
3971
|
|
3925
3972
|
if self._walous_layer is None:
|
@@ -3955,6 +4002,10 @@ class WolfMapViewer(wx.Frame):
|
|
3955
4002
|
logging.warning(_('No active array -- Please activate data first'))
|
3956
4003
|
return
|
3957
4004
|
|
4005
|
+
if self.active_array.wolftype != WOLF_ARRAY_FULL_SINGLE:
|
4006
|
+
logging.error(_('Active array is not a Float32 array -- Please change it to Float32 before mapping'))
|
4007
|
+
return
|
4008
|
+
|
3958
4009
|
vals = self.active_array.get_unique_values()
|
3959
4010
|
|
3960
4011
|
if self._walous_layer is None:
|
@@ -3995,7 +4046,6 @@ class WolfMapViewer(wx.Frame):
|
|
3995
4046
|
|
3996
4047
|
if itemlabel in [_("Crop on active array"), _("Crop on screen")]:
|
3997
4048
|
|
3998
|
-
|
3999
4049
|
if itemlabel == _("Crop on screen"):
|
4000
4050
|
|
4001
4051
|
bounds = self.get_canvas_bounds(gridsize=1.)
|
@@ -4027,10 +4077,10 @@ class WolfMapViewer(wx.Frame):
|
|
4027
4077
|
def_outdrir = Path(self.active_array.filename).parent
|
4028
4078
|
spatial_res = self.active_array.dx
|
4029
4079
|
|
4030
|
-
from .pywalous import Walous_data,
|
4080
|
+
from .pywalous import Walous_data, WALOUS_UTS2MANNING_MAJ_NIV1, WALOUS_UTS2MANNING_MAJ_NIV2, update_palette_walous_uts
|
4031
4081
|
|
4032
4082
|
if self._walous_UTS_filepath is None:
|
4033
|
-
dlg = wx.FileDialog(self, _("Choose the Walous shape file"), wildcard="Shapefile (*.shp)|*.shp|all (*.*)|*.*", style=wx.FD_OPEN)
|
4083
|
+
dlg = wx.FileDialog(self, _("Choose the Walous shape file"), wildcard="Geopackage (*.gpkg)|*.gpkg|Shapefile (*.shp)|*.shp|all (*.*)|*.*", style=wx.FD_OPEN)
|
4034
4084
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
4035
4085
|
dlg.Destroy()
|
4036
4086
|
return
|
@@ -4054,7 +4104,7 @@ class WolfMapViewer(wx.Frame):
|
|
4054
4104
|
dlg.Destroy()
|
4055
4105
|
return
|
4056
4106
|
|
4057
|
-
self._walous_layer = dlg.GetStringSelection()
|
4107
|
+
self._walous_layer = 'UTS_' + dlg.GetStringSelection()
|
4058
4108
|
|
4059
4109
|
locwalous = Walous_data(self._walous_UTS_filepath.parent, self._walous_UTS_filepath.name)
|
4060
4110
|
ret = locwalous.rasterize(bounds=bounds,
|
@@ -4100,14 +4150,18 @@ class WolfMapViewer(wx.Frame):
|
|
4100
4150
|
logging.warning(_('No active array -- Please activate data first'))
|
4101
4151
|
return
|
4102
4152
|
|
4153
|
+
if self.active_array.wolftype != WOLF_ARRAY_FULL_SINGLE:
|
4154
|
+
logging.error(_('Active array is not a Float32 array -- Please change it to Float32 before mapping'))
|
4155
|
+
return
|
4156
|
+
|
4103
4157
|
vals = self.active_array.get_unique_values()
|
4104
4158
|
|
4105
4159
|
if self._walous_layer is None:
|
4106
4160
|
|
4107
4161
|
if vals[0] > 10:
|
4108
|
-
self._walous_layer = '
|
4162
|
+
self._walous_layer = 'UTS_MAJ_NIV2'
|
4109
4163
|
else:
|
4110
|
-
self._walous_layer = '
|
4164
|
+
self._walous_layer = 'UTS_MAJ_NIV1'
|
4111
4165
|
|
4112
4166
|
dlg = DlgMapWalous2Manning(self, which=self._walous_layer)
|
4113
4167
|
|
wolfhece/apps/version.py
CHANGED
wolfhece/mesh2d/wolf2dprev.py
CHANGED
@@ -51,6 +51,8 @@ PREV_INFILTRATION_VAR_SIMPLE = -1 #INFILTRATION VARIABLE (RÉPARTITION UNIFORME
|
|
51
51
|
PREV_INFILTRATION_VAR_MOD_MOMENTUM = -2 #INFILTRATION VARIABLE AVEC MOD QT MVT (RÉPARTITION NON UNIFORME DU DÉBIT INJECTÉ CALCULÉ SUR BASE DE L'ÉTAT HYDRODYNAMIQUE INSTANTANÉ)
|
52
52
|
PREV_INFILTRATION_VAR_LINKED_ZONES = -3 #INFILTRATION/EXFILTRATION "INTERNE" VARIABLE (RÉPARTITION UNIFORME DU DÉBIT SUR BASE DE DEUX ZONES D'INFILTRATION)
|
53
53
|
|
54
|
+
PREV_INFILTRATION_MODES = [PREV_INFILTRATION_NULL, PREV_INFILTRATION_SIMPLE, PREV_INFILTRATION_MOD_MOMENTUM, PREV_INFILTRATION_MOD_MOMENTUM_IMPOSED, PREV_INFILTRATION_VAR_SIMPLE, PREV_INFILTRATION_VAR_MOD_MOMENTUM, PREV_INFILTRATION_VAR_LINKED_ZONES]
|
55
|
+
|
54
56
|
##
|
55
57
|
PREV_READ_TXT = 1
|
56
58
|
PREV_READ_FINE = 2
|
@@ -968,8 +970,8 @@ class prev_parameters_blocks:
|
|
968
970
|
def get_params_sediment(self) -> dict:
|
969
971
|
""" Retourne les paramètres du modèle sédimentaire """
|
970
972
|
|
971
|
-
return {_('Model'): self.
|
972
|
-
_('Drifting model'): self.
|
973
|
+
return {_('Model'): self._get_params_sediment_model(),
|
974
|
+
_('Drifting model'): self._get_params_sediment_drifting_model(),
|
973
975
|
_('Porosity'): self._sed_porosity,
|
974
976
|
_('Mean diameter'): self._sed_d_mean,
|
975
977
|
_('Sediment density'): self._sed_s,
|
@@ -2127,48 +2129,74 @@ class prev_parameters_blocks:
|
|
2127
2129
|
'cd_c': self._infil_dev_c,
|
2128
2130
|
'cd_d': self._infil_dev_d}
|
2129
2131
|
|
2130
|
-
elif self._infiltration_mode ==
|
2131
|
-
return self.
|
2132
|
+
elif self._infiltration_mode == PREV_INFILTRATION_MOD_MOMENTUM_IMPOSED:
|
2133
|
+
return self.get_params_infiltration_momentum_correction()
|
2132
2134
|
|
2133
2135
|
else:
|
2134
2136
|
return {}
|
2135
2137
|
|
2138
|
+
def get_infiltration_mode(self) -> int:
|
2139
|
+
""" Retourne le mode d'infiltration """
|
2140
|
+
return self._infiltration_mode
|
2141
|
+
|
2142
|
+
def set_infiltration_mode(self, mode:int) -> None:
|
2143
|
+
""" Définit le mode d'infiltration
|
2144
|
+
|
2145
|
+
0 : PREV_INFILTRATION_NULL - PAS D'INFILTRATION
|
2146
|
+
1 : PREV_INFILTRATION_SIMPLE - INFILTRATION SIMPLE (RÉPARTITION UNIFORME DU DÉBIT INJECTÉ PAR FICHIER .INF)
|
2147
|
+
2 : PREV_INFILTRATION_MOD_MOMENTUM - INFILTRATION AVEC MODIFICATION DE LA QT DE MVT (RÉPARTITION NON UNIFORME DU DÉBIT INJECTÉ PAR FICHIER .INF)
|
2148
|
+
4 : PREV_INFILTRATION_MOD_MOMENTUM_IMPOSED - INFILTRATION AVEC MODIFICATION IMPOSÉE DE LA QT DE MVT (RÉPARTITION NON UNIFORME DU DÉBIT INJECTÉ PAR FICHIER .INF)
|
2149
|
+
-1 : PREV_INFILTRATION_VAR_SIMPLE - INFILTRATION VARIABLE (RÉPARTITION UNIFORME DU DÉBIT INJECTÉ CALCULÉ SUR BASE DE L'ÉTAT HYDRODYNAMIQUE INSTANTANÉ)
|
2150
|
+
-2 : PREV_INFILTRATION_VAR_MOD_MOMENTUM - INFILTRATION VARIABLE AVEC MOD QT MVT (RÉPARTITION NON UNIFORME DU DÉBIT INJECTÉ CALCULÉ SUR BASE DE L'ÉTAT HYDRODYNAMIQUE INSTANTANÉ)
|
2151
|
+
-3 : PREV_INFILTRATION_VAR_LINKED_ZONES - INFILTRATION/EXFILTRATION "INTERNE" VARIABLE (RÉPARTITION UNIFORME DU DÉBIT SUR BASE DE DEUX ZONES D'INFILTRATION)
|
2152
|
+
|
2153
|
+
:param mode: mode d'infiltration
|
2154
|
+
"""
|
2155
|
+
assert isinstance(mode, int), "mode must be an integer"
|
2156
|
+
assert mode in PREV_INFILTRATION_MODES, f"mode must be in {PREV_INFILTRATION_MODES}"
|
2157
|
+
self._infiltration_mode = mode
|
2158
|
+
|
2159
|
+
def reset_infiltration_mode(self) -> None:
|
2160
|
+
""" Réinitialise le mode d'infiltration """
|
2161
|
+
self._infiltration_mode = PREV_INFILTRATION_NULL
|
2162
|
+
|
2163
|
+
|
2136
2164
|
def check_params_infiltration(self) -> tuple[bool, str]:
|
2137
2165
|
""" Vérifie les paramètres d'infiltration """
|
2138
2166
|
|
2139
2167
|
ret = '\nInfiltration\n************\n'
|
2140
2168
|
valid = True
|
2141
2169
|
|
2142
|
-
if self._infiltration_mode ==
|
2170
|
+
if self._infiltration_mode == PREV_INFILTRATION_NULL:
|
2143
2171
|
ret += _('Info: No infiltration\n')
|
2144
|
-
elif self._infiltration_mode ==
|
2172
|
+
elif self._infiltration_mode == PREV_INFILTRATION_SIMPLE:
|
2145
2173
|
ret += _('Info: Simple infiltration\n')
|
2146
|
-
elif self._infiltration_mode ==
|
2174
|
+
elif self._infiltration_mode == PREV_INFILTRATION_MOD_MOMENTUM:
|
2147
2175
|
ret += _('Info: Infiltration with momentum modification\n')
|
2148
|
-
elif self._infiltration_mode ==
|
2176
|
+
elif self._infiltration_mode == PREV_INFILTRATION_MOD_MOMENTUM_IMPOSED:
|
2149
2177
|
ret += _('Info: Infiltration with imposed momentum modification\n')
|
2150
|
-
elif self._infiltration_mode ==
|
2178
|
+
elif self._infiltration_mode == PREV_INFILTRATION_VAR_SIMPLE:
|
2151
2179
|
ret += _('Info: Variable infiltration\n')
|
2152
|
-
elif self._infiltration_mode ==
|
2180
|
+
elif self._infiltration_mode == PREV_INFILTRATION_VAR_MOD_MOMENTUM:
|
2153
2181
|
ret += _('Info: Variable infiltration with momentum modification\n')
|
2154
|
-
elif self._infiltration_mode ==
|
2182
|
+
elif self._infiltration_mode == PREV_INFILTRATION_VAR_LINKED_ZONES:
|
2155
2183
|
ret += _('Info: Variable infiltration/exfiltration (linked zone)\n')
|
2156
2184
|
|
2157
2185
|
if self._infiltration_mode < 0:
|
2158
2186
|
ret += _('Info: Coefficients a={self._infil_a}, b={self._infil_b}, c={self._infil_c}\n')
|
2159
2187
|
|
2160
|
-
if self._infiltration_mode !=
|
2188
|
+
if self._infiltration_mode != PREV_INFILTRATION_VAR_LINKED_ZONES and self._infil_a == 0. and self._infil_b == 0. and self._infil_c == 0.:
|
2161
2189
|
ret += _('Warning: No polynomial infiltration\n')
|
2162
2190
|
|
2163
|
-
if self._infiltration_mode ==
|
2191
|
+
if self._infiltration_mode == PREV_INFILTRATION_VAR_LINKED_ZONES and self._infil_a == 0.:
|
2164
2192
|
ret += _('Warning: No infiltration/exfiltration under bridge\n')
|
2165
2193
|
|
2166
2194
|
ret += _('Info: Coefficients Cd={self._infil_dev_cd}, width={self._infil_dev_width}\n, zseuil={self._infil_dev_zseuil}')
|
2167
2195
|
|
2168
|
-
if self._infiltration_mode !=
|
2196
|
+
if self._infiltration_mode != PREV_INFILTRATION_VAR_LINKED_ZONES and self._infil_dev_cd == 0. or self._infil_dev_width == 0.:
|
2169
2197
|
ret += _('Warning: No weir exfiltration\n')
|
2170
2198
|
|
2171
|
-
if self._infiltration_mode ==
|
2199
|
+
if self._infiltration_mode == PREV_INFILTRATION_VAR_LINKED_ZONES and (self._infil_dev_cd == 0. or self._infil_dev_width == 0.):
|
2172
2200
|
ret += _('Warning: No weir over bridge\n')
|
2173
2201
|
|
2174
2202
|
ret += _('Info: Coefficients d={self._infil_var_d}, e={self._infil_var_e}\n')
|
@@ -2195,7 +2223,7 @@ class prev_parameters_blocks:
|
|
2195
2223
|
self._infil_correction_ux = ux
|
2196
2224
|
self._infil_correction_vy = vy
|
2197
2225
|
|
2198
|
-
if self._infiltration_mode !=
|
2226
|
+
if self._infiltration_mode != PREV_INFILTRATION_MOD_MOMENTUM_IMPOSED:
|
2199
2227
|
logging.warning("To apply, you must set ninfil to 4")
|
2200
2228
|
else:
|
2201
2229
|
logging.info("Infiltration momentum correction applied")
|
@@ -2203,7 +2231,7 @@ class prev_parameters_blocks:
|
|
2203
2231
|
def get_params_infiltration_momentum_correction(self) -> dict:
|
2204
2232
|
""" Retourne les corrections de moment pour l'infiltration """
|
2205
2233
|
|
2206
|
-
if self._infiltration_mode ==
|
2234
|
+
if self._infiltration_mode == PREV_INFILTRATION_MOD_MOMENTUM_IMPOSED:
|
2207
2235
|
return {'ux': self._infil_correction_ux,
|
2208
2236
|
'vy': self._infil_correction_vy}
|
2209
2237
|
else:
|
@@ -0,0 +1,49 @@
|
|
1
|
+
12
|
2
|
+
0.0
|
3
|
+
229
|
4
|
+
234
|
5
|
+
63
|
6
|
+
1.0
|
7
|
+
138
|
8
|
+
138
|
9
|
+
138
|
10
|
+
2.0
|
11
|
+
220
|
12
|
+
15
|
13
|
+
15
|
14
|
+
3.0
|
15
|
+
78
|
16
|
+
78
|
17
|
+
78
|
18
|
+
4.0
|
19
|
+
208
|
20
|
+
208
|
21
|
+
208
|
22
|
+
5.0
|
23
|
+
36
|
24
|
+
97
|
25
|
+
247
|
26
|
+
6.0
|
27
|
+
255
|
28
|
+
255
|
29
|
+
115
|
30
|
+
7.0
|
31
|
+
233
|
32
|
+
255
|
33
|
+
190
|
34
|
+
8.0
|
35
|
+
0
|
36
|
+
50
|
37
|
+
0
|
38
|
+
9.0
|
39
|
+
40
|
40
|
+
200
|
41
|
+
40
|
42
|
+
80.0
|
43
|
+
0
|
44
|
+
120
|
45
|
+
0
|
46
|
+
90.0
|
47
|
+
183
|
48
|
+
232
|
49
|
+
176
|
wolfhece/pywalous.py
CHANGED
@@ -23,6 +23,123 @@ import wx.grid
|
|
23
23
|
from .PyTranslate import _
|
24
24
|
from .PyPalette import wolfpalette
|
25
25
|
|
26
|
+
"""
|
27
|
+
Hydrology classification for Land Use in Wallonia:
|
28
|
+
1 = forêt
|
29
|
+
2 = prairie
|
30
|
+
3 = culture
|
31
|
+
4 = pavés/urbain
|
32
|
+
5 = rivière
|
33
|
+
6 = plan d'eau
|
34
|
+
"""
|
35
|
+
|
36
|
+
HYDROLOGY_LANDUSE_FR = {"forêt" : 1.,
|
37
|
+
"prairie" : 2.,
|
38
|
+
"culture" : 3.,
|
39
|
+
"pavés/urbain" : 4.,
|
40
|
+
"rivière" : 5.,
|
41
|
+
"plan d'eau" : 6.,
|
42
|
+
}
|
43
|
+
|
44
|
+
HYDROLOGY_LANDUSE_EN = {"forest" : 1.,
|
45
|
+
"meadow" : 2.,
|
46
|
+
"crop" : 3.,
|
47
|
+
"paved/urban" : 4.,
|
48
|
+
"river" : 5.,
|
49
|
+
"water body" : 6.,
|
50
|
+
}
|
51
|
+
|
52
|
+
# WALOUS OCS
|
53
|
+
# ----------
|
54
|
+
|
55
|
+
"""
|
56
|
+
Extrait de https://metawal.wallonie.be/geonetwork/srv/api/records/86462606-4a21-49c8-ab9e-564ccba681b7/attachments/DescriptionLegende_WALOUS_OCS.pdf
|
57
|
+
|
58
|
+
1. Revêtement artificiel du sol: cette classe reprend tous les revêtements artificiels du sol
|
59
|
+
de nature peu ou pas perméable (ex béton, le bitume ou les pavés). Ceci comprend le réseau routier, les trottoirs, les terrasses, les parkings (les emplacements de parking semiperméables non végétalisés sont également dans cette catégorie) et les terrains ou pistes de sport en matériaux synthétiques.
|
60
|
+
2. Constructions artificielles hors sol : cette classe reprend tous les bâtiments et autres constructions s'élevant au-dessus du sol.
|
61
|
+
3. Réseau ferroviaire : cette classe reprend les rails et ballasts des chemins de fer encore en activité (les RaVEL entre dans la classe 1). Cette classe se différencie de la classe 1 par sa grande perméabilité.
|
62
|
+
4. Sols nus : cette classe inclut tout type de roche mère n'étant couverte par des végétaux supérieurs à aucun moment de l'année. Ces sols sont soit naturels (roches affleurantes, falaises, berges caillouteuses…), soit générés par l'activité humaine (extraction, sols compactés, coupe à blanc de l'année…)
|
63
|
+
5. Eaux de surface : cette classe comprend toutes les surfaces d'eau libre, naturelles ou artificielles. Ceci inclut donc à la fois les cours d'eau (rivières, fleuves et canaux) et les plans d'eau (mares, étangs, lacs, bassins de décantation, piscines extérieures).
|
64
|
+
6. Couvert herbacé en rotation : cette classe reprend les parcelles combinant un couvert herbacé une partie de l'année et un sol nu temporairement mis à nu. On y retrouve toutes les cultures annuelles, ainsi que les prairies temporaires succédant à une culture annuelle.
|
65
|
+
7. Couvert herbacé continu : cette classe reprend tous les sols recouverts par de la végétation herbacée tout au long de l'année. Cette végétation peut être d'origine naturelle (landes, mégaphorbiaies, tourbières, pelouses naturelles, végétation rudérale recolonisant une friche ou une ancienne coupe à blanc…), agricole (prés et prairies non labourés dans la saison) ou artificielle (jardin, terrains de sport, parcs…)
|
66
|
+
8. Arbres résineux : cette classe comprend tous les arbres de plus de 3 m (isolés, en haie ou en peuplement) du groupe des résineux (gymnosperme).
|
67
|
+
9. Arbres feuillus : cette classe comprend tous les arbres de plus de 3 m (isolés, en haie ou en peuplement) du groupe des feuillus (angiosperme).
|
68
|
+
80. Arbustes résineux : cette classe comprend tous les arbres et arbustes de moins de 3 m (isolés, en haie ou en peuplement) du groupe des résineux (gymnosperme).
|
69
|
+
90. Arbustes feuillus : cette classe comprend tous les arbres et arbuste de moins de 3 m (isolés, en haie ou en peuplement) du groupe des feuillus (angiosperme).
|
70
|
+
|
71
|
+
|
72
|
+
<paletteEntry color="#8a8a8a" value="1" alpha="255" label="Revêtement artificiel au sol"/>
|
73
|
+
<paletteEntry color="#dc0f0f" value="2" alpha="255" label="Constructions artificielles hors sol"/>
|
74
|
+
<paletteEntry color="#4e4e4e" value="3" alpha="255" label="Réseau ferroviaire"/>
|
75
|
+
<paletteEntry color="#d0d0d0" value="4" alpha="255" label="Sols nus"/>
|
76
|
+
<paletteEntry color="#2461f7" value="5" alpha="255" label="Eaux de surface"/>
|
77
|
+
<paletteEntry color="#ffff73" value="6" alpha="255" label="Couvert herbacé en rotation dans l'année (ex: culture annuelle)"/>
|
78
|
+
<paletteEntry color="#e9ffbe" value="7" alpha="255" label="Couvert herbacé toute l'année"/>
|
79
|
+
<paletteEntry color="#003200" value="8" alpha="255" label="Résineux (> 3m)"/>
|
80
|
+
<paletteEntry color="#007800" value="80" alpha="255" label="Résineux (≤ 3m)"/>
|
81
|
+
<paletteEntry color="#28c828" value="9" alpha="255" label="Feuillus (> 3m)"/>
|
82
|
+
<paletteEntry color="#b7e8b0" value="90" alpha="255" label="Feuillus (≤ 3m)"/>
|
83
|
+
<paletteEntry color="#e5ea3f" value="0" alpha="0" label="Pas de données"/>
|
84
|
+
"""
|
85
|
+
|
86
|
+
WALOUS_OCS = { "Revêtement artificiel au sol": 1.,
|
87
|
+
"Constructions artificielles hors sol": 2.,
|
88
|
+
"Réseau ferroviaire": 3.,
|
89
|
+
"Sols nus": 4.,
|
90
|
+
"Eaux de surface": 5.,
|
91
|
+
"Couvert herbacé en rotation dans l'année": 6.,
|
92
|
+
"Couvert herbacé toute l'année": 7.,
|
93
|
+
"Arbres résineux (>= 3m)": 8.,
|
94
|
+
"Arbres feuillus (>= 3m)": 9.,
|
95
|
+
"Arbustes résineux (< 3m)": 80.,
|
96
|
+
"Arbustes feuillus (< 3m)": 90.}
|
97
|
+
|
98
|
+
WALOUS_OCS_COLORMAP = {
|
99
|
+
0.: (229, 234, 63, 0), # #e5ea3f Pas de données
|
100
|
+
1.: (138, 138, 138, 255), # #8a8a8a Revêtement artificiel au sol
|
101
|
+
2.: (220, 15, 15, 255), # #dc0f0f Constructions artificielles hors sol
|
102
|
+
3.: (78, 78, 78, 255), # #4e4e4e Réseau ferroviaire
|
103
|
+
4.: (208, 208, 208, 255), # #d0d0d0 Sols nus
|
104
|
+
5.: (36, 97, 247, 255), # #2461f7 Eaux de surface
|
105
|
+
6.: (255, 255, 115, 255), # #ffff73 Couvert herbacé en rotation
|
106
|
+
7.: (233, 255, 190, 255), # #e9ffbe Couvert herbacé continu
|
107
|
+
8.: (0, 50, 0, 255), # #003200 Arbres résineux (> 3m)
|
108
|
+
9.: (40, 200, 40, 255), # #28c828 Arbres feuillus (> 3m)
|
109
|
+
80.: (0, 120, 0, 255), # #007800 Arbustes résineux (≤ 3m)
|
110
|
+
90.: (183, 232, 176, 255), # #b7e8b0 Arbustes feuillus (≤ 3m)
|
111
|
+
}
|
112
|
+
|
113
|
+
WALOUS_OCS2MANNING = {1.: 0.02, # Revêtement artificiel au sol
|
114
|
+
2.: 0.025, # Constructions artificielles hors sol
|
115
|
+
3.: 0.04, # Réseau ferroviaire
|
116
|
+
4.: 0.04, # Sols nus
|
117
|
+
5.: 0.033, # Eaux de surface
|
118
|
+
6.: 0.04, # Couvert herbacé en rotation dans l'année
|
119
|
+
7.: 0.03, # Couvert herbacé toute l'année
|
120
|
+
8.: 0.04, # Résineux (> 3m)
|
121
|
+
9.: 0.04, # Feuillus (> 3m)
|
122
|
+
80.: 0.03, # Résineux (≤ 3m)
|
123
|
+
90.: 0.03, # Feuillus (≤ 3m)
|
124
|
+
}
|
125
|
+
|
126
|
+
|
127
|
+
WALOUS_OCS2HYDROLOGY = {1.: 4., # Revêtement artificiel au sol
|
128
|
+
2.: 4., # Constructions artificielles hors sol
|
129
|
+
3.: 4., # Réseau ferroviaire
|
130
|
+
4.: 4., # Sols nus
|
131
|
+
5.: 5., # Eaux de surface
|
132
|
+
6.: 3., # Couvert herbacé en rotation dans l'année
|
133
|
+
7.: 2., # Couvert herbacé toute l'année
|
134
|
+
8.: 1., # Résineux (> 3m)
|
135
|
+
9.: 1., # Feuillus (> 3m)
|
136
|
+
80.: 3., # Arbustes résineux (< 3m)
|
137
|
+
90.: 3. # Arbustes feuillus (< 3m)
|
138
|
+
}
|
139
|
+
|
140
|
+
# WALOUS UTS
|
141
|
+
# ----------
|
142
|
+
|
26
143
|
WALOUS_UTS_MAJ_NIV1 = {'Production primaire': 1.,
|
27
144
|
'Production secondaire': 2.,
|
28
145
|
'Production tertiaire': 3.,
|
@@ -85,59 +202,37 @@ WALOUS_UTS_COLORMAP_MAJ_NIV2 = {11.: (153,230,0,255),
|
|
85
202
|
66.: (206,136,102,255),
|
86
203
|
70.: (255,255,190,255)}
|
87
204
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
"Eaux de surface": 8.,
|
96
|
-
"Revêtement artificiels au sol": 9.,
|
97
|
-
"Réseau ferroviaire": 10.,
|
98
|
-
"Constructions artificielles hors sol": 11.}
|
99
|
-
|
100
|
-
WALOUS_OCS_COLORMAP = {1.: (255,254,162,255), # Couvert herbacé en rotation dans l'année
|
101
|
-
2.: (253,254,194,255), # Couvert herbacé toute l'année
|
102
|
-
3.: (3,49,5,255), # Résineux (>3 m)
|
103
|
-
4.: (55,198,61,255), # Feuillus (> 3m)
|
104
|
-
5.: (18,119,23,255), # Résineux (<= 3m)
|
105
|
-
6.: (185,231,179,255), # Feuillus (<= 3m)
|
106
|
-
7.: (208,208,208,255), # Sols nus
|
107
|
-
8.: (45,101,242,255), # Eaux de surface
|
108
|
-
9.: (138,138,138,255), # Revêtement artificiels au sol
|
109
|
-
10.: (78,78,78,255), # Réseau ferroviaire
|
110
|
-
11.: (199,22,19,255), # Constructions artificielles hors sol
|
111
|
-
}
|
112
|
-
|
113
|
-
HYDROLOGY_LANDUSE_FR = {"forêt" : 1.,
|
114
|
-
"prairie" : 2.,
|
115
|
-
"culture" : 3.,
|
116
|
-
"pavés/urbain" : 4.,
|
117
|
-
"rivière" : 5.,
|
118
|
-
"plan d'eau" : 6.,
|
119
|
-
}
|
205
|
+
WALOUS_UTS2MANNING_MAJ_NIV1 = {1.: 0.04, # Production primaire
|
206
|
+
2.: 0.02, # Production secondaire
|
207
|
+
3.: 0.02, # Production tertiaire
|
208
|
+
4.: 0.03, # Réseaux de transport, Logistique et réseaux d'utilité publique
|
209
|
+
5.: 0.025,# Usage résidentiel
|
210
|
+
6.: 0.04, # Autres usages
|
211
|
+
7.: 0.05} # Zones naturelles
|
120
212
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
213
|
+
WALOUS_UTS2MANNING_MAJ_NIV2 = {11.: 0.04, # Agriculture
|
214
|
+
12.: 0.04, # Sylviculture
|
215
|
+
13.: 0.04, # Industries Extractives
|
216
|
+
14.: 0.04, # Aquaculture et pêche
|
217
|
+
20.: 0.03, # Production secondaire non définie
|
218
|
+
21.: 0.03, # Industrie de matières premières
|
219
|
+
22.: 0.03, # Industrie lourde
|
220
|
+
23.: 0.03, # Industrie légère
|
221
|
+
24.: 0.03, # Production d'énergie
|
222
|
+
31.: 0.02, # Service commerciaux
|
223
|
+
32.: 0.02, # Services financiers, spécialisés et d'information
|
224
|
+
33.: 0.02, # Services publics
|
225
|
+
34.: 0.02, # Services culturels, Services de loisirs et Services récréatifs
|
226
|
+
41.: 0.025, # Réseaux de transport
|
227
|
+
42.: 0.02, # Services Logistiques et d'entreposage
|
228
|
+
43.: 0.025, # Réseau d'utilité publique
|
229
|
+
51.: 0.025, # Usage résidentiel permanent
|
230
|
+
52.: 0.025, # Usage résidentiel avec d'autres usages compatibles
|
231
|
+
53.: 0.025, # Autres usages résidentiels
|
232
|
+
62.: 0.04, # Zones abandonnées
|
233
|
+
66.: 0.04, # Usage inconnu
|
234
|
+
70.: 0.05} # Zones naturelles
|
128
235
|
|
129
|
-
MAPPING_WALOUS_TO_HYDROLOGY = {1.: 2., # Couvert herbacé en rotation dans l'année
|
130
|
-
2.: 2., # Couvert herbacé toute l'année
|
131
|
-
3.: 1., # Résineux (>3 m)
|
132
|
-
4.: 1., # Feuillus (> 3m)
|
133
|
-
5.: 3., # Résineux (<= 3m)
|
134
|
-
6.: 3., # Feuillus (<= 3m)
|
135
|
-
7.: 3., # Sols nus
|
136
|
-
8.: 5., # Eaux de surface
|
137
|
-
9.: 4., # Revêtement artificiels au sol
|
138
|
-
10.: 4., # Constructions artificielles hors sol
|
139
|
-
11.: 4., # Réseau ferroviaire
|
140
|
-
}
|
141
236
|
|
142
237
|
def get_palette_walous_uts(which:Literal['MAJ_NIV1', 'MAJ_NIV2']) -> wolfpalette:
|
143
238
|
"""
|
@@ -177,7 +272,7 @@ def get_palette_walous_ocs() -> wolfpalette:
|
|
177
272
|
|
178
273
|
return locpal
|
179
274
|
|
180
|
-
def update_palette_walous_uts(which:Literal['
|
275
|
+
def update_palette_walous_uts(which:Literal['UTS_MAJ_NIV1', 'UTS_MAJ_NIV2'], pal:wolfpalette):
|
181
276
|
"""
|
182
277
|
Update the palette for WALOUS MAJ_NIV1
|
183
278
|
|
@@ -185,13 +280,13 @@ def update_palette_walous_uts(which:Literal['MAJ_NIV1', 'MAJ_NIV2'], pal:wolfpal
|
|
185
280
|
:return : updated palette
|
186
281
|
"""
|
187
282
|
|
188
|
-
if which
|
283
|
+
if which in ['UTS_MAJ_NIV1', 'MAJ_NIV1']:
|
189
284
|
for k, v in WALOUS_UTS_COLORMAP_MAJ_NIV1.items():
|
190
|
-
pal.set_values_colors(values = list(WALOUS_UTS_MAJ_NIV1.values()),
|
285
|
+
pal.set_values_colors(values = [val - 1e-6 for val in list(WALOUS_UTS_MAJ_NIV1.values())],
|
191
286
|
colors = list(WALOUS_UTS_COLORMAP_MAJ_NIV1.values()))
|
192
|
-
elif which
|
287
|
+
elif which in ['UTS_MAJ_NIV2', 'MAJ_NIV2']:
|
193
288
|
for k, v in WALOUS_UTS_COLORMAP_MAJ_NIV2.items():
|
194
|
-
pal.set_values_colors(values = list(WALOUS_UTS_MAJ_NIV2.values()),
|
289
|
+
pal.set_values_colors(values = [val - 1e-6 for val in list(WALOUS_UTS_MAJ_NIV2.values())],
|
195
290
|
colors = list(WALOUS_UTS_COLORMAP_MAJ_NIV2.values()))
|
196
291
|
|
197
292
|
pal.interval_cst = True
|
@@ -208,7 +303,7 @@ def update_palette_walous_ocs(pal:wolfpalette):
|
|
208
303
|
"""
|
209
304
|
|
210
305
|
for k, v in WALOUS_OCS_COLORMAP.items():
|
211
|
-
pal.set_values_colors(values = list(WALOUS_OCS_COLORMAP.keys()),
|
306
|
+
pal.set_values_colors(values = [val - 1e-6 for val in list(WALOUS_OCS_COLORMAP.keys())],
|
212
307
|
colors = list(WALOUS_OCS_COLORMAP.values()))
|
213
308
|
|
214
309
|
pal.interval_cst = True
|
@@ -217,71 +312,6 @@ def update_palette_walous_ocs(pal:wolfpalette):
|
|
217
312
|
return 0
|
218
313
|
|
219
314
|
|
220
|
-
WALOUS2MANNING_MAJ_NIV1 = {1.: 0.04, # Production primaire
|
221
|
-
2.: 0.02, # Production secondaire
|
222
|
-
3.: 0.02, # Production tertiaire
|
223
|
-
4.: 0.03, # Réseaux de transport, Logistique et réseaux d'utilité publique
|
224
|
-
5.: 0.025,# Usage résidentiel
|
225
|
-
6.: 0.04, # Autres usages
|
226
|
-
7.: 0.05} # Zones naturelles
|
227
|
-
|
228
|
-
WALOUS2MANNING_MAJ_NIV2 = {11.: 0.04, # Agriculture
|
229
|
-
12.: 0.04, # Sylviculture
|
230
|
-
13.: 0.04, # Industries Extractives
|
231
|
-
14.: 0.04, # Aquaculture et pêche
|
232
|
-
20.: 0.03, # Production secondaire non définie
|
233
|
-
21.: 0.03, # Industrie de matières premières
|
234
|
-
22.: 0.03, # Industrie lourde
|
235
|
-
23.: 0.03, # Industrie légère
|
236
|
-
24.: 0.03, # Production d'énergie
|
237
|
-
31.: 0.02, # Service commerciaux
|
238
|
-
32.: 0.02, # Services financiers, spécialisés et d'information
|
239
|
-
33.: 0.02, # Services publics
|
240
|
-
34.: 0.02, # Services culturels, Services de loisirs et Services récréatifs
|
241
|
-
41.: 0.025, # Réseaux de transport
|
242
|
-
42.: 0.02, # Services Logistiques et d'entreposage
|
243
|
-
43.: 0.025, # Réseau d'utilité publique
|
244
|
-
51.: 0.025, # Usage résidentiel permanent
|
245
|
-
52.: 0.025, # Usage résidentiel avec d'autres usages compatibles
|
246
|
-
53.: 0.025, # Autres usages résidentiels
|
247
|
-
62.: 0.04, # Zones abandonnées
|
248
|
-
66.: 0.04, # Usage inconnu
|
249
|
-
70.: 0.05} # Zones naturelles
|
250
|
-
|
251
|
-
WALOUSOCS2MANNING = {1.: 0.04, # Couvert herbacé en rotation dans l'année
|
252
|
-
2.: 0.04, # Couvert herbacé toute l'année
|
253
|
-
3.: 0.04, # Résineux (>3 m)
|
254
|
-
4.: 0.04, # Feuillus (> 3m)
|
255
|
-
5.: 0.04, # Résineux (<= 3m)
|
256
|
-
6.: 0.04, # Feuillus (<= 3m)
|
257
|
-
7.: 0.02, # Sols nus
|
258
|
-
8.: 0.033, # Eaux de surface
|
259
|
-
9.: 0.02, # Revêtement artificiels au sol
|
260
|
-
10.: 0.02, # Réseau ferroviaire
|
261
|
-
11.: 0.02} # Constructions artificielles hors sol
|
262
|
-
|
263
|
-
"""
|
264
|
-
Hydrology classification for Land Use in Wallonia:
|
265
|
-
1 = forêt
|
266
|
-
2 = prairie
|
267
|
-
3 = culture
|
268
|
-
4 = pavés/urbain
|
269
|
-
5 = rivière
|
270
|
-
6 = plan d'eau
|
271
|
-
"""
|
272
|
-
WALOUS2HYDROLOGY = {1.: 2, # Couvert herbacé en rotation dans l'année
|
273
|
-
2.: 2, # Couvert herbacé toute l'année
|
274
|
-
3.: 1, # Résineux (>3 m)
|
275
|
-
4.: 1, # Feillus (> 3m)
|
276
|
-
5.: 3, # Résineux (<= 3m)
|
277
|
-
6.: 3, # Feuillus (<= 3m)
|
278
|
-
7.: 4, # Sols nus
|
279
|
-
8.: 5, # Eaux de surface
|
280
|
-
9.: 4, # Revêtement artificiels au sol
|
281
|
-
10.: 4, # Réseau ferroviaire
|
282
|
-
11.: 4, # Constructions artificielles hors sol
|
283
|
-
}
|
284
|
-
|
285
315
|
class Walous_data():
|
286
316
|
"""
|
287
317
|
La donnée Walous est liée à l'utilisation des sols en Wallonie
|
@@ -297,18 +327,21 @@ class Walous_data():
|
|
297
327
|
def __init__(self,
|
298
328
|
dir_data:str = '',
|
299
329
|
fn:str = 'WAL_UTS__2018_L72',
|
330
|
+
extension:str = '.shp',
|
300
331
|
bounds:Union[list[float, float, float, float],list[list[float, float], list[float, float]]] = None) -> None:
|
301
332
|
"""
|
302
333
|
Constructor
|
303
334
|
|
304
335
|
:param dir_data : directory of the data
|
305
|
-
:param fn : filename without extension
|
336
|
+
:param fn : filename without extension
|
337
|
+
:param extension : extension of the file (.shp, .gpkg, ...)
|
306
338
|
:param bounds : Two ways to set spatial bounds -- [xmin, ymin, xmax, ymax] or [[xmin, xmax], [ymin, ymax]]
|
307
339
|
|
308
340
|
"""
|
309
341
|
|
310
342
|
self._dir = dir_data # directory of the data
|
311
343
|
self._fn = fn # filename without extension
|
344
|
+
self._extension = extension # extension of the file
|
312
345
|
self._gdf = None # geopandas dataframe
|
313
346
|
|
314
347
|
if bounds is not None:
|
@@ -328,7 +361,7 @@ class Walous_data():
|
|
328
361
|
if self._gdf is None or force:
|
329
362
|
assert self._dir!="" and self._fn != ''
|
330
363
|
|
331
|
-
filepath = (Path(self._dir)/ self._fn).with_suffix(
|
364
|
+
filepath = (Path(self._dir)/ self._fn).with_suffix(self._extension)
|
332
365
|
|
333
366
|
if filepath.exists():
|
334
367
|
if bounds is not None:
|
@@ -390,15 +423,15 @@ class Walous_data():
|
|
390
423
|
|
391
424
|
def rasterize(self,
|
392
425
|
bounds:Union[list[float, float, float, float],list[list[float, float], list[float, float]]],
|
393
|
-
layer:Literal['
|
426
|
+
layer:Literal['UTS_MAJ_NIV1','UTS_MAJ_NIV2'] = 'UTS_MAJ_NIV1',
|
394
427
|
fn_out:str = 'out.tif',
|
395
428
|
pixel_size:float = 0.5,
|
396
429
|
NoData_value:float = -99999.,
|
397
|
-
num_type = gdal.GDT_Float32
|
430
|
+
num_type = gdal.GDT_Float32,
|
398
431
|
):
|
399
432
|
|
400
433
|
"""
|
401
|
-
Rasterization of polygon data to tif
|
434
|
+
Rasterization of polygon data to tif.
|
402
435
|
|
403
436
|
:param bounds : [xmin, ymin, xmax, ymax] or [[xmin, xmax], [ymin, ymax]]
|
404
437
|
:param layer : layer to rasterize
|
@@ -408,6 +441,8 @@ class Walous_data():
|
|
408
441
|
:param num_type : type of the number
|
409
442
|
"""
|
410
443
|
|
444
|
+
layer = layer.upper().replace('UTS_', '')
|
445
|
+
|
411
446
|
if bounds is None:
|
412
447
|
logging.error('Bounds must be set')
|
413
448
|
return None
|
@@ -438,10 +473,10 @@ class Walous_data():
|
|
438
473
|
try:
|
439
474
|
|
440
475
|
# Add a new column for mapping based on the desired layer
|
441
|
-
self._gdf['Mapping'] = np.float32(self._gdf[layer])
|
442
|
-
|
443
476
|
if layer == 'MAJ_NIV2':
|
444
|
-
self._gdf['Mapping'] = np.float32(self._gdf[
|
477
|
+
self._gdf['Mapping'] = np.float32(self._gdf[layer].replace('_', ''))
|
478
|
+
else:
|
479
|
+
self._gdf['Mapping'] = np.float32(self._gdf[layer])
|
445
480
|
|
446
481
|
source_ds:ogr.DataSource
|
447
482
|
source_layer:ogr.Layer
|
@@ -485,7 +520,7 @@ class Walous_data():
|
|
485
520
|
class DlgMapWalous2Manning(wx.Dialog):
|
486
521
|
""" Modal dialog for mapping WALOUS value to another ones """
|
487
522
|
|
488
|
-
def __init__(self, parent, title:str = _("Mapping WALOUS value to ..."), which:
|
523
|
+
def __init__(self, parent, title:str = _("Mapping WALOUS value to ..."), which:Literal['UTS_MAJ_NIV1', 'UTS_MAJ_NIV2', 'OCS_MANNING', 'OCS_HYDROLOGY'] = 'UTS_MAJ_NIV1'):
|
489
524
|
|
490
525
|
super(DlgMapWalous2Manning, self).__init__(parent, title=title, size=(450, 400))
|
491
526
|
|
@@ -495,7 +530,7 @@ class DlgMapWalous2Manning(wx.Dialog):
|
|
495
530
|
|
496
531
|
self._table = wx.grid.Grid(panel)
|
497
532
|
|
498
|
-
if which == '
|
533
|
+
if which == 'UTS_MAJ_NIV1':
|
499
534
|
self._table.CreateGrid(len(WALOUS_UTS_MAJ_NIV1), 3)
|
500
535
|
self._table.SetColLabelValue(0, _("Name"))
|
501
536
|
self._table.SetColLabelValue(1, _("Value - UTS"))
|
@@ -505,11 +540,11 @@ class DlgMapWalous2Manning(wx.Dialog):
|
|
505
540
|
for i, (k, v) in enumerate(WALOUS_UTS_MAJ_NIV1.items()):
|
506
541
|
self._table.SetCellValue(i, 0, str(k))
|
507
542
|
self._table.SetCellValue(i, 1, str(v))
|
508
|
-
self._table.SetCellValue(i, 2, str(
|
543
|
+
self._table.SetCellValue(i, 2, str(WALOUS_UTS2MANNING_MAJ_NIV1[v]))
|
509
544
|
self._table.SetCellAlignment(i, 1, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
|
510
545
|
self._table.SetCellAlignment(i, 2, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
|
511
546
|
|
512
|
-
elif which == '
|
547
|
+
elif which == 'UTS_MAJ_NIV2':
|
513
548
|
self._table.CreateGrid(len(WALOUS_UTS_MAJ_NIV2), 3)
|
514
549
|
self._table.SetColLabelValue(0, _("Name"))
|
515
550
|
self._table.SetColLabelValue(1, _("Value - UTS"))
|
@@ -519,7 +554,33 @@ class DlgMapWalous2Manning(wx.Dialog):
|
|
519
554
|
for i, (k, v) in enumerate(WALOUS_UTS_MAJ_NIV2.items()):
|
520
555
|
self._table.SetCellValue(i, 0, str(k))
|
521
556
|
self._table.SetCellValue(i, 1, str(v))
|
522
|
-
self._table.SetCellValue(i, 2, str(
|
557
|
+
self._table.SetCellValue(i, 2, str(WALOUS_UTS2MANNING_MAJ_NIV2[v]))
|
558
|
+
self._table.SetCellAlignment(i, 1, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
|
559
|
+
self._table.SetCellAlignment(i, 2, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
|
560
|
+
|
561
|
+
elif which == 'OCS_MANNING':
|
562
|
+
self._table.CreateGrid(len(WALOUS_OCS2MANNING), 3)
|
563
|
+
self._table.SetColLabelValue(0, _("Name"))
|
564
|
+
self._table.SetColLabelValue(1, _("Value - OCS"))
|
565
|
+
self._table.SetColLabelValue(2, _("Manning 'n'"))
|
566
|
+
self._table.HideRowLabels()
|
567
|
+
for i, (k, v) in enumerate(WALOUS_OCS.items()):
|
568
|
+
self._table.SetCellValue(i, 0, str(k))
|
569
|
+
self._table.SetCellValue(i, 1, str(v))
|
570
|
+
self._table.SetCellValue(i, 2, str(WALOUS_OCS2MANNING[v]))
|
571
|
+
self._table.SetCellAlignment(i, 1, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
|
572
|
+
self._table.SetCellAlignment(i, 2, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
|
573
|
+
|
574
|
+
elif which == 'OCS_HYDROLOGY':
|
575
|
+
self._table.CreateGrid(len(WALOUS_OCS2HYDROLOGY), 3)
|
576
|
+
self._table.SetColLabelValue(0, _("Name"))
|
577
|
+
self._table.SetColLabelValue(1, _("Value - OCS"))
|
578
|
+
self._table.SetColLabelValue(2, _("LandUse - Hydrology"))
|
579
|
+
self._table.HideRowLabels()
|
580
|
+
for i, (k, v) in enumerate(WALOUS_OCS2HYDROLOGY.items()):
|
581
|
+
self._table.SetCellValue(i, 0, str(k))
|
582
|
+
self._table.SetCellValue(i, 1, str(v))
|
583
|
+
self._table.SetCellValue(i, 2, str(WALOUS_OCS2HYDROLOGY[v]))
|
523
584
|
self._table.SetCellAlignment(i, 1, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
|
524
585
|
self._table.SetCellAlignment(i, 2, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
|
525
586
|
|
@@ -575,11 +636,11 @@ class DlgMapWalousOCS2Manning(DlgMapWalous2Manning):
|
|
575
636
|
|
576
637
|
def __init__(self, parent, title:str = _("Mapping WALOUS value to ...")):
|
577
638
|
|
578
|
-
super(DlgMapWalousOCS2Manning, self).__init__(parent, title= title)
|
639
|
+
super(DlgMapWalousOCS2Manning, self).__init__(parent, title= title, which='OCS_MANNING')
|
579
640
|
|
580
641
|
self._table.SetColLabelValue(2, _("Land Use - OCS"))
|
581
642
|
|
582
|
-
for i, (k, v) in enumerate(
|
643
|
+
for i, (k, v) in enumerate(WALOUS_OCS2MANNING.items()):
|
583
644
|
self._table.SetColLabelValue(1, _("Value - OCS"))
|
584
645
|
self._table.SetCellValue(i, 2, str(v))
|
585
646
|
|
@@ -593,11 +654,11 @@ class DlgMapWalous2Hydrology(DlgMapWalous2Manning):
|
|
593
654
|
|
594
655
|
def __init__(self, parent, title:str = _("Mapping WALOUS value to ...")):
|
595
656
|
|
596
|
-
super(DlgMapWalous2Hydrology, self).__init__(parent, title= title)
|
657
|
+
super(DlgMapWalous2Hydrology, self).__init__(parent, title= title, which='OCS_HYDROLOGY')
|
597
658
|
|
598
659
|
self._table.SetColLabelValue(2, _("Land Use - OCS"))
|
599
660
|
|
600
|
-
for i, (k, v) in enumerate(
|
661
|
+
for i, (k, v) in enumerate(WALOUS_OCS2HYDROLOGY.items()):
|
601
662
|
self._table.SetColLabelValue(1, _("Value - OCS"))
|
602
663
|
self._table.SetCellValue(i, 2, str(v))
|
603
664
|
|
wolfhece/wolf_array.py
CHANGED
@@ -116,6 +116,30 @@ try:
|
|
116
116
|
except ImportError as e:
|
117
117
|
raise Exception(_('Error importing pydownloader module'))
|
118
118
|
|
119
|
+
|
120
|
+
import math
|
121
|
+
from fractions import Fraction
|
122
|
+
|
123
|
+
def pgcd_decimal(a, b):
|
124
|
+
# Convertir les décimaux en fractions exactes
|
125
|
+
fa = Fraction(a).limit_denominator()
|
126
|
+
fb = Fraction(b).limit_denominator()
|
127
|
+
|
128
|
+
# Extraire les numérateurs et dénominateurs
|
129
|
+
num_a, den_a = fa.numerator, fa.denominator
|
130
|
+
num_b, den_b = fb.numerator, fb.denominator
|
131
|
+
|
132
|
+
# Mettre au même dénominateur
|
133
|
+
lcm_den = math.lcm(den_a, den_b)
|
134
|
+
a_int = num_a * (lcm_den // den_a)
|
135
|
+
b_int = num_b * (lcm_den // den_b)
|
136
|
+
|
137
|
+
# PGCD des entiers
|
138
|
+
pgcd_int = math.gcd(a_int, b_int)
|
139
|
+
|
140
|
+
# Revenir à l’échelle décimale
|
141
|
+
return pgcd_int / lcm_den
|
142
|
+
|
119
143
|
WOLF_ARRAY_HILLSHAPE = -1
|
120
144
|
WOLF_ARRAY_FULL_SINGLE = 1
|
121
145
|
WOLF_ARRAY_FULL_DOUBLE = 2
|
@@ -7288,6 +7312,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7288
7312
|
else:
|
7289
7313
|
return
|
7290
7314
|
|
7315
|
+
need_wx = False
|
7316
|
+
|
7291
7317
|
raster:gdal.Dataset
|
7292
7318
|
if crop is not None :
|
7293
7319
|
if not os.path.exists(fn):
|
@@ -7297,44 +7323,47 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7297
7323
|
tmpdx = self.dx
|
7298
7324
|
|
7299
7325
|
fn_crop = fn + '_crop.tif'
|
7300
|
-
if type(crop) is np.ndarray:
|
7301
|
-
pass
|
7302
|
-
elif type(crop) is list:
|
7303
|
-
pass
|
7304
|
-
else:
|
7305
|
-
if not self.wx_exists:
|
7306
|
-
logging.error(_('Crop must be a list or a numpy array with 4 values - xmin, xmax, ymin, ymax'))
|
7307
|
-
return
|
7308
7326
|
|
7309
|
-
|
7310
|
-
|
7327
|
+
raster_in:gdal.Dataset
|
7328
|
+
raster_in = gdal.Open(fn)
|
7311
7329
|
|
7312
|
-
|
7313
|
-
|
7314
|
-
|
7315
|
-
|
7330
|
+
proj = raster_in.GetProjection()
|
7331
|
+
# check if proj is epsg:31370
|
7332
|
+
if 'Lambert 72' not in proj and "31370" not in proj:
|
7333
|
+
logging.error(_('{} projection is not Lambert 72 - EPSG:31370').format(fn))
|
7316
7334
|
|
7317
|
-
|
7318
|
-
|
7335
|
+
raster_in2 = gdal.Dataset()
|
7336
|
+
gdal.Warp(raster_in2, raster_in, dstSRS='EPSG:31370')
|
7319
7337
|
|
7320
|
-
|
7321
|
-
|
7322
|
-
|
7338
|
+
# Close the raster_in
|
7339
|
+
raster_in.FlushCache()
|
7340
|
+
raster_in = None
|
7323
7341
|
|
7324
|
-
|
7342
|
+
raster_in = raster_in2
|
7325
7343
|
|
7326
|
-
|
7327
|
-
|
7328
|
-
|
7344
|
+
if raster_in is None:
|
7345
|
+
logging.error(_('Could not reproject the file {fn}'))
|
7346
|
+
return
|
7329
7347
|
|
7330
|
-
|
7331
|
-
|
7332
|
-
|
7348
|
+
geotr = raster_in.GetGeoTransform()
|
7349
|
+
self.dx = geotr[1]
|
7350
|
+
self.dy = abs(geotr[5])
|
7333
7351
|
|
7334
|
-
|
7335
|
-
|
7336
|
-
|
7337
|
-
|
7352
|
+
ulx = geotr[0]
|
7353
|
+
uly = geotr[3]
|
7354
|
+
llx = ulx + geotr[1] * raster_in.RasterXSize
|
7355
|
+
lly = uly + geotr[5] * raster_in.RasterYSize
|
7356
|
+
|
7357
|
+
if type(crop) is np.ndarray:
|
7358
|
+
pass
|
7359
|
+
elif type(crop) in [list, tuple]:
|
7360
|
+
pass
|
7361
|
+
else:
|
7362
|
+
if not self.wx_exists:
|
7363
|
+
logging.error(_('Crop must be a list or a numpy array with 4 values - xmin, xmax, ymin, ymax'))
|
7364
|
+
return
|
7365
|
+
|
7366
|
+
need_wx = True
|
7338
7367
|
|
7339
7368
|
newcrop = CropDialog(None, self.get_mapviewer())
|
7340
7369
|
|
@@ -7375,7 +7404,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7375
7404
|
|
7376
7405
|
xmin, xmax, ymin, ymax = crop
|
7377
7406
|
|
7378
|
-
if
|
7407
|
+
if need_wx:
|
7379
7408
|
|
7380
7409
|
with wx.FileDialog(None, _('Save the cropped file for later'), wildcard="Tiff files (*.tif)|*.tif",
|
7381
7410
|
style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) as fileDialog:
|
@@ -7393,15 +7422,13 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7393
7422
|
|
7394
7423
|
fn = fn_crop
|
7395
7424
|
else:
|
7396
|
-
|
7397
|
-
tmpfile = NamedTemporaryFile(suffix='.tif')
|
7425
|
+
fn_tmp = '__tmp_wolf.tif'
|
7398
7426
|
|
7399
7427
|
if uly > lly:
|
7400
|
-
raster = gdal.Translate(
|
7428
|
+
raster = gdal.Translate(fn_tmp, fn, projWin=[xmin, ymax, xmax, ymin])
|
7401
7429
|
else:
|
7402
|
-
raster = gdal.Translate(
|
7403
|
-
|
7404
|
-
fn = str(tmpfile.name)
|
7430
|
+
raster = gdal.Translate(fn_tmp, fn, projWin=[xmin, ymin, xmax, ymax])
|
7431
|
+
fn = fn_tmp
|
7405
7432
|
else:
|
7406
7433
|
raster = gdal.Open(fn)
|
7407
7434
|
|
@@ -7501,6 +7528,12 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7501
7528
|
raster.FlushCache()
|
7502
7529
|
raster = None
|
7503
7530
|
|
7531
|
+
try:
|
7532
|
+
if fn_tmp == '__tmp_wolf.tif':
|
7533
|
+
os.remove(fn_tmp)
|
7534
|
+
except:
|
7535
|
+
pass
|
7536
|
+
|
7504
7537
|
def add_ops_sel(self):
|
7505
7538
|
"""
|
7506
7539
|
Adding selection manager and operations array
|
@@ -10254,7 +10287,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10254
10287
|
self.write_txt_header()
|
10255
10288
|
self.write_array()
|
10256
10289
|
|
10257
|
-
def get_rebin_shape_size(self, factor:float) -> tuple[tuple[int, int], tuple[float, float]]:
|
10290
|
+
def get_rebin_shape_size(self, factor:float, reshape_array_if_necessary:bool = False) -> tuple[tuple[int, int], tuple[float, float]]:
|
10258
10291
|
"""
|
10259
10292
|
Return the new shape after rebinning.
|
10260
10293
|
|
@@ -10274,13 +10307,44 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10274
10307
|
|
10275
10308
|
newnbx = self.nbx
|
10276
10309
|
newnby = self.nby
|
10277
|
-
|
10278
|
-
|
10279
|
-
|
10280
|
-
|
10281
|
-
|
10282
|
-
|
10283
|
-
newnby = self.nby
|
10310
|
+
|
10311
|
+
if factor >=1.0:
|
10312
|
+
# Decrease resolution
|
10313
|
+
to_reshape = False
|
10314
|
+
if np.mod(self.nbx,factor) != 0 or np.mod(self.nby,factor) != 0 :
|
10315
|
+
newnbx = self.nbx
|
10316
|
+
newnby = self.nby
|
10317
|
+
if np.mod(self.nbx,factor) !=0:
|
10318
|
+
newnbx = int(self.nbx + factor - np.mod(self.nbx,factor))
|
10319
|
+
to_reshape = True
|
10320
|
+
if np.mod(self.nby,factor) !=0:
|
10321
|
+
newnby = int(self.nby + factor - np.mod(self.nby,factor))
|
10322
|
+
to_reshape = True
|
10323
|
+
|
10324
|
+
if to_reshape and reshape_array_if_necessary:
|
10325
|
+
logging.warning(f"The shape ({self.nbx}, {self.nby}) is not a multiple of the factor {factor}")
|
10326
|
+
new_array = ma.masked_array(np.ones((newnbx, newnby), dtype= self.dtype) * self.nullvalue, dtype= self.dtype)
|
10327
|
+
new_array[:self.nbx, :self.nby] = self.array
|
10328
|
+
self.array = new_array
|
10329
|
+
else:
|
10330
|
+
# Increase resolution
|
10331
|
+
if abs(int(1/factor) - 1/factor) > 1e-6:
|
10332
|
+
# find the greatest common divisor of between self.dx and old_dx
|
10333
|
+
gcd = pgcd_decimal(self.dx, self.dx * factor)
|
10334
|
+
intermediate_factor = gcd / self.dx
|
10335
|
+
|
10336
|
+
[newnbx,newnby], [dx,dy] = self.get_rebin_shape_size(intermediate_factor)
|
10337
|
+
|
10338
|
+
factor = factor / intermediate_factor
|
10339
|
+
|
10340
|
+
if np.mod(newnbx,factor) != 0 or np.mod(newnby,factor) != 0 :
|
10341
|
+
if np.mod(newnbx,factor) !=0:
|
10342
|
+
newnbx = int(newnbx + factor - np.mod(newnbx,factor))
|
10343
|
+
if np.mod(newnby,factor) !=0:
|
10344
|
+
newnby = int(newnby + factor - np.mod(newnby,factor))
|
10345
|
+
|
10346
|
+
newdx = dx * factor
|
10347
|
+
newdy = dy * factor
|
10284
10348
|
|
10285
10349
|
newnbx = int(newnbx / factor)
|
10286
10350
|
newnby = int(newnby / factor)
|
@@ -10327,6 +10391,9 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10327
10391
|
|
10328
10392
|
"""
|
10329
10393
|
|
10394
|
+
op_str = operation
|
10395
|
+
(testnbx, testnby), __ = self.get_rebin_shape_size(factor)
|
10396
|
+
|
10330
10397
|
if operation_matrix is not None:
|
10331
10398
|
tmp_header = self.get_rebin_header(factor)
|
10332
10399
|
if not operation_matrix.is_like(tmp_header):
|
@@ -10348,36 +10415,11 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10348
10415
|
logging.error(_("Operator not supported -- Must be a string in ['sum', 'mean', 'min', 'max', 'median'] or a Rebin_Ops Enum"))
|
10349
10416
|
|
10350
10417
|
|
10351
|
-
|
10352
|
-
|
10353
|
-
|
10354
|
-
|
10355
|
-
|
10356
|
-
if np.mod(self.nbx,factor) !=0:
|
10357
|
-
newnbx = int(self.nbx + factor - np.mod(self.nbx,factor))
|
10358
|
-
if np.mod(self.nby,factor) !=0:
|
10359
|
-
newnby = int(self.nby + factor - np.mod(self.nby,factor))
|
10360
|
-
|
10361
|
-
# We ensure that the null_value is converted to the type of the array.
|
10362
|
-
# Not doing so leads to a change in the array type because
|
10363
|
-
# of numpy2 type promotion.
|
10364
|
-
newarray = np.ma.masked_array( np.full((newnbx,newnby), self.nullvalue, dtype = self.dtype) )
|
10365
|
-
#newarray = np.ma.ones((newnbx,newnby), dtype = self.dtype) * self.nullvalue
|
10366
|
-
newarray[:self.nbx,:self.nby] = self.array
|
10367
|
-
newarray.mask[:self.nbx,:self.nby] = self.array.mask
|
10368
|
-
self.array = newarray
|
10369
|
-
|
10370
|
-
self.nbx = newnbx
|
10371
|
-
self.nby = newnby
|
10372
|
-
|
10373
|
-
self.nbx = int(self.nbx / factor)
|
10374
|
-
self.nby = int(self.nby / factor)
|
10375
|
-
|
10376
|
-
self.dx = self.dx * float(factor)
|
10377
|
-
self.dy = self.dy * float(factor)
|
10378
|
-
new_shape = (self.nbx, self.nby)
|
10379
|
-
|
10380
|
-
if factor>1.:
|
10418
|
+
new_shape, (dx, dy) = self.get_rebin_shape_size(factor, reshape_array_if_necessary= True)
|
10419
|
+
|
10420
|
+
if factor >=1.0:
|
10421
|
+
# Decrease resolution
|
10422
|
+
|
10381
10423
|
if operation_matrix is not None:
|
10382
10424
|
# Reshape the input array to split it into blocks of size f x f
|
10383
10425
|
reshaped_a = self.array.reshape(new_shape[0], int(factor), new_shape[1], int(factor))
|
@@ -10407,15 +10449,43 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10407
10449
|
self.set_nullvalue_in_mask()
|
10408
10450
|
else:
|
10409
10451
|
|
10410
|
-
|
10452
|
+
# Increase resolution
|
10453
|
+
|
10454
|
+
if abs(int(1/factor) - 1/factor) > 1e-6:
|
10411
10455
|
logging.warning(f"The factor {factor} doesn't lead to an integer dimension for the Kronecker product")
|
10456
|
+
logging.warning("The array will be rebinned firstly using the most common factor and then using the operation")
|
10457
|
+
|
10458
|
+
# find the greatest common divisor of between self.dx and old_dx
|
10459
|
+
gcd = pgcd_decimal(self.dx, self.dx * factor)
|
10460
|
+
intermediate_factor = gcd / self.dx
|
10461
|
+
|
10462
|
+
logging.warning(f"The greatest common divisor is {gcd}")
|
10463
|
+
|
10464
|
+
tmp = WolfArray(mold=self, whichtype=self.wolftype)
|
10465
|
+
tmp.rebin(intermediate_factor)
|
10412
10466
|
|
10413
|
-
|
10414
|
-
|
10467
|
+
if op_str is None:
|
10468
|
+
op_str = 'min'
|
10415
10469
|
|
10470
|
+
tmp.rebin(factor / intermediate_factor, operation= op_str)
|
10471
|
+
self.array = tmp.array
|
10472
|
+
tmp.array = None
|
10473
|
+
del tmp
|
10474
|
+
else:
|
10475
|
+
|
10476
|
+
ones = np.ones( (int(1/factor), int(1/factor)), dtype=int)
|
10477
|
+
self.array = np.kron(self.array, ones).astype(self.array.dtype)
|
10416
10478
|
|
10417
10479
|
self.mask_data(self.nullvalue)
|
10418
10480
|
|
10481
|
+
self.nbx = new_shape[0]
|
10482
|
+
self.nby = new_shape[1]
|
10483
|
+
self.dx = dx
|
10484
|
+
self.dy = dy
|
10485
|
+
|
10486
|
+
assert isinstance(self.array, ma.MaskedArray), _('The array must be a masked array')
|
10487
|
+
assert self.array.shape == (testnbx, testnby), _(f'Bad shape: {self.array.shape} != {(testnbx, testnby)}')
|
10488
|
+
|
10419
10489
|
self.count()
|
10420
10490
|
|
10421
10491
|
# rebin must not change the type of the array
|
@@ -9,7 +9,7 @@ wolfhece/MulticriteriAnalysis.py,sha256=vGmkzYagZohNe0XjwGJ6VUXcDPjOt80lNFthXpzx
|
|
9
9
|
wolfhece/PandasGrid.py,sha256=etfVhIHzja4Z1EUY6BcDOKX-w7V-Xou1yaf0NMqmclo,4599
|
10
10
|
wolfhece/PyConfig.py,sha256=13DDWjJdohYHwn1uRVHB0s8Jcwq_b9pwcwbAr8NlZyc,19667
|
11
11
|
wolfhece/PyCrosssections.py,sha256=6K9xhupnIVXzLdsLTPN9e1v0xck9BdWZd0-EgpWg9us,133277
|
12
|
-
wolfhece/PyDraw.py,sha256=
|
12
|
+
wolfhece/PyDraw.py,sha256=jCXBonWGmqTQD9AXsii-yalFpUFLKTrfPP2wzh-57NE,741859
|
13
13
|
wolfhece/PyGui.py,sha256=GpVRxNpR8WNDFyHnDvhtHFFsq_cZZlyVgSkFiS-ARYI,185342
|
14
14
|
wolfhece/PyGuiHydrology.py,sha256=dmBlRO8AljsvCPH6eVt0l9ZLx7g5j7Ubl9Srk7ECwyA,34693
|
15
15
|
wolfhece/PyHydrographs.py,sha256=1P5XAURNqCvtSsMQXhOn1ihjTpr725sRsZdlCEhhk6M,3730
|
@@ -61,13 +61,13 @@ wolfhece/pylogging.py,sha256=4TI8hgBB65z-zpvU5Rfa2jkPXPhJaqXjHVPwbcdzTNc,4528
|
|
61
61
|
wolfhece/pypolygons_scen.py,sha256=NWaNeK0RSUeOkgukeogK9FLmQiDjGZ9yhqs9208fojM,46237
|
62
62
|
wolfhece/pyshields.py,sha256=KMtUO5kD0lisKnJD1NsDz-qaY5DpFcmS4O3WkXtUSmo,27898
|
63
63
|
wolfhece/pyviews.py,sha256=zuZjWUptRDm1MTE1PN4Xj_qSITnojgDMG0LlFIBH3SE,13739
|
64
|
-
wolfhece/pywalous.py,sha256=
|
64
|
+
wolfhece/pywalous.py,sha256=Vl0WH0OZLOguV4JWhfJNwo0CgGneyD3DznFbyfAME-w,32221
|
65
65
|
wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
|
66
66
|
wolfhece/textpillow.py,sha256=7hgfsLYAaE_rNKD-g8xsON8sdWvoV8vbqnGGxIayShE,14137
|
67
67
|
wolfhece/tools2d_dll.py,sha256=TfvvmyZUqEZIH0uHwUCJf0bdmCks_AiidDt23Unsp5w,13550
|
68
68
|
wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
|
69
69
|
wolfhece/toolshydrology_dll.py,sha256=cIGyhxV8H5f7GXhDqAamM7uC0W0hQTou3eTkqZdnqBE,5656
|
70
|
-
wolfhece/wolf_array.py,sha256=
|
70
|
+
wolfhece/wolf_array.py,sha256=39O7kYjksEbCC2yn0mu6AfabmVrBWrmoybbfjw4gfIQ,578890
|
71
71
|
wolfhece/wolf_hist.py,sha256=fTEb60Q4TEwobdZsRU4CFXAId1eOKdWAqF8lnF1xEWc,3590
|
72
72
|
wolfhece/wolf_texture.py,sha256=Pt1j_lX74p70Fj3y3qYxYMuN8gghVd8_ih1vFhTIdkA,23884
|
73
73
|
wolfhece/wolf_tiles.py,sha256=v-HohqaWuMYdn75XLnA22dlloAG90iwnIqrgnB0ASQ4,10488
|
@@ -95,7 +95,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
|
|
95
95
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
96
96
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
97
97
|
wolfhece/apps/splashscreen.py,sha256=EdGDN9NhudIiP7c3gVqj7dp4MWFB8ySizM_tpMnsgpE,3091
|
98
|
-
wolfhece/apps/version.py,sha256=
|
98
|
+
wolfhece/apps/version.py,sha256=aOHEtZqRpvSjcC4VtpzMUp8extpQ1AUSw4MRuICsvz0,388
|
99
99
|
wolfhece/apps/wolf.py,sha256=mRnjYsUu4KIsRuamdQWAINFMuwN4eJgMo9erG-hkZ70,729
|
100
100
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
101
101
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -243,7 +243,7 @@ wolfhece/mesh2d/config_manager.py,sha256=DcdxCIIs_dyC6ayJOBULeY364LONogL9PBaqBtC
|
|
243
243
|
wolfhece/mesh2d/cst_2D_boundary_conditions.py,sha256=r43pHHdCtmNp5R2zh1Ckb7EzwQDf6C4YMLwRFTl4KMc,5006
|
244
244
|
wolfhece/mesh2d/gpu_2d.py,sha256=xyZst3ZSYmRp9G0kxlUvTahAiMC9sNEH0MRUlEjqFZI,25999
|
245
245
|
wolfhece/mesh2d/simple_2d.py,sha256=wqENJwpUPxKQcpGIcymQXUj2KgkGWCVH6cs4Os9h9Gs,112581
|
246
|
-
wolfhece/mesh2d/wolf2dprev.py,sha256=
|
246
|
+
wolfhece/mesh2d/wolf2dprev.py,sha256=823RckzGGCQ00h0uti-nL7JoVsAZ_Hv9C02lnvizDIg,495518
|
247
247
|
wolfhece/models/5_coul.pal,sha256=OI1UqcNIDBpJn2k_VDel__r-hKjjvdob0eqinGCI3QY,160
|
248
248
|
wolfhece/models/6_coul.pal,sha256=z7NK2dg0tAQBUweRQV54dIwJbPM1U5y1AR2LLw19Idw,148
|
249
249
|
wolfhece/models/7_coul.pal,sha256=XTnnUyCE8ONokScB2YzYDnSTft7E6sppmr7P-XwMsCE,205
|
@@ -265,6 +265,7 @@ wolfhece/models/shields_cst.pal,sha256=zUGFI6HiL0bsHeOzcWNih3F9cxXKXLLZYA5rtqRbz
|
|
265
265
|
wolfhece/models/vulnerability.pal,sha256=Fevrc_9owywLhbPMBunXDcrGXPJhARo9iSV1eOq3roA,106
|
266
266
|
wolfhece/models/walous_niv1.pal,sha256=mHMjCB-ja47mV3ZsvDOhS2CEK8YN6ewOkf1W7l7JQ8k,138
|
267
267
|
wolfhece/models/walous_niv2.pal,sha256=B5wt5-O88dpaiA6yR4uriOy0tfDVU_cms0Xr6Dw9ZGg,377
|
268
|
+
wolfhece/models/walous_ocs.pal,sha256=DlicMO2qlH3_WPm_bwVBK6lTuUn2MXRcfIpkjl8D2oo,227
|
268
269
|
wolfhece/models/waterdepths.pal,sha256=8rcQfuZOeLKzYv5sARPkhpvZYc1OToj3ZukcbuRUgIY,136
|
269
270
|
wolfhece/models/white_black.pal,sha256=BKjVN1kuk1OtJB9S3uM5fxteWbggI3Pb8p9WdDptT4c,51
|
270
271
|
wolfhece/opengl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -319,8 +320,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=u4C7CXe_bUyGKx7c_Bi0x9
|
|
319
320
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
320
321
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
321
322
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
322
|
-
wolfhece-2.2.
|
323
|
-
wolfhece-2.2.
|
324
|
-
wolfhece-2.2.
|
325
|
-
wolfhece-2.2.
|
326
|
-
wolfhece-2.2.
|
323
|
+
wolfhece-2.2.42.dist-info/METADATA,sha256=qjWwy3fkLflM8KkQ6xXqvlK-GY598fnWupRva1TyNPM,2785
|
324
|
+
wolfhece-2.2.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
325
|
+
wolfhece-2.2.42.dist-info/entry_points.txt,sha256=Jr187pyvA3EeJiQLjZK9yo6mJX7IAn6ygZU9T8qF_gQ,658
|
326
|
+
wolfhece-2.2.42.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
327
|
+
wolfhece-2.2.42.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|