wolfhece 2.1.17__py3-none-any.whl → 2.1.18__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 CHANGED
@@ -882,7 +882,12 @@ class WolfMapViewer(wx.Frame):
882
882
 
883
883
 
884
884
  def get_canvas_bounds(self, gridsize:float = None):
885
- """ Retourne les limites de la zone d'affichage """
885
+ """
886
+ Retourne les limites de la zone d'affichage
887
+
888
+ :return: [xmin, ymin, xmax, ymax]
889
+
890
+ """
886
891
 
887
892
  if gridsize is None:
888
893
 
@@ -2772,13 +2777,26 @@ class WolfMapViewer(wx.Frame):
2772
2777
  '2015': 'ORTHO_2015', '2016': 'ORTHO_2016', '2017': 'ORTHO_2017',
2773
2778
  '2018': 'ORTHO_2018', '2019': 'ORTHO_2019', '2020': 'ORTHO_2020',
2774
2779
  '2021': 'ORTHO_2021', '2022 printemps': 'ORTHO_2022_PRINTEMPS', '2022 été': 'ORTHO_2022_ETE',
2775
- '2023 été': 'ORTHO_2023_ETE'}}
2780
+ '2023 été': 'ORTHO_2023_ETE',
2781
+ }}
2782
+ data_2021 = {'EAU': {'IDW': 'ZONES_INONDEES_IDW',
2783
+ 'Emprise': 'ZONES_INONDEES',
2784
+ 'Emprise wo Alea': 'ZONES_INONDEES_wo_alea'}}
2785
+
2776
2786
  for idx, (k, item) in enumerate(orthos.items()):
2777
2787
  for kdx, (m, subitem) in enumerate(item.items()):
2778
2788
  self.add_object(which='wmsback',
2779
2789
  newobj=imagetexture('PPNC', m, k, subitem,
2780
2790
  self, xmin, xmax, ymin, ymax, -99999, 1024),
2781
2791
  ToCheck=False, id='PPNC ' + m)
2792
+
2793
+ for idx, (k, item) in enumerate(data_2021.items()):
2794
+ for kdx, (m, subitem) in enumerate(item.items()):
2795
+ self.add_object(which='wmsback',
2796
+ newobj=imagetexture('PPNC', m, k, subitem,
2797
+ self, xmin, xmax, ymin, ymax, -99999, 1024),
2798
+ ToCheck=False, id='Data 2021 ' + m)
2799
+
2782
2800
  self.add_object(which='wmsback',
2783
2801
  newobj=imagetexture('PPNC', 'Orthos France', 'OI.OrthoimageCoverage.HR', '',
2784
2802
  self, xmin, xmax, ymin, ymax, -99999, 1024, France=True, epsg='EPSG:27563'),
@@ -5594,7 +5612,7 @@ class WolfMapViewer(wx.Frame):
5594
5612
  Add object to current Frame/Drawing area
5595
5613
  """
5596
5614
 
5597
- filterArray = "bin (*.bin)|*.bin|Elevation WOLF2D (*.top)|*.top|Geotif (*.tif)|*.tif|Float ESRI (*.flt)|*.flt|Numpy (*.npy)|*.npy|Numpy named arrays(*.npz)|*.npz|all (*.*)|*.*"
5615
+ filterArray = "All supported formats|*.bin;*.tif;*.tiff;*.top;*.flt;*.npy;*.npz|bin (*.bin)|*.bin|Elevation WOLF2D (*.top)|*.top|Geotif (*.tif)|*.tif|Float ESRI (*.flt)|*.flt|Numpy (*.npy)|*.npy|Numpy named arrays(*.npz)|*.npz|all (*.*)|*.*"
5598
5616
  filterjson = "json (*.json)|*.json|all (*.*)|*.*"
5599
5617
  filterall = "all (*.*)|*.*"
5600
5618
  filterres2d = "all (*.*)|*.*"
wolfhece/PyWMS.py CHANGED
@@ -12,7 +12,7 @@ from .PyTranslate import _
12
12
  def to_image(mybytes:BytesIO) -> Image:
13
13
  return Image.open(mybytes)
14
14
 
15
- def getWalonmap(cat:Literal['IMAGERIE/ORTHO_2021', 'ALEA', 'CADMAP', 'LIDAXES', '$IDW', 'ZONES_INONDEES'],
15
+ def getWalonmap(cat:Literal['IMAGERIE/ORTHO_2021', 'ALEA', 'CADMAP', 'LIDAXES', '$IDW', 'EAU/ZONES_INONDEES'],
16
16
  xl:float,
17
17
  yl:float,
18
18
  xr:float,
@@ -23,6 +23,8 @@ def getWalonmap(cat:Literal['IMAGERIE/ORTHO_2021', 'ALEA', 'CADMAP', 'LIDAXES',
23
23
 
24
24
  if cat.find('$')>0:
25
25
  catloc=cat[:cat.find('$')]
26
+ elif cat.find('_wo_alea')>0:
27
+ catloc=cat[:cat.find('_wo_alea')]
26
28
  else:
27
29
  catloc=cat
28
30
 
@@ -78,18 +80,17 @@ def getWalonmap(cat:Literal['IMAGERIE/ORTHO_2021', 'ALEA', 'CADMAP', 'LIDAXES',
78
80
  elif cat.find('LIDAXES')>0:
79
81
  curcont=['4,5,6,7,8,9,11,13']
80
82
  curstyles=['default,default,default,default,default,default,default,default']
81
- elif cat.find('$IDW')>0:
82
- curcont=[ul.quote('Zones inondées - Modélisation IDW')]
83
+ elif cat.find('IDW')>0:
84
+ curcont=['0']
83
85
  curstyles=['default']
84
86
  elif cat.find('ZONES_INONDEES')>0:
85
- layers=[
86
- ul.quote('Zones inondables'),
87
- ul.quote('Zones inondées - Satellites'),
88
- ul.quote('Zones indondées - Verviers'),
89
- ul.quote('Zones inondées - Enquêtes SPW'),
90
- ul.quote('Zones inondées - Digitalisations')]
91
- curcont=['{},{},{},{},{},{}'.format(layers[0],layers[1],layers[2],layers[3],layers[4])]
92
- curstyles=['default,default,default,default,default']
87
+
88
+ if 'wo_alea' in cat:
89
+ curcont = list(wms.contents)[1:]
90
+ curstyles=['default']*len(curcont)
91
+ else:
92
+ curcont = list(wms.contents)
93
+ curstyles=['default']*len(curcont)
93
94
 
94
95
  try:
95
96
  img=wms.getmap(layers=curcont,styles=curstyles,srs='EPSG:31370',bbox=(xl,yl,xr,yr),size=(w,h),format='image/png',transparent=True)
wolfhece/apps/version.py CHANGED
@@ -5,7 +5,7 @@ class WolfVersion():
5
5
 
6
6
  self.major = 2
7
7
  self.minor = 1
8
- self.patch = 17
8
+ self.patch = 18
9
9
 
10
10
  def __str__(self):
11
11
 
wolfhece/wolf_array.py CHANGED
@@ -649,6 +649,49 @@ class header_wolf():
649
649
  filename = str(filename)
650
650
 
651
651
  if filename.endswith('.tif'):
652
+ from osgeo import gdal
653
+
654
+ raster:gdal.Dataset
655
+ raster = gdal.Open(filename)
656
+ geotr = raster.GetGeoTransform()
657
+ self.dx = geotr[1]
658
+ self.dy = abs(geotr[5])
659
+ self.origx = geotr[0]
660
+ self.origy = geotr[3]
661
+ self.nbx = raster.RasterXSize
662
+ self.nby = raster.RasterYSize
663
+
664
+ """
665
+ https://docs.qgis.org/3.34/en/docs/user_manual/processing_algs/gdal/rasterconversion.html
666
+
667
+ 0 — Use Input Layer Data Type
668
+ 1 — Byte (Eight bit unsigned integer (quint8))
669
+ 2 — Int16 (Sixteen bit signed integer (qint16))
670
+ 3 — UInt16 (Sixteen bit unsigned integer (quint16))
671
+ 4 — UInt32 (Thirty two bit unsigned integer (quint32))
672
+ 5 — Int32 (Thirty two bit signed integer (qint32))
673
+ 6 — Float32 (Thirty two bit floating point (float))
674
+ 7 — Float64 (Sixty four bit floating point (double))
675
+ 8 — CInt16 (Complex Int16)
676
+ 9 — CInt32 (Complex Int32)
677
+ 10 — CFloat32 (Complex Float32)
678
+ 11 — CFloat64 (Complex Float64)
679
+ 12 — Int8 (Eight bit signed integer (qint8))
680
+ """
681
+
682
+ dtype = raster.GetRasterBand(1).DataType
683
+
684
+ if dtype in [1, 4]:
685
+ self.wolftype = WOLF_ARRAY_FULL_INTEGER
686
+ elif dtype ==6:
687
+ self.wolftype = WOLF_ARRAY_FULL_SINGLE
688
+ elif dtype == 7:
689
+ self.wolftype = WOLF_ARRAY_FULL_DOUBLE
690
+ else:
691
+ logging.error(_('The datatype of the raster is not supported -- {}'.format(dtype)))
692
+ logging.error(_('Please convert the raster to a supported datatype - or upgrade the code to support this datatype'))
693
+ logging.error(_('See : read_txt_header and import_geotif in wolf_array.py'))
694
+ return
652
695
  return
653
696
 
654
697
  if filename.endswith('.flt'):
@@ -4666,9 +4709,76 @@ class WolfArray(Element_To_Draw, header_wolf):
4666
4709
 
4667
4710
  if crop is not None :
4668
4711
  if os.path.exists(fn):
4712
+
4713
+ tmpdx = self.dx
4714
+
4715
+ fn_crop = fn + '_crop.tif'
4716
+ if type(crop) is np.ndarray:
4717
+ pass
4718
+ elif type(crop) is list:
4719
+ pass
4720
+ else:
4721
+ if not self.wx_exists:
4722
+ logging.error(_('Crop must be a list or a numpy array with 4 values - xmin, xmax, ymin, ymax'))
4723
+ return
4724
+
4725
+ raster:gdal.Dataset
4726
+ raster = gdal.Open(fn)
4727
+ geotr = raster.GetGeoTransform()
4728
+ self.dx = geotr[1]
4729
+ self.dy = abs(geotr[5])
4730
+
4731
+
4732
+ newcrop = CropDialog(None)
4733
+
4734
+ if self.wx_exists:
4735
+ bounds = self.mapviewer.get_canvas_bounds()
4736
+
4737
+ newcrop.dx.Value = str(self.dx)
4738
+ newcrop.dy.Value = str(self.dy)
4739
+
4740
+ newcrop.dx.Enable(False)
4741
+ newcrop.dy.Enable(False)
4742
+
4743
+ newcrop.ox.Value = str(float((bounds[0] // 50.) * 50.))
4744
+ newcrop.ex.Value = str(float((bounds[2] // 50.) * 50.))
4745
+ newcrop.oy.Value = str(float((bounds[1] // 50.) * 50.))
4746
+ newcrop.ey.Value = str(float((bounds[3] // 50.) * 50.))
4747
+
4748
+ badvalues = True
4749
+ while badvalues:
4750
+ badvalues = False
4751
+
4752
+ ret = newcrop.ShowModal()
4753
+ if ret == wx.ID_CANCEL:
4754
+ newcrop.Destroy()
4755
+ return
4756
+ else:
4757
+ crop = [float(newcrop.ox.Value), float(newcrop.ex.Value),
4758
+ float(newcrop.oy.Value), float(newcrop.ey.Value)]
4759
+
4760
+ tmpdx = float(newcrop.dx.Value)
4761
+ tmpdy = float(newcrop.dy.Value)
4762
+
4763
+ if self.dx != tmpdx or self.dy != tmpdy:
4764
+ if tmpdx / self.dx != tmpdy / self.dy:
4765
+ badvalues = True
4766
+
4767
+ newcrop.Destroy()
4768
+
4669
4769
  xmin, xmax, ymin, ymax = crop
4670
- gdal.Translate(fn+'_crop.tif', fn, projWin=[xmin, ymax, xmax, ymin])
4671
- fn +='_crop.tif'
4770
+
4771
+ with wx.FileDialog(None, _('Save the cropped file for later'), wildcard="Tiff files (*.tif)|*.tif",
4772
+ style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) as fileDialog:
4773
+
4774
+ if fileDialog.ShowModal() == wx.ID_CANCEL:
4775
+ return
4776
+
4777
+ fn_crop = fileDialog.GetPath()
4778
+
4779
+
4780
+ gdal.Translate(fn_crop, fn, projWin=[xmin, ymax, xmax, ymin])
4781
+ fn = fn_crop
4672
4782
 
4673
4783
  raster:gdal.Dataset
4674
4784
  raster = gdal.Open(fn)
@@ -6452,6 +6562,13 @@ class WolfArray(Element_To_Draw, header_wolf):
6452
6562
  else:
6453
6563
  newcrop = CropDialog(None)
6454
6564
 
6565
+ if self.mapviewer is not None:
6566
+ bounds = self.mapviewer.get_canvas_bounds()
6567
+ newcrop.ox.Value = float((bounds[0] // 50.) * 50.)
6568
+ newcrop.ex.Value = float((bounds[2] // 50.) * 50.)
6569
+ newcrop.oy.Value = float((bounds[1] // 50.) * 50.)
6570
+ newcrop.ey.Value = float((bounds[3] // 50.) * 50.)
6571
+
6455
6572
  badvalues = True
6456
6573
  while badvalues:
6457
6574
  badvalues = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.1.17
3
+ Version: 2.1.18
4
4
  Author-email: Pierre Archambeau <pierre.archambeau@uliege.be>
5
5
  License: AGPL-v3 License
6
6
  Project-URL: Homepage, https://uee.uliege.be/hece
@@ -6,7 +6,7 @@ wolfhece/ManageParams.py,sha256=Wgt5Zh7QBtyiwTAltPHunSLqt4XuVuRH76GTUrXabS4,219
6
6
  wolfhece/Model1D.py,sha256=-cMz-ePSYzrKVVDidiDOz6cojEZ3y6u9gIb7RPwT6Y8,476593
7
7
  wolfhece/PyConfig.py,sha256=oGSL1WsLM9uinlNP4zGBLK3uHPmBfduUi7R-VtWuRFA,8034
8
8
  wolfhece/PyCrosssections.py,sha256=f4dNYRUGZKePruaaBiTcn5vlrw8TFTj9XwTDrdiF_uU,112450
9
- wolfhece/PyDraw.py,sha256=ayK8YWZGOj79auURpkHaDCUreOlaAtMVq2ZpuzL3s_Q,383008
9
+ wolfhece/PyDraw.py,sha256=x-67Ya_kbNyxW_Umv8sZfnDW75-D9-NytO7PfbCqWpY,383809
10
10
  wolfhece/PyGui.py,sha256=fqy8f3tLt7myJskVvspTQ_ZO7kaiSNKmcfFLrfr4w7M,103174
11
11
  wolfhece/PyGuiHydrology.py,sha256=r8kcY2eGAQzSwVtLpyMUiBL5xBpMBsi7ovs0PgStGWw,14648
12
12
  wolfhece/PyHydrographs.py,sha256=GKK8U0byI45H9O_e4LAOOi7Aw0Tg7Q0Lx322stPg5IQ,3453
@@ -16,7 +16,7 @@ wolfhece/PyPictures.py,sha256=-mJB0JL2YYiEK3D7_ssDkvYiMWK4ve9kXhozQXNeSx8,2216
16
16
  wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
17
17
  wolfhece/PyVertex.py,sha256=dHTjyYYTn0F_NWerlAOBKHV79RUzEEtMJMldQtVc1Cs,40092
18
18
  wolfhece/PyVertexvectors.py,sha256=4K0T74MUH-ycX79hFa2618vKVTu9qOSh49hlbKrydMg,224123
19
- wolfhece/PyWMS.py,sha256=t6jVZpTxTNSLJxABk8A79cEMWTKoRM_S_SXRipsHLzw,4493
19
+ wolfhece/PyWMS.py,sha256=pV7JdzbreQGXCg3E6PwllchEUYu2YiPZEIua2ppJorA,4304
20
20
  wolfhece/RatingCurve.py,sha256=f6IGLS5aJBJD_t_k903m_yRZ60MzKNKanzD6njXZxa8,22200
21
21
  wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
22
22
  wolfhece/RatingCurve_xml.py,sha256=vbLxSWwHPsCAsR13KaG5WVmVn_cha7-6cF4zj7Diiz8,33593
@@ -48,7 +48,7 @@ wolfhece/rain_SPWMI.py,sha256=YqsF-yFro3y_a6MfVRFfr-Rxi7NR1gl_i8VX7scmzes,13548
48
48
  wolfhece/test_Results2DGPU.py,sha256=NOJ_hFXrcLSQXS1dtsqXRQltqIZtDSHMz_EgAJ2_FHU,307
49
49
  wolfhece/textpillow.py,sha256=zEfLrKhfCDyMaVuQOUjHqz6MGKeQ4aewMxOsWi5-wKI,13832
50
50
  wolfhece/tools_mpl.py,sha256=q8Yc4aukPPiUcEzREvZRM_em67XqXaahdoaNt0DETfE,266
51
- wolfhece/wolf_array.py,sha256=tYzkVd4Zrvr6FotO571IfW6Kkvx9Kli9QnzbiXVwZEo,337760
51
+ wolfhece/wolf_array.py,sha256=F8dUmJfiuAF1wFzDm13spgm3OoyAJKMIBlFdHf8PobY,342827
52
52
  wolfhece/wolf_hist.py,sha256=JpRXvzJLUP-RkSkvth3DQWglgTMFI2ZEUDb4RYOfeeI,3284
53
53
  wolfhece/wolf_texture.py,sha256=llQ7aV8scWXIkhpri9XjaPejzoBJsGfsln2ZnlRbFkU,16270
54
54
  wolfhece/wolf_tiles.py,sha256=F2JsJHdAP8fIffNJdG_J26bonCIRtIwMmxKFqdSCRDA,10088
@@ -66,7 +66,7 @@ wolfhece/apps/check_install.py,sha256=jrKR-njqnpIh6ZJqvP6KbDUPVCfwTNQj4glQhcyzs9
66
66
  wolfhece/apps/curvedigitizer.py,sha256=avWERHuVxPnJBOD_ibczwW_XG4vAenqWS8W1zjhBox8,4898
67
67
  wolfhece/apps/isocurrent.py,sha256=4XnNWPa8mYUK7V4zdDRFrHFIXNG2AN2og3TqWKKcqjY,3811
68
68
  wolfhece/apps/splashscreen.py,sha256=LkEVMK0eCc84NeCWD3CGja7fuQ_k1PrZdyqD3GQk_8c,2118
69
- wolfhece/apps/version.py,sha256=YX9tmGcv0oDZgHzLyJ-fs3F4ENyIBZMuarvn4elQtAo,388
69
+ wolfhece/apps/version.py,sha256=_JWrWOrXqm8jB7QRCP1WPFfuVGVCeeUbG1Sn4qROsPs,388
70
70
  wolfhece/apps/wolf.py,sha256=gqfm-ZaUJqNsfCzmdtemSeqLw-GVdSVix-evg5WArJI,293
71
71
  wolfhece/apps/wolf2D.py,sha256=gWD9ee2-1pw_nUxjgRaJMuSe4kUT-RWhOeoTt_Lh1mM,267
72
72
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -267,8 +267,8 @@ wolfhece/sounds/sonsw2.wav,sha256=pFLVt6By0_EPQNt_3KfEZ9a1uSuYTgQSX1I_Zurv9Rc,11
267
267
  wolfhece/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
268
268
  wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=yGbU_JsF56jsmms0gh7mxa7tbNQ_SxqhpAZxhm-mTy4,14860
269
269
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=wCxGRnE3kzEkWlWA6-3X8ADOFux_B0a5QWJ2GnXTgJw,4709
270
- wolfhece-2.1.17.dist-info/METADATA,sha256=jWnXOeve-xUr_A3ZHX9uCTDFNr8GVLlUTepoSZN0HD0,2282
271
- wolfhece-2.1.17.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
272
- wolfhece-2.1.17.dist-info/entry_points.txt,sha256=AIu1KMswrdsqNq_2jPtrRIU4tLjuTnj2dCY-pxIlshw,276
273
- wolfhece-2.1.17.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
274
- wolfhece-2.1.17.dist-info/RECORD,,
270
+ wolfhece-2.1.18.dist-info/METADATA,sha256=uhKpuFpAos-6qos1yKSRasR1NjD072Y84u9kTVLFxA0,2282
271
+ wolfhece-2.1.18.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
272
+ wolfhece-2.1.18.dist-info/entry_points.txt,sha256=AIu1KMswrdsqNq_2jPtrRIU4tLjuTnj2dCY-pxIlshw,276
273
+ wolfhece-2.1.18.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
274
+ wolfhece-2.1.18.dist-info/RECORD,,