wolfhece 2.0.23__py3-none-any.whl → 2.0.25__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.
@@ -1677,6 +1677,7 @@ class crosssections(Element_To_Draw):
1677
1677
  - WOLF sxy --> format ='sxy'
1678
1678
 
1679
1679
  L'objet stocke ses informations dans un dictionnaire : self.myprofiles
1680
+
1680
1681
  Les clés de chaque entrée sont:
1681
1682
  - ['index'] : integer
1682
1683
  - ['left'] : wolfvertex
@@ -1687,13 +1688,14 @@ class crosssections(Element_To_Draw):
1687
1688
  Pour le moment, il est possible de lire les fichiers et d'effectuer cerrains traitements (tri selon vecteur, export gltf...).
1688
1689
 
1689
1690
  Une instance de cet objet peut être ajouté à une instance graphique WOLF pour affichage.
1691
+
1690
1692
  Pour ce faire:
1691
1693
  - une propriété "myzones" de type "Zones" est présente pour stocker les sections sous forme WOLF "ZONES/ZONE/VECTOR/VERTICES". --> "crosssections" n'est donc pas une extension de "Zones" !!
1692
1694
  - deux instances de "cloud_vertices" contiennent les vertices des sections :
1693
1695
  - cloud
1694
1696
  - cloud_all
1695
1697
 
1696
- @remark !! La classe n'est pas encore prévue pour créer des sections en travers!!
1698
+ :remark !! La classe n'est pas encore prévue pour créer des sections en travers!!
1697
1699
 
1698
1700
  """
1699
1701
 
wolfhece/PyDraw.py CHANGED
@@ -63,7 +63,7 @@ from . import Lidar2002
63
63
  try:
64
64
  from .hydrometry_hece.kiwis_hece import hydrometry_hece as hydrometry
65
65
  except:
66
- logging.warning(_('Hydrometry HECE module not found - Load hydrometry instead of hydrometry_hece'))
66
+ logging.debug(_('Hydrometry HECE module not found - Load hydrometry instead of hydrometry_hece'))
67
67
  from .hydrometry.kiwis import hydrometry
68
68
 
69
69
  from .pyshields import get_d_cr
@@ -897,6 +897,36 @@ class WolfMapViewer(wx.Frame):
897
897
  else:
898
898
  return None
899
899
 
900
+ @property
901
+ def bkg_color(self):
902
+ """ Return the background color from configs """
903
+ config = self.get_configuration()
904
+ if config is None:
905
+ return [255.,255.,255.,255.]
906
+ else:
907
+ return config[ConfigurationKeys.COLOR_BACKGROUND]
908
+
909
+ @property
910
+ def ticks_size(self) -> float:
911
+ """ Return the ticks spacing from configs """
912
+
913
+ config = self.get_configuration()
914
+ if config is None:
915
+ return 100.
916
+ else:
917
+ return config[ConfigurationKeys.TICKS_SIZE]
918
+
919
+ @property
920
+ def ticks_bounds(self) -> bool:
921
+ """ Return the ticks bounds from configs """
922
+
923
+ config = self.get_configuration()
924
+ if config is None:
925
+ return True
926
+ else:
927
+ return config[ConfigurationKeys.TICKS_BOUNDS]
928
+
929
+
900
930
  def GlobalOptionsDialog(self, event):
901
931
  handle_configuration_dialog(self, self.get_configuration())
902
932
 
@@ -1060,7 +1090,7 @@ class WolfMapViewer(wx.Frame):
1060
1090
 
1061
1091
  if mpl:
1062
1092
  if ds == 0.:
1063
- ds = self.get_configuration()[ConfigurationKeys.TICKS_SIZE]
1093
+ ds = self.ticks_size
1064
1094
  # dlg = wx.NumberEntryDialog(self,
1065
1095
  # _("xmin : {:.3f} \nxmax : {:.3f} \nymin : {:.3f} \nymax : {:.3f} \n\n dx : {:.3f}\n dy : {:.3f}").format(
1066
1096
  # self.xmin, self.xmax, self.ymin, self.ymax, self.xmax - self.xmin,
@@ -1106,13 +1136,13 @@ class WolfMapViewer(wx.Frame):
1106
1136
  y2 -= ds
1107
1137
 
1108
1138
  x_label_list = np.linspace(x1, x2, int((x2 - x1) / ds) + 1, True)
1109
- if self.get_configuration()[ConfigurationKeys.TICKS_BOUNDS]:
1139
+ if self.ticks_bounds:
1110
1140
  x_label_list = np.insert(x_label_list, 0, self.xmin)
1111
1141
  x_label_list = np.insert(x_label_list, -1, self.xmax)
1112
1142
  x_label_list = np.unique(x_label_list)
1113
1143
 
1114
1144
  y_label_list = np.linspace(y1, y2, int((y2 - y1) / ds) + 1, True)
1115
- if self.get_configuration()[ConfigurationKeys.TICKS_BOUNDS]:
1145
+ if self.ticks_bounds:
1116
1146
  y_label_list = np.insert(y_label_list, 0, self.ymin)
1117
1147
  y_label_list = np.insert(y_label_list, -1, self.ymax)
1118
1148
  y_label_list = np.unique(y_label_list)
@@ -1213,7 +1243,7 @@ class WolfMapViewer(wx.Frame):
1213
1243
 
1214
1244
  if mpl:
1215
1245
  if ds ==0.:
1216
- ds = self.get_configuration()[ConfigurationKeys.TICKS_SIZE]
1246
+ ds = self.ticks_size
1217
1247
 
1218
1248
  extent = (self.xmin, self.xmax, self.ymin, self.ymax)
1219
1249
 
@@ -1233,13 +1263,13 @@ class WolfMapViewer(wx.Frame):
1233
1263
  y2 -= ds
1234
1264
 
1235
1265
  x_label_list = np.linspace(x1,x2, int((x2-x1)/ds) +1, True)
1236
- if self.get_configuration()[ConfigurationKeys.TICKS_BOUNDS]:
1266
+ if self.ticks_bounds:
1237
1267
  x_label_list = np.insert(x_label_list,0,self.xmin)
1238
1268
  x_label_list = np.insert(x_label_list,-1, self.xmax)
1239
1269
  x_label_list = np.unique(x_label_list)
1240
1270
 
1241
1271
  y_label_list = np.linspace(y1, y2, int((y2 - y1) / ds) + 1, True)
1242
- if self.get_configuration()[ConfigurationKeys.TICKS_BOUNDS]:
1272
+ if self.ticks_bounds:
1243
1273
  y_label_list = np.insert(y_label_list, 0, self.ymin)
1244
1274
  y_label_list = np.insert(y_label_list, -1, self.ymax)
1245
1275
  y_label_list = np.unique(y_label_list)
@@ -3247,7 +3277,8 @@ class WolfMapViewer(wx.Frame):
3247
3277
  self.active_res2d.sediment_diameter = diamsize
3248
3278
  self.active_res2d.sediment_density = density
3249
3279
  self.active_res2d.load_default_colormap('shields_cst')
3250
- self.active_res2d.set_currentview(method, True)
3280
+
3281
+ self.active_res2d.set_currentview(method, force_wx = True, force_updatepal = True)
3251
3282
  else:
3252
3283
  for curarray in self.iterator_over_objects(draw_type.RES2D):
3253
3284
  curarray:Wolfresults_2D
@@ -3255,7 +3286,8 @@ class WolfMapViewer(wx.Frame):
3255
3286
  curarray.sediment_diameter = diamsize
3256
3287
  curarray.sediment_density = density
3257
3288
  curarray.load_default_colormap('shields_cst')
3258
- curarray.set_currentview(method)
3289
+
3290
+ curarray.set_currentview(method, force_wx = True, force_updatepal = True)
3259
3291
 
3260
3292
  else:
3261
3293
  if self.active_res2d is not None:
@@ -3263,7 +3295,7 @@ class WolfMapViewer(wx.Frame):
3263
3295
  self.active_res2d.sediment_diameter = diamsize
3264
3296
  self.active_res2d.sediment_density = density
3265
3297
  self.active_res2d.load_default_colormap('shields_cst')
3266
- self.active_res2d.set_currentview(method, True)
3298
+ self.active_res2d.set_currentview(method, force_wx = True, force_updatepal = True)
3267
3299
 
3268
3300
  if self.compare_results is not None:
3269
3301
  self.compare_results.update_type_result(method)
@@ -3587,6 +3619,8 @@ class WolfMapViewer(wx.Frame):
3587
3619
 
3588
3620
  elif itemlabel == _('Set comparison'):
3589
3621
 
3622
+ # Comparaison de deux résultats ou de deux matrices
3623
+
3590
3624
  self.compare_results = Compare_Arrays_Results(self, True, True)
3591
3625
 
3592
3626
  add_elt = True
@@ -3600,151 +3634,6 @@ class WolfMapViewer(wx.Frame):
3600
3634
 
3601
3635
  self.compare_results.bake()
3602
3636
 
3603
- # return
3604
-
3605
- # dlg = wx.SingleChoiceDialog(None,_('Do you want to compare arrays or modelling results?'), _('Array or 2D Model'), [_('Arrays'), _('2D Modelling'), _('2D Modelling GPU')])
3606
- # ret = dlg.ShowModal()
3607
-
3608
- # if ret == wx.ID_CANCEL:
3609
- # dlg.Destroy()
3610
- # return
3611
-
3612
- # keyvalue = dlg.GetStringSelection()
3613
- # dlg.Destroy()
3614
-
3615
- # dlg = wx.MessageDialog(None,_('Do you want to share the colormap ?'), _('Share colormap'), style = wx.YES_NO)
3616
- # ret = dlg.ShowModal()
3617
-
3618
- # sharecmap = ret == wx.ID_YES
3619
- # dlg.Destroy()
3620
-
3621
- # if keyvalue == _('Arrays'):
3622
- # ListArrays = []
3623
- # filterArray = "bin (*.bin)|*.bin|Elevation WOLF2D (*.top)|*.top|Geotif (*.tif)|*.tif|Float ESRI (*.flt)|*.flt|Numpy (*.npy)|*.npy|Numpy named arrays(*.npz)|*.npz|all (*.*)|*.*"
3624
-
3625
- # # filterProject = "Array (*.bin)|*.bin|all (*.*)|*.*"
3626
- # file = wx.FileDialog(self, "Choose Source file", wildcard=filterArray)
3627
- # if file.ShowModal() == wx.ID_CANCEL:
3628
- # file.Destroy()
3629
- # return
3630
- # else:
3631
- # # récuparétaion du nom de fichier avec chemin d'accès
3632
- # ListArrays.append(file.GetPath())
3633
- # file.Destroy()
3634
-
3635
- # file = wx.FileDialog(self, _("Choose Comparison file"), wildcard=filterArray)
3636
- # if file.ShowModal() == wx.ID_CANCEL:
3637
- # file.Destroy()
3638
- # return
3639
- # else:
3640
- # # récuparétaion du nom de fichier avec chemin d'accès
3641
- # ListArrays.append(file.GetPath())
3642
- # file.Destroy()
3643
-
3644
- # first = WolfArray(ListArrays[0], preload=False)
3645
- # sec = WolfArray(ListArrays[1], preload=False)
3646
- # first.read_txt_header()
3647
- # sec.read_txt_header()
3648
-
3649
- # if first.nbx == sec.nbx and first.nby == sec.nby and first.origx == sec.origx and first.origy == sec.origy:
3650
- # first.preload = True
3651
- # sec.preload = True
3652
- # first.read_data()
3653
- # sec.read_data()
3654
- # first.mask_data(0.)
3655
- # sec.mask_data(0.)
3656
- # self.set_compare([first, sec], share_colormap=sharecmap)
3657
- # else:
3658
- # logging.error(_('Arrays have different dimensions !'))
3659
-
3660
- # elif keyvalue == _('2D Modelling') or keyvalue == _('2D Modelling GPU'):
3661
-
3662
- # if len(self.compare_results) == 2:
3663
-
3664
- # dlg = wx.MessageDialog(None,_('Models have already been chosen ? \n\n 1. {} \n\n 2. {} \n\n Use them ? '.format(self.compare_results[0], self.compare_results[1])), _('Result'), style = wx.YES_NO)
3665
- # ret = dlg.ShowModal()
3666
- # dlg.Destroy()
3667
-
3668
- # if ret == wx.ID_NO:
3669
- # self.compare_results = []
3670
-
3671
- # if len(self.compare_results) == 0:
3672
-
3673
- # filterProject = "all (*.*)|*.*"
3674
- # file = wx.FileDialog(self, "Choose Source model", wildcard=filterProject)
3675
-
3676
- # if file.ShowModal() == wx.ID_CANCEL:
3677
- # file.Destroy()
3678
- # return
3679
- # else:
3680
- # # récuparétaion du nom de fichier avec chemin d'accès
3681
- # self.compare_results.append(file.GetPath())
3682
- # file.Destroy()
3683
-
3684
- # file = wx.FileDialog(self, _("Choose Comparison model"), wildcard=filterProject)
3685
- # if file.ShowModal() == wx.ID_CANCEL:
3686
- # file.Destroy()
3687
- # return
3688
- # else:
3689
- # # récuparétaion du nom de fichier avec chemin d'accès
3690
- # self.compare_results.append(file.GetPath())
3691
- # file.Destroy()
3692
-
3693
- # if keyvalue == _('2D Modelling GPU'):
3694
-
3695
- # def check_file(file):
3696
-
3697
- # file = Path(file)
3698
- # if (file.parent / 'simul_gpu_results').exists():
3699
- # file = file.parent / 'simul_gpu_results'
3700
- # elif (file.parent.parent / 'simul_gpu_results').exists():
3701
- # file = file.parent.parent / 'simul_gpu_results'
3702
- # else:
3703
- # logging.error(_('File {} does not contain GPU results !'.format(file)))
3704
- # return False, file
3705
-
3706
- # return True, file
3707
-
3708
- # check, file = check_file(self.compare_results[0])
3709
- # if check:
3710
- # self.compare_results[0] = file
3711
- # else:
3712
- # return
3713
-
3714
- # check, file = check_file(self.compare_results[1])
3715
- # if check:
3716
- # self.compare_results[1] = file
3717
- # else:
3718
- # return
3719
-
3720
- # first = wolfres2DGPU(self.compare_results[0], plotted=False, gpu=True)
3721
- # sec = wolfres2DGPU(self.compare_results[1], plotted=False, gpu=True)
3722
- # else:
3723
- # first = Wolfresults_2D(self.compare_results[0], plotted=False)
3724
- # sec = Wolfresults_2D(self.compare_results[1], plotted=False)
3725
-
3726
- # def pick_res(sim:Wolfresults_2D):
3727
-
3728
- # times, steps = sim.get_times_steps()
3729
-
3730
- # dlg = wx.SingleChoiceDialog(None, _("Pick a result"), "Choices", [str(cur) for cur in times])
3731
- # ret = dlg.ShowModal()
3732
-
3733
- # if ret == wx.ID_CANCEL:
3734
- # idx = -1
3735
- # else:
3736
- # idx = [str(cur) for cur in times].index(dlg.GetStringSelection())
3737
-
3738
- # dlg.Destroy()
3739
-
3740
- # return idx
3741
-
3742
- # first.read_oneresult(pick_res(first))
3743
- # sec.read_oneresult(pick_res(sec))
3744
-
3745
- # self.set_compare([first.as_WolfArray(), sec.as_WolfArray()],
3746
- # share_colormap=sharecmap)
3747
-
3748
3637
  elif id == wx.ID_EXIT:
3749
3638
  dlg = wx.MessageDialog(None,_('Do you really want to quit?'), style = wx.YES_NO|wx.NO_DEFAULT)
3750
3639
  ret=dlg.ShowModal()
@@ -4129,6 +4018,7 @@ class WolfMapViewer(wx.Frame):
4129
4018
  return None
4130
4019
 
4131
4020
  def uniquecolormap(self, loadfromfile = False):
4021
+ """ Compute unique colormap from all (arrays, 2D results) and apply it to all """
4132
4022
 
4133
4023
  workingarray=[]
4134
4024
  nbnotnull=0
@@ -7166,7 +7056,7 @@ class WolfMapViewer(wx.Frame):
7166
7056
 
7167
7057
  if self.canvas.SetCurrent(self.context):
7168
7058
 
7169
- bkg_color = self.get_configuration()[ConfigurationKeys.COLOR_BACKGROUND]
7059
+ bkg_color = self.bkg_color
7170
7060
 
7171
7061
  glClearColor(bkg_color[0]/255., bkg_color[1]/255., bkg_color[2]/255., bkg_color[3]/255.)
7172
7062
  # glClearColor(0., 0., 1., 0)
@@ -7623,7 +7513,7 @@ class Compare_Arrays_Results():
7623
7513
  assert self.type in (Comp_Type.RES2D, Comp_Type.RES2D_GPU), 'This method is only for 2D results'
7624
7514
 
7625
7515
  for curelt in self.elements:
7626
- curelt.set_currentview(newtype)
7516
+ curelt.set_currentview(newtype, force_updatepal = True)
7627
7517
 
7628
7518
  # remove elements
7629
7519
  for baselt, curelt, curmap in zip(self.elements, self.linked_elts, self.mapviewers):
wolfhece/PyGui.py CHANGED
@@ -15,7 +15,7 @@ from .PyDraw import WolfMapViewer,imagetexture
15
15
  try:
16
16
  from .hydrometry_hece.kiwis_hece import hydrometry_hece as hydrometry
17
17
  except:
18
- logging.warning(_('Hydrometry HECE module not found - Load hydrometry instead of hydrometry_hece'))
18
+ logging.debug(_('Hydrometry HECE module not found - Load hydrometry instead of hydrometry_hece'))
19
19
  from .hydrometry.kiwis import hydrometry
20
20
 
21
21
  from .PyConfig import WolfConfiguration, ConfigurationKeys
@@ -227,13 +227,6 @@ class HydrologyModel(GenMapManager):
227
227
 
228
228
  self.wx_exists = wx.App.Get() is not None # test if wx App is running
229
229
 
230
- if self.wx_exists:
231
- super(HydrologyModel, self).__init__(splash=splash, *args, **kw)
232
- else:
233
- if "splash" in kw and kw["splash"]:
234
- raise Exception("You can't have the splash screen outside a GUI")
235
-
236
-
237
230
  self.SPWstations=SPWMIGaugingStations()
238
231
  self.DCENNstations=SPWDCENNGaugingStations()
239
232
 
@@ -245,77 +238,86 @@ class HydrologyModel(GenMapManager):
245
238
  else:
246
239
  self.mydir=normpath(dir)
247
240
 
241
+ if self.wx_exists:
242
+ super(HydrologyModel, self).__init__(splash=splash, *args, **kw)
243
+ else:
244
+ if "splash" in kw and kw["splash"]:
245
+ raise Exception("You can't have the splash screen outside a GUI")
246
+
248
247
  self.mydircharact=join(self.mydir,'Characteristic_maps\\Drainage_basin')
249
248
  self.mydirwhole=join(self.mydir,'Whole_basin\\')
250
249
 
251
250
  self.mycatchment = Catchment('Mysim',self.mydir,False,True)
252
251
  self.myexchanges = forced_exchanges(self.mydir)
253
252
 
254
- self.mapviewer=GuiHydrology(title='Model : '+self.mydir)
255
-
256
- self.files_hydrology_array={'Characteristic_maps':[
257
- ('.b','Raw elevation [m]'),
258
- ('corr.b','Corrected elevation [m]'),
259
- #('diff.b','Corrections (corr-raw) [m]'),
260
- ('.nap','Mask [-]'),
261
- ('.sub','SubBasin index [-]'),
262
- ('.cnv','Accumulation [km²]'),
263
- ('.time','Total time [s]'),
264
- ('.coeff','RunOff coeff [-]'),
265
- ('.slope','Slope [-]'),
266
- ('.reachs','Reach index [-]'),
267
- ('.strahler','Strahler index [-]'),
268
- ('.reachlevel','Reach accumulation [-]'),
269
- ('.landuse1','Woodlands []'),
270
- ('.landuse2','Pastures []'),
271
- ('.landuse3','Cultivated []'),
272
- ('.landuse4','Pavements [m²]'),
273
- ('.landuse5','Water [m²]'),
274
- ('.landuse6','River [m²]'),
275
- ('.landuse_limited_area','LandUse Verif'),
276
- ('.principal_landuse_cropped','Principal landuse [-]'),
277
- ('_encode.sub','Coded index SubB [-]')]}
278
-
279
-
280
- self.files_hydrology_vectors={'Characteristic_maps':[('.delimit.vec','Watershed')],
281
- 'Whole_basin':[('Rain_basin_geom.vec','Rain geom'),
282
- ('Evap_basin_geom.vec','Evapotranspiration geom')]}
283
-
284
- for curfile in self.files_hydrology_array['Characteristic_maps']:
285
- curext=curfile[0]
286
- curidx=curfile[1]
287
- self.mapviewer.add_object(which='array',filename=self.mydircharact+curext,id=curidx,ToCheck=False)
288
-
289
- for curfile in self.files_hydrology_vectors['Characteristic_maps']:
290
- curext=curfile[0]
291
- curidx=curfile[1]
292
- self.mapviewer.add_object(which='vector',filename=self.mydircharact+curext,id=curidx,ToCheck=False)
293
-
294
- for curfile in self.files_hydrology_vectors['Whole_basin']:
295
- curext=curfile[0]
296
- curidx=curfile[1]
297
- if exists(self.mydirwhole+curext):
298
- self.mapviewer.add_object(which='vector',filename=self.mydirwhole+curext,id=curidx,ToCheck=False)
299
-
300
- self.mapviewer.add_object(which='vector',newobj=self.myexchanges.mysegs,id='Forced exchanges',ToCheck=False)
301
- self.mapviewer.add_object(which='cloud',newobj=self.mycatchment.subBasinCloud,id='Local outlets',ToCheck=False)
302
- self.mapviewer.add_object(which='cloud',newobj=self.myexchanges.mycloudup,id='Up nodes',ToCheck=False)
303
- self.mapviewer.add_object(which='cloud',newobj=self.myexchanges.myclouddown,id='Down nodes',ToCheck=False)
304
-
305
- self.mapviewer.add_object(which='other',newobj=self.SPWstations,ToCheck=False,id='SPW-MI stations')
306
- self.mapviewer.add_object(which='other',newobj=self.DCENNstations,ToCheck=False,id='SPW-DCENN stations')
307
-
308
- self.mapviewer.add_grid()
309
- self.mapviewer.add_WMS()
310
-
311
- self.mapviewer.findminmax(True)
312
- self.mapviewer.Autoscale(False)
313
-
314
- #Fichiers de paramètres
315
- self.mainparams=Wolf_Param(self.mapviewer,filename=self.mydir+'\\Main_model.param',title="Model parameters",DestroyAtClosing=False)
316
- self.basinparams=Wolf_Param(self.mapviewer,filename=self.mydircharact+'.param',title="Basin parameters",DestroyAtClosing=False)
317
- self.mainparams.Hide()
318
- self.basinparams.Hide()
253
+ if self.wx_exists:
254
+ self.mapviewer=GuiHydrology(title='Model : '+self.mydir, wolfparent=self, wxlogging=self.mylogs)
255
+ # self.setup_mapviewer(title='Wolf - Hydrology model', wolfparent=self)
256
+
257
+
258
+ self.files_hydrology_array={'Characteristic_maps':[
259
+ ('.b','Raw elevation [m]'),
260
+ ('corr.b','Corrected elevation [m]'),
261
+ #('diff.b','Corrections (corr-raw) [m]'),
262
+ ('.nap','Mask [-]'),
263
+ ('.sub','SubBasin index [-]'),
264
+ ('.cnv','Accumulation [km²]'),
265
+ ('.time','Total time [s]'),
266
+ ('.coeff','RunOff coeff [-]'),
267
+ ('.slope','Slope [-]'),
268
+ ('.reachs','Reach index [-]'),
269
+ ('.strahler','Strahler index [-]'),
270
+ ('.reachlevel','Reach accumulation [-]'),
271
+ ('.landuse1','Woodlands [m²]'),
272
+ ('.landuse2','Pastures [m²]'),
273
+ ('.landuse3','Cultivated [m²]'),
274
+ ('.landuse4','Pavements [m²]'),
275
+ ('.landuse5','Water []'),
276
+ ('.landuse6','River []'),
277
+ ('.landuse_limited_area','LandUse Verif'),
278
+ ('.principal_landuse_cropped','Principal landuse [-]'),
279
+ ('_encode.sub','Coded index SubB [-]')]}
280
+
281
+
282
+ self.files_hydrology_vectors={'Characteristic_maps':[('.delimit.vec','Watershed')],
283
+ 'Whole_basin':[('Rain_basin_geom.vec','Rain geom'),
284
+ ('Evap_basin_geom.vec','Evapotranspiration geom')]}
285
+
286
+ for curfile in self.files_hydrology_array['Characteristic_maps']:
287
+ curext=curfile[0]
288
+ curidx=curfile[1]
289
+ self.mapviewer.add_object(which='array',filename=self.mydircharact+curext,id=curidx,ToCheck=False)
290
+
291
+ for curfile in self.files_hydrology_vectors['Characteristic_maps']:
292
+ curext=curfile[0]
293
+ curidx=curfile[1]
294
+ self.mapviewer.add_object(which='vector',filename=self.mydircharact+curext,id=curidx,ToCheck=False)
295
+
296
+ for curfile in self.files_hydrology_vectors['Whole_basin']:
297
+ curext=curfile[0]
298
+ curidx=curfile[1]
299
+ if exists(self.mydirwhole+curext):
300
+ self.mapviewer.add_object(which='vector',filename=self.mydirwhole+curext,id=curidx,ToCheck=False)
301
+
302
+ self.mapviewer.add_object(which='vector',newobj=self.myexchanges.mysegs,id='Forced exchanges',ToCheck=False)
303
+ self.mapviewer.add_object(which='cloud',newobj=self.mycatchment.subBasinCloud,id='Local outlets',ToCheck=False)
304
+ self.mapviewer.add_object(which='cloud',newobj=self.myexchanges.mycloudup,id='Up nodes',ToCheck=False)
305
+ self.mapviewer.add_object(which='cloud',newobj=self.myexchanges.myclouddown,id='Down nodes',ToCheck=False)
306
+
307
+ self.mapviewer.add_object(which='other',newobj=self.SPWstations,ToCheck=False,id='SPW-MI stations')
308
+ self.mapviewer.add_object(which='other',newobj=self.DCENNstations,ToCheck=False,id='SPW-DCENN stations')
309
+
310
+ self.mapviewer.add_grid()
311
+ self.mapviewer.add_WMS()
312
+
313
+ self.mapviewer.findminmax(True)
314
+ self.mapviewer.Autoscale(False)
315
+
316
+ #Fichiers de paramètres
317
+ self.mainparams=Wolf_Param(self.mapviewer,filename=self.mydir+'\\Main_model.param',title="Model parameters",DestroyAtClosing=False)
318
+ self.basinparams=Wolf_Param(self.mapviewer,filename=self.mydircharact+'.param',title="Basin parameters",DestroyAtClosing=False)
319
+ self.mainparams.Hide()
320
+ self.basinparams.Hide()
319
321
 
320
322
  class Wolf2DModel(GenMapManager):
321
323
 
@@ -113,8 +113,9 @@ class selectpoint(wx.Frame):
113
113
 
114
114
  class GuiHydrology(WolfMapViewer):
115
115
 
116
- def __init__(self, parent=None, title='MyForm', w=500, h=500):
117
- super(GuiHydrology, self).__init__(parent, title=title, w=w, h=h)
116
+ def __init__(self, parent=None, title='MyForm', w=500, h=500, treewidth=200, wolfparent=None, wxlogging=None):
117
+ super(GuiHydrology, self).__init__(parent, title=title, w=w, h=h,
118
+ treewidth=treewidth, wolfparent=wolfparent,wxlogging=wxlogging)
118
119
 
119
120
  self.parent = parent
120
121
 
wolfhece/PyHydrographs.py CHANGED
@@ -86,8 +86,9 @@ class Hydrograph(pd.Series):
86
86
  """
87
87
  Read a wolf file at the format infil[n].tv and
88
88
  return its data as a dictionnary where:
89
- - keys are times and
90
- - values are discharges
89
+
90
+ - keys are times
91
+ - values are discharges
91
92
 
92
93
  """
93
94
  data = {}
wolfhece/PyParams.py CHANGED
@@ -808,10 +808,18 @@ class Wolf_Param(wx.Frame):
808
808
  # Ajout des choix via chaîne JSON
809
809
  list_keys = [ k for k in param[key_Param.ADDED_JSON]['Values'].keys()]
810
810
  list_values = [ k for k in param[key_Param.ADDED_JSON]['Values'].values()]
811
-
812
- page.Append(pg.EnumProperty(param_name, name=locname, labels=list_keys, values=list_values, value=int(param[key_Param.VALUE])))
813
-
814
- self.prop.SetPropertyHelpString(locname , param[key_Param.ADDED_JSON]['Full_Comment'])
811
+ # FIXME : TO GENERALIZE!!!
812
+ value_param = self.value_as_type(param[key_Param.VALUE], param[key_Param.TYPE], )
813
+ if type(value_param) == str:
814
+ try:
815
+ value_param = int(value_param)
816
+ except:
817
+ logging.debug("String type will be conserved! -- {}".format(value_param))
818
+ # print(value_param)
819
+ page.Append(pg.EnumProperty(param_name, name=locname, labels=list_keys, values=list_values, value=value_param))
820
+ if "Full_Comment" in param[key_Param.ADDED_JSON]:
821
+ self.prop.SetPropertyHelpString(locname , param[key_Param.ADDED_JSON]["Full_Comment"])
822
+
815
823
  else:
816
824
 
817
825
  locvalue = self[(group, param_name)]
wolfhece/PyVertex.py CHANGED
@@ -383,18 +383,18 @@ class cloud_vertices(Element_To_Draw):
383
383
  If header exists in the first line of the file, you have to mention it by header=True in initialization.
384
384
 
385
385
  Total number of columns (nb) is important :
386
- - if nb >3 : the file must contain a header
387
- - if header[2].lower() =='z', the file contains XYZ coordinates, otherwise all columns >1 are interpreted as values associated to XY
386
+ - if nb >3 : the file must contain a header
387
+ - if header[2].lower() == 'z', the file contains XYZ coordinates, otherwise all columns >1 are interpreted as values associated to XY
388
388
 
389
389
  Number os values = nb - (2 or 3) depending if Z coordinate exists
390
390
 
391
391
  Data are stored in Python dictionnary :
392
- - ['vertex'] == XY or XYZ
392
+ - 'vertex' : XY or XYZ
393
+
393
394
  Each value is accessible through its headname as key :
394
- - ['headname1'] == value with headname1
395
- - ['headname2'] == value with headname2
396
- - ...
397
- - ['headnamen'] == value with headnamen
395
+ - 'headname1' : value with headname1
396
+ - 'headname2' : value with headname2
397
+ - 'headnamen' : value with headnamen
398
398
 
399
399
  For more information, see 'readfile' or 'import_from_dxf'
400
400
 
@@ -455,7 +455,6 @@ class cloud_vertices(Element_To_Draw):
455
455
  if fname != '':
456
456
  if toload:
457
457
  if Path(fname).suffix.lower() == '.dxf':
458
- # if fname[-4:].lower()=='.dxf':
459
458
  self.import_from_dxf(fname)
460
459
  elif Path(fname).suffix.lower() == '.shp':
461
460
  self.import_shapefile(fname)
@@ -477,10 +476,10 @@ class cloud_vertices(Element_To_Draw):
477
476
  """
478
477
  Find nearest neighbors from Scipy KDTree structure based on a copy of the vertices
479
478
 
480
- Retrun :
481
- - list of distances
482
- - list of "Wolfvertex"
483
- - list of elements stored in self.myvertices
479
+ Return :
480
+ - list of distances
481
+ - list of "Wolfvertex"
482
+ - list of elements stored in self.myvertices
484
483
  """
485
484
  keys = self.myvertices.keys()
486
485
  if self.mytree is None:
@@ -909,7 +908,7 @@ class cloud_vertices(Element_To_Draw):
909
908
  if return_cloud:
910
909
  Nouveau nuage contenant les infos de position sur la trace et d'altitude (s,z)
911
910
  else:
912
- s,z : list[float], list[float]
911
+ s,z : list de floats
913
912
  """
914
913
 
915
914
  # trace:vector
wolfhece/RatingCurve.py CHANGED
@@ -369,7 +369,9 @@ class SPWMIGaugingStations(Element_To_Draw):
369
369
  gaugings:SPWGaugings
370
370
  hrefs:SPWhrefs
371
371
 
372
- def __init__(self,fromxls:str='') -> None:
372
+ def __init__(self, fromxls:str='', idx:str = '', plotted:bool = True, mapviewer = None, need_for_wx:bool = False) -> None:
373
+
374
+ super().__init__(idx,plotted,mapviewer,need_for_wx)
373
375
 
374
376
  self.gaugings=SPWGaugings()
375
377
  self.hrefs=SPWhrefs()
@@ -510,7 +512,9 @@ class SPWDCENNGaugingStations(Element_To_Draw):
510
512
  gaugings:SPWGaugings
511
513
  hrefs:SPWhrefs
512
514
 
513
- def __init__(self,fromxls:str='') -> None:
515
+ def __init__(self, fromxls:str='', idx:str = '', plotted:bool = True, mapviewer = None, need_for_wx:bool = False) -> None:
516
+
517
+ super().__init__(idx,plotted,mapviewer,need_for_wx)
514
518
 
515
519
  self.gaugings=SPWGaugings()
516
520
  self.hrefs=SPWhrefs()
@@ -19,7 +19,7 @@ from .PyTranslate import _
19
19
  try:
20
20
  from .hydrometry_hece.kiwis_hece import hydrometry_hece as hydrometry
21
21
  except:
22
- logging.warning(_('Hydrometry HECE module not found - Load hydrometry instead of hydrometry_hece'))
22
+ logging.debug(_('Hydrometry HECE module not found - Load hydrometry instead of hydrometry_hece'))
23
23
  from .hydrometry.kiwis import hydrometry
24
24
 
25
25
  def get_power_law():