wolfhece 2.1.103__py3-none-any.whl → 2.1.105__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
@@ -7974,11 +7974,24 @@ class WolfMapViewer(wx.Frame):
7974
7974
 
7975
7975
  if ret == wx.ID_YES:
7976
7976
  loadhead = True
7977
+
7978
+ types = None
7977
7979
 
7978
- with wx.lib.busy.BusyInfo(_('Importing cloud points')):
7979
- wait = wx.BusyCursor()
7980
- newobj = cloud_vertices(filename, header=loadhead, mapviewer=self)
7981
- del wait
7980
+ elif filename.endswith('.dxf'):
7981
+ types = ['POLYLINE','LWPOLYLINE','LINE', 'MTEXT', 'INSERT']
7982
+
7983
+ dlg = wx.MultiChoiceDialog(None, _('Choose the types of entities to import'), _('Choose entities'), types)
7984
+ dlg.SetSelections = [3,4]
7985
+
7986
+ ret = dlg.ShowModal()
7987
+ if ret == wx.ID_CANCEL:
7988
+ dlg.Destroy()
7989
+ return -1
7990
+
7991
+ types = [types[i] for i in dlg.GetSelections()]
7992
+ dlg.Destroy()
7993
+
7994
+ newobj = cloud_vertices(filename, header=loadhead, mapviewer=self, dxf_imported_elts=types)
7982
7995
 
7983
7996
  self.myclouds.append(newobj)
7984
7997
  self.active_cloud = newobj
wolfhece/PyGui.py CHANGED
@@ -178,14 +178,23 @@ class MapManager(GenMapManager):
178
178
 
179
179
 
180
180
  # Set directory for hydrometry data, relative to the current file
181
- dir_hydro = Path(__file__).parent / "data/hydrometry"
182
- if not exists(dir_hydro):
183
- makedirs(dir_hydro, exist_ok=True)
181
+ dir_data = Path(__file__).parent / "data"
182
+ dir_hydro = dir_data / "hydrometry"
183
+ if not dir_hydro.exists():
184
+ dir_hydro.mkdir(parents=True, exist_ok=True)
185
+
186
+ dir_cadaster = dir_data / "Cadaster"
187
+ if not dir_cadaster.exists():
188
+ dir_cadaster.mkdir(parents=True, exist_ok=True)
189
+
190
+ dir_picc = dir_data / "PICC"
191
+ if not dir_picc.exists():
192
+ dir_picc.mkdir(parents=True, exist_ok=True)
184
193
 
185
194
  try:
186
195
  self.SPWhydrometry = hydrometry_wolfgui(dir=dir_hydro, idx = 'SPW hydrometry', mapviewer=self.mapviewer, parent = self, plotted=False)
187
- self.picc = Picc_data(data_dir=Path(r'data/PICC'), mapviewer=self.mapviewer)
188
- self.cadaster = Cadaster_data(data_dir=Path(r'data/Cadaster'), mapviewer=self.mapviewer)
196
+ self.picc = Picc_data(data_dir=dir_picc, mapviewer=self.mapviewer)
197
+ self.cadaster = Cadaster_data(data_dir=dir_cadaster, mapviewer=self.mapviewer)
189
198
  self.landmaps = PlansTerrier(mapviewer=self.mapviewer, parent = self, idx='LandMaps', plotted=True)
190
199
 
191
200
  self.mapviewer.add_object(which='other',
wolfhece/PyVertex.py CHANGED
@@ -468,7 +468,8 @@ class cloud_vertices(Element_To_Draw):
468
468
  plotted: bool = True,
469
469
  mapviewer=None,
470
470
  need_for_wx: bool = False,
471
- bbox:Polygon = None) -> None:
471
+ bbox:Polygon = None,
472
+ dxf_imported_elts = ['MTEXT', 'INSERT']) -> None:
472
473
  """
473
474
  Init cloud of vertices
474
475
 
@@ -508,7 +509,7 @@ class cloud_vertices(Element_To_Draw):
508
509
  if self.filename != '':
509
510
  if toload:
510
511
  if Path(fname).suffix.lower() == '.dxf':
511
- self.import_from_dxf(self.filename)
512
+ self.import_from_dxf(self.filename, imported_elts=dxf_imported_elts)
512
513
  elif Path(fname).suffix.lower() == '.shp':
513
514
  self.import_shapefile(self.filename, bbox=bbox)
514
515
  else:
@@ -703,7 +704,7 @@ class cloud_vertices(Element_To_Draw):
703
704
 
704
705
  self.loaded = True
705
706
 
706
- def import_from_dxf(self,fn:str=''):
707
+ def import_from_dxf(self, fn:str='', imported_elts=['MTEXT', 'INSERT']):
707
708
  """
708
709
  Importing DXF file using ezdxf library
709
710
 
@@ -717,27 +718,73 @@ class cloud_vertices(Element_To_Draw):
717
718
  import ezdxf
718
719
 
719
720
  # Lecture du fichier dxf et identification du modelspace
721
+ logging.info(_('Reading DXF file : ')+fn)
720
722
  doc = ezdxf.readfile(fn)
721
723
  msp = doc.modelspace()
722
724
 
725
+ logging.info(_('Number of entities : ')+str(len(msp)))
726
+ logging.info(_('Number of layers : ')+str(len(doc.layers)))
727
+ logging.info(_('Treating entities... '))
728
+
723
729
  # Bouclage sur les éléments du DXF
724
730
  k=0
725
731
  for e in msp:
726
- if e.dxftype() == "MTEXT" or e.dxftype()=='INSERT':
727
- x = e.dxf.insert[0]
728
- y = e.dxf.insert[1]
729
- z = e.dxf.insert[2]
732
+ if doc.layers.get(e.dxf.layer).is_on():
733
+ if e.dxftype() in imported_elts:
734
+ if e.dxftype() == "MTEXT" or e.dxftype()=='INSERT':
735
+ x = e.dxf.insert[0]
736
+ y = e.dxf.insert[1]
737
+ z = e.dxf.insert[2]
738
+
739
+ if z!=0.:
740
+ curvert = wolfvertex(x, y, z)
741
+ curdict = self.myvertices[k] = {}
742
+ curdict['vertex'] = curvert
743
+ k += 1
744
+
745
+ elif e.dxftype() == "POLYLINE":
746
+ # récupération des coordonnées
747
+ verts = [cur.dxf.location.xyz for cur in e.vertices]
748
+ for cur in verts:
749
+ curvert = wolfvertex(cur[0],cur[1],cur[2])
750
+ curdict = self.myvertices[k] = {}
751
+ curdict['vertex'] = curvert
752
+ k += 1
753
+
754
+ elif e.dxftype() == "LWPOLYLINE":
755
+ # récupération des coordonnées
756
+ verts = np.array(e.lwpoints.values)
757
+ verts = verts.reshape([verts.size // 5,5])[:,:2] # in ezdxf 1.3.5, the lwpoints.values attribute is a np.ndarray [n,5]
758
+ verts = np.column_stack([verts,[e.dxf.elevation]*len(verts)])
759
+
760
+ for cur in verts:
761
+ curvert = wolfvertex(cur[0],cur[1],cur[2])
762
+ curdict = self.myvertices[k] = {}
763
+ curdict['vertex'] = curvert
764
+ k += 1
765
+
766
+ elif e.dxftype() == "LINE":
767
+ # récupération des coordonnées
768
+ curvert = wolfvertex(e.dxf.start[0],e.dxf.start[1],e.dxf.start[2])
769
+ curdict = self.myvertices[k] = {}
770
+ curdict['vertex'] = curvert
771
+ k += 1
772
+
773
+ curvert = wolfvertex(e.dxf.end[0],e.dxf.end[1],e.dxf.end[2])
774
+ curdict = self.myvertices[k] = {}
775
+ curdict['vertex'] = curvert
776
+ k += 1
730
777
 
731
- if z!=0.:
732
- curvert = wolfvertex(x, y, z)
733
- curdict = self.myvertices[k] = {}
734
- curdict['vertex'] = curvert
735
- k += 1
778
+ else:
779
+ logging.warning(_('DXF element not supported/ignored : ') + e.dxftype())
780
+ else:
781
+ logging.info(_('Layer {} is off'.format(e.dxf.layer)))
736
782
 
737
783
  self.find_minmax(True)
738
784
  self.loaded = True
739
785
 
740
786
  logging.info(_('Number of imported points : ')+str(k))
787
+ logging.info(_('Importation finished'))
741
788
 
742
789
  return k
743
790
 
@@ -48,7 +48,7 @@ from .wolf_texture import Text_Image_Texture,Text_Infos
48
48
  from .drawing_obj import Element_To_Draw
49
49
 
50
50
  class Triangulation(Element_To_Draw):
51
- def __init__(self, fn='', pts=[],tri=[], idx: str = '', plotted: bool = True, mapviewer=None, need_for_wx: bool = False) -> None:
51
+ def __init__(self, fn='', pts=[], tri=[], idx: str = '', plotted: bool = True, mapviewer=None, need_for_wx: bool = False) -> None:
52
52
  super().__init__(idx, plotted, mapviewer, need_for_wx)
53
53
 
54
54
  self.filename = ''
@@ -62,6 +62,8 @@ class Triangulation(Element_To_Draw):
62
62
  if fn !='':
63
63
  self.filename=fn
64
64
  self.read(fn)
65
+ else:
66
+ self.valid_format()
65
67
  pass
66
68
 
67
69
  def valid_format(self):
@@ -3353,6 +3355,105 @@ class zone:
3353
3355
  mytri.find_minmax(True)
3354
3356
 
3355
3357
  return mytri
3358
+
3359
+ def create_constrainedDelaunay(self, nb=None) -> Triangulation:
3360
+ """
3361
+ Création d'une triangulation Delaunay contrainte sur base des vecteurs
3362
+
3363
+ Utilisation de la librairie "triangle" (https://www.cs.cmu.edu/~quake/triangle.delaunay.html)
3364
+
3365
+ :param nb: nombre de points de découpe des vecteurs (0 pour ne rien redécouper)
3366
+ """
3367
+
3368
+ wx_exists = wx.App.Get() is not None
3369
+
3370
+ # Transformation des vecteurs en polylines shapely
3371
+ # Utile pour le redécoupage
3372
+ myls = []
3373
+ for curv in self.myvectors:
3374
+ myls.append(curv.asshapely_ls())
3375
+
3376
+ meanlength = np.mean([curline.length for curline in myls])
3377
+
3378
+ if nb is None and wx_exists:
3379
+ dlg=wx.NumberEntryDialog(None,
3380
+ _('How many points along polylines ? (0 to use as it is)')+'\n'+
3381
+ _('Mean length size is {} meters').format(meanlength),
3382
+ 'nb',
3383
+ 'dl size',
3384
+ 100,
3385
+ 0,
3386
+ 10000)
3387
+ ret=dlg.ShowModal()
3388
+ if ret==wx.ID_CANCEL:
3389
+ dlg.Destroy()
3390
+ return
3391
+
3392
+ nb=int(dlg.GetValue())
3393
+ dlg.Destroy()
3394
+ else:
3395
+ logging.warning( _('Bad parameter nb'))
3396
+
3397
+ if nb==0:
3398
+ # no decimation
3399
+ newls = myls
3400
+ else:
3401
+ # redécoupage des polylines
3402
+ s = np.linspace(0.,1.,num=nb,endpoint=True)
3403
+
3404
+ newls = [LineString([curls.interpolate(curs,True) for curs in s]) for curls in myls]
3405
+
3406
+ # Récupération des coordonnées des points
3407
+ xyz = [np.asarray(curls.coords[:]) for curls in newls]
3408
+ xyz = np.concatenate(xyz)
3409
+
3410
+ # Recherche du minimum pour recentrer les coordonnées et éviter des erreurs de calcul
3411
+ xmin = xyz[:,0].min()
3412
+ ymin = xyz[:,1].min()
3413
+
3414
+ xyz[:,0] -= xmin
3415
+ xyz[:,1] -= ymin
3416
+
3417
+ # Remove duplicate points
3418
+ xyz, indices = np.unique(xyz, axis=0, return_inverse=True)
3419
+
3420
+ # Numérotation des segments
3421
+ segments = []
3422
+ k = 0
3423
+ for cur in newls:
3424
+ for i in range(len(cur.coords)-1):
3425
+ segments.append([indices[k], indices[k+1]])
3426
+ k+=1
3427
+
3428
+ # Création de la géométrie pour la triangulation
3429
+ geom = {'vertices' : [[x,y] for x,y in xyz[:,:2]],
3430
+ 'segments' : segments}
3431
+
3432
+ try:
3433
+ # Triangulation
3434
+ delaunay = triangle.triangulate(geom, 'p') # d'autres options sont possibles (voir la doc de triangle)
3435
+
3436
+ # Recover z values from xyz for each vertex
3437
+ # Searching value in xyz is not the best way
3438
+ # We create a dictionary to avoid searching manually
3439
+ xyz_dict = {(curxyz[0], curxyz[1]): curxyz[2] for curxyz in xyz}
3440
+ allvert = []
3441
+ for curvert in delaunay['vertices']:
3442
+ x = curvert[0]
3443
+ y = curvert[1]
3444
+ z = xyz_dict.get((x, y), 0.)
3445
+ allvert.append([x + xmin, y + ymin, z])
3446
+
3447
+ # Create the Triangulation object
3448
+ mytri=Triangulation(pts= allvert,
3449
+ tri= [curtri for curtri in delaunay['triangles']])
3450
+ mytri.find_minmax(True)
3451
+
3452
+ except Exception as e:
3453
+ logging.error(_('Error in constrained Delaunay triangulation - {e}'))
3454
+ return None
3455
+
3456
+ return mytri
3356
3457
 
3357
3458
  def createmultibin_proj(self, nb=None, nb2=0) -> Triangulation:
3358
3459
  """
@@ -4818,28 +4919,31 @@ class Zones(wx.Frame, Element_To_Draw):
4818
4919
  # Bouclage sur les éléments du DXF pour identifier les layers utiles et ensuite créer les zones adhoc
4819
4920
  for e in msp:
4820
4921
  if doc.layers.get(e.dxf.layer).is_on():
4821
- if e.dxftype() == "POLYLINE":
4822
- if e.dxf.layer not in used_layers.keys():
4823
- curlayer = used_layers[e.dxf.layer]={}
4824
- else:
4825
- curlayer = used_layers[e.dxf.layer]
4826
- curlayer[e.dxftype().lower()]=0
4922
+ if e.dxftype() in imported_elts:
4923
+ if e.dxftype() == "POLYLINE":
4924
+ if e.dxf.layer not in used_layers.keys():
4925
+ curlayer = used_layers[e.dxf.layer]={}
4926
+ else:
4927
+ curlayer = used_layers[e.dxf.layer]
4928
+ curlayer[e.dxftype().lower()]=0
4827
4929
 
4828
- elif e.dxftype() == "LWPOLYLINE":
4829
- if e.dxf.layer not in used_layers.keys():
4830
- curlayer = used_layers[e.dxf.layer]={}
4831
- else:
4832
- curlayer = used_layers[e.dxf.layer]
4833
- curlayer[e.dxftype().lower()]=0
4930
+ elif e.dxftype() == "LWPOLYLINE":
4931
+ if e.dxf.layer not in used_layers.keys():
4932
+ curlayer = used_layers[e.dxf.layer]={}
4933
+ else:
4934
+ curlayer = used_layers[e.dxf.layer]
4935
+ curlayer[e.dxftype().lower()]=0
4834
4936
 
4835
- elif e.dxftype() == "LINE": # dans ce cas spécifique, ce sont a priori les lignes composant les croix sur les points levés
4836
- if e.dxf.layer not in used_layers.keys():
4837
- curlayer = used_layers[e.dxf.layer]={}
4838
- else:
4839
- curlayer = used_layers[e.dxf.layer]
4840
- curlayer[e.dxftype().lower()]=0
4937
+ elif e.dxftype() == "LINE": # dans ce cas spécifique, ce sont a priori les lignes composant les croix sur les points levés
4938
+ if e.dxf.layer not in used_layers.keys():
4939
+ curlayer = used_layers[e.dxf.layer]={}
4940
+ else:
4941
+ curlayer = used_layers[e.dxf.layer]
4942
+ curlayer[e.dxftype().lower()]=0
4943
+ else:
4944
+ logging.warning(_('DXF element not supported : ') + e.dxftype())
4841
4945
  else:
4842
- pass
4946
+ logging.info(_('Layer {} is off'.format(e.dxf.layer)))
4843
4947
 
4844
4948
  # Création des zones
4845
4949
  for curlayer in used_layers.keys():
@@ -4870,7 +4974,8 @@ class Zones(wx.Frame, Element_To_Draw):
4870
4974
  nbid+=1
4871
4975
  # récupération des coordonnées
4872
4976
  verts = np.array(e.lwpoints.values)
4873
- verts = verts.reshape([int(len(verts)/5),5])[:,:2]
4977
+ verts = verts.reshape([verts.size // 5,5])[:,:2] # in ezdxf 1.3.5, the lwpoints.values attribute is a np.ndarray [n,5]
4978
+ # verts = verts.reshape([len(verts) // 5,5])[:,:2] # in ezdxf 1.2.0, the lwpoints.values attribute was flattened
4874
4979
  verts = np.column_stack([verts,[e.dxf.elevation]*len(verts)])
4875
4980
 
4876
4981
  curzone = used_layers[e.dxf.layer][e.dxftype().lower()]
@@ -5206,6 +5311,10 @@ class Zones(wx.Frame, Element_To_Draw):
5206
5311
  self.trifromall_proj.SetToolTip(_("Create a triangular mesh based on all vectors in the currently active zone.\nGenerate vertices by projecting the central polyline, or the nearest one if there is an even number of polylines, onto the other polylines.\nAdd the resulting mesh to the GUI.\nThis can be useful in certain interpolation methods."))
5207
5312
  self.trifromall_proj.Bind(wx.EVT_BUTTON,self.Oncreatemultibin_project)
5208
5313
 
5314
+ self.constrainedDelaunay = wx.Button(self,label=_('Constrained Delaunay'))
5315
+ self.constrainedDelaunay.SetToolTip(_("Create a triangular mesh based on all vectors in the currently active zone."))
5316
+ self.constrainedDelaunay.Bind(wx.EVT_BUTTON,self.OnconstrainedDelaunay)
5317
+
5209
5318
  self.polyfrompar = wx.Button(self,label=_('Create polygons from parallels'))
5210
5319
  self.polyfrompar.SetToolTip(_("Create polygons in a new zone from parallels defined by " + _('Add and parallel') + _(" and a 2D curvilinear distance \n Useful for plotting some results or analyse data inside each polygon")))
5211
5320
  self.polyfrompar.Bind(wx.EVT_BUTTON,self.Oncreatepolygons)
@@ -5335,6 +5444,7 @@ class Zones(wx.Frame, Element_To_Draw):
5335
5444
  boxtri.Add(self.binfrom3,1,wx.EXPAND)
5336
5445
  boxtri.Add(self.trifromall,1,wx.EXPAND)
5337
5446
  boxtri.Add(self.trifromall_proj,1,wx.EXPAND)
5447
+ boxtri.Add(self.constrainedDelaunay,1,wx.EXPAND)
5338
5448
  boxtri.Add(self.polyfrompar,1,wx.EXPAND)
5339
5449
  boxtri.Add(self.slidingpoly,1,wx.EXPAND)
5340
5450
 
@@ -6122,6 +6232,21 @@ class Zones(wx.Frame, Element_To_Draw):
6122
6232
  self.mapviewer.add_object('triangulation',newobj=mytri)
6123
6233
  self.mapviewer.Refresh()
6124
6234
 
6235
+ def OnconstrainedDelaunay(self, event:wx.MouseEvent):
6236
+ """
6237
+ Create a constrained Delaunay triangulation from the active zone
6238
+ """
6239
+ if self.wx_exists:
6240
+ if self.active_zone is None:
6241
+ return
6242
+
6243
+ myzone = self.active_zone
6244
+
6245
+ mytri = myzone.create_constrainedDelaunay()
6246
+
6247
+ self.mapviewer.add_object('triangulation',newobj=mytri)
6248
+ self.mapviewer.Refresh()
6249
+
6125
6250
  def Oncreatemultibin_project(self, event:wx.MouseEvent):
6126
6251
  """
6127
6252
  Création d'une triangulation sur base de plusieurs vecteurs
@@ -14,29 +14,29 @@ def main():
14
14
  ret = 'Checking installation\n---------------------\n\n'
15
15
 
16
16
 
17
- # Get list of packages
17
+ # Get list of all packages
18
18
  import pkg_resources
19
19
  installed_packages = pkg_resources.working_set
20
- packages = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages])
20
+ packages = sorted(["%s" % (i.key) for i in installed_packages])
21
21
 
22
22
  #is osgeo in packages?
23
- if 'osgeo' in packages:
23
+ if 'osgeo' in packages or 'gdal' in packages:
24
24
  ret += 'OSGeo seems installed\n\n'
25
25
  else:
26
26
  ret += 'OSGeo not installed\n Please install GDAL from https://github.com/cgohlke/geospatial-wheels/releases\n\n'
27
27
 
28
- if 'wolfgpu' in packages:
29
- ret += 'WolfGPU seems installed\n\n'
30
- else:
31
- ret += 'WolfGPU not installed\n Please install WolfGPU if needed\n\n'
32
-
33
28
  try:
34
29
  from osgeo import ogr, gdal
35
- ret += 'GDAL/OGR installed\n\n'
30
+ ret += 'Correct import of osgeo package - GDAL/OGR installed\n\n'
36
31
  except ImportError as e:
37
- ret += 'GDAL/OGR not installed\n Please install GDAL from https://github.com/cgohlke/geospatial-wheels/releases\n\n'
32
+ ret += 'Error during osgeo import - GDAL/OGR not/bad installed\n Please (re)install GDAL (64 bits version) from https://github.com/cgohlke/geospatial-wheels/releases\n\n'
38
33
  ret += 'Error : ' + str(e) + '\n\n'
39
34
 
35
+ if 'wolfgpu' in packages:
36
+ ret += 'WolfGPU seems installed\n\n'
37
+ else:
38
+ ret += 'WolfGPU not installed\n Please install WolfGPU if needed\n\n'
39
+
40
40
  try:
41
41
  from ..libs import wolfpy
42
42
  ret += 'Wolfpy accessible\n\n'
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 = 103
8
+ self.patch = 105
9
9
 
10
10
  def __str__(self):
11
11
 
wolfhece/wolf_array.py CHANGED
@@ -5614,21 +5614,32 @@ class WolfArray(Element_To_Draw, header_wolf):
5614
5614
  if reset_plot:
5615
5615
  self.reset_plot()
5616
5616
 
5617
- def export_geotif(self, outdir='', extent = '', EPSG:int = 31370):
5617
+ def export_geotif(self, outdir:str= '', extent:str= '', EPSG:int = 31370):
5618
5618
  """
5619
5619
  Export de la matrice au format Geotiff (Lambert 72 - EPSG:31370)
5620
5620
 
5621
+ Pour sauvegarder l'objet au format Geotiff, il est recommandé d'utiliser
5622
+ la fonction write_all plutôt que celle-ci directement.
5623
+
5621
5624
  Formats supportés :
5622
5625
  - Int32
5626
+ - Int16
5627
+ - Int8
5628
+ - Byte
5623
5629
  - Float32
5624
5630
  - Float64
5625
5631
 
5626
- :param outdir: directory
5627
- :param extent: suffix to add to the filename before the extension '.tif'
5632
+ :param outdir: directory - If provided, the file will be savd as "outdir/idx+extent.tif"
5633
+ If not provided, we use the filename attribute
5634
+
5635
+ :param extent: suffix to add to the filename before the extension '.tif' (only if outdir is provided)
5628
5636
  :param EPSG: EPSG code, by default 31370 (Lambert 72)
5629
5637
  """
5630
5638
  from osgeo import gdal, osr, gdalconst
5631
5639
 
5640
+ outdir = str(outdir)
5641
+ extent = str(extent)
5642
+
5632
5643
  srs = osr.SpatialReference()
5633
5644
  srs.ImportFromEPSG(EPSG)
5634
5645
 
@@ -5650,6 +5661,9 @@ class WolfArray(Element_To_Draw, header_wolf):
5650
5661
  elif arr.dtype == np.int16:
5651
5662
  arr_type = gdal.GDT_Int16
5652
5663
  nullvalue = int(self.nullvalue)
5664
+ elif arr.dtype == np.uint8:
5665
+ arr_type = gdal.GDT_Byte
5666
+ nullvalue = int(self.nullvalue)
5653
5667
  else:
5654
5668
  arr_type = gdal.GDT_Int32
5655
5669
  nullvalue = int(self.nullvalue)
@@ -5668,7 +5682,12 @@ class WolfArray(Element_To_Draw, header_wolf):
5668
5682
  else:
5669
5683
  options = ['COMPRESS=LZW']
5670
5684
 
5671
- out_ds = driver.Create(filename, arr.shape[0], arr.shape[1], 1, arr_type, options=options)
5685
+ out_ds = driver.Create(str(filename), arr.shape[0], arr.shape[1], 1, arr_type, options=options)
5686
+
5687
+ if out_ds is None:
5688
+ logging.error(_('Could not create the file {filename}'))
5689
+ return
5690
+
5672
5691
  out_ds.SetProjection(srs.ExportToWkt())
5673
5692
 
5674
5693
 
@@ -7688,7 +7707,7 @@ class WolfArray(Element_To_Draw, header_wolf):
7688
7707
  if newpath is not None:
7689
7708
  self.filename = newpath
7690
7709
 
7691
- if self.filename.endswith('.tif'):
7710
+ if self.filename.endswith('.tif') or self.filename.endswith('.tiff'):
7692
7711
  self.export_geotif(EPSG=EPSG)
7693
7712
  elif self.filename.endswith('.npy'):
7694
7713
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.1.103
3
+ Version: 2.1.105
4
4
  Author-email: Pierre Archambeau <pierre.archambeau@uliege.be>
5
5
  License: Copyright (c) 2024 University of Liege. All rights reserved.
6
6
  Project-URL: Homepage, https://uee.uliege.be/hece
@@ -7,16 +7,16 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
7
7
  wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
8
8
  wolfhece/PyConfig.py,sha256=Bb1T8qjgKMChadJYDrHO9uo6CwItiAXScZpYkDXqZF8,11387
9
9
  wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
10
- wolfhece/PyDraw.py,sha256=p1lxn2ScM3f5QI97r80XDg4pgWSc6T-craaPVPfcX2Y,476586
11
- wolfhece/PyGui.py,sha256=jyeYF7srKH3HLZQGQIqcRW3u308KUDA-oLwzX-jkDzQ,143843
10
+ wolfhece/PyDraw.py,sha256=ZlPWb2KNua6uhZFp9-Uq8TPOnksXSr8__Qanctidzns,477115
11
+ wolfhece/PyGui.py,sha256=pD_t3leVt8U9tzFnSMGsF-Ds4m0qPwLb_Tc8fQT34GQ,144147
12
12
  wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
13
13
  wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
14
14
  wolfhece/PyPalette.py,sha256=81n1P-olOe4wElTLv-miSDhqvJU_RHcxgfpHt794dSw,31436
15
15
  wolfhece/PyParams.py,sha256=GRp1zZDUJIjs8PtjwScDdov-E9orr1JWOntDazN5AOw,98577
16
16
  wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
17
17
  wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
18
- wolfhece/PyVertex.py,sha256=3-1zV8-U8bcf9wUL0mJao54Sf3Ew-wmzxhRWUajnGXM,42210
19
- wolfhece/PyVertexvectors.py,sha256=bwXWtZ9qjrrf94G8n_Ne5qETExB9p4oUR6GDDuCBVH0,253864
18
+ wolfhece/PyVertex.py,sha256=0TATf_Se6E7_P-kR1_DMEzRw_zy8-5cGFnc3yAod7yQ,44754
19
+ wolfhece/PyVertexvectors.py,sha256=vnl0a4yy3K4814i0EZRqJsKTryZLT52nqX0RXbMjxks,258906
20
20
  wolfhece/PyWMS.py,sha256=fyyzm2HFwq8aRwVYHKiBatcZOeKnFi6DWhv4nfscySQ,4602
21
21
  wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
22
22
  wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
@@ -51,7 +51,7 @@ wolfhece/pywalous.py,sha256=mWB7UxlYMIbPxNUDlONQEjcOOy9VSaRU9aYWZ5IFLu8,19164
51
51
  wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
52
52
  wolfhece/textpillow.py,sha256=map7HsGYML_o5NHRdFg2s_TVQed_lDnpYNDv27MM0Vw,14130
53
53
  wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
54
- wolfhece/wolf_array.py,sha256=ZJ_HvlN2GeuW4lNJ15-HZSOK5iNc_t5eN4YmL3lJYbY,420268
54
+ wolfhece/wolf_array.py,sha256=_UYxRGF8T0rHTv-1uDJ9opHHwBE7bh39XXnhhUgIcKM,421010
55
55
  wolfhece/wolf_hist.py,sha256=7jeVrgSkM3ErJO6SRMH_PGzfLjIdw8vTy87kesldggk,3582
56
56
  wolfhece/wolf_texture.py,sha256=DS5eobLxrq9ljyebYfpMSQPn8shkUAZZVfqrOKN_QUU,16951
57
57
  wolfhece/wolf_tiles.py,sha256=2Ho2I20rHRY81KXxjgLOYISdF4OkJ2d6omeY4shDoGI,10386
@@ -73,13 +73,13 @@ wolfhece/apps/WolfPython2.png,sha256=VMPV-M-3BCOg8zOJss8bXwPmzRYZy8Fo-XtnVYNgbaw
73
73
  wolfhece/apps/WolfPython3.png,sha256=3G84zx14HnlB9YXMY4VUAO7IB3eu7JFvi4Kpmc_4zBE,403298
74
74
  wolfhece/apps/__init__.py,sha256=OzzKItATWV0mDkz_LC2L3w5sgT2rt8ExXXCbR_FwvlY,24
75
75
  wolfhece/apps/acceptability.py,sha256=hMIxTRNQARTTWJJaakb6kEK9udNh-w64VDgxxezVk3k,790
76
- wolfhece/apps/check_install.py,sha256=kpfBBGjYqu_Ptk2XlQWmiXHxpiWY4ICt3N4B1VsACgs,2299
76
+ wolfhece/apps/check_install.py,sha256=Zb_HE43sT6f-BOjvQUa-Kur6TjedFKUcwZOgTkKH3Sc,2398
77
77
  wolfhece/apps/check_version.py,sha256=Zze7ltzcM2ZzIGMwkcASIjapCG8CEzzW9kwNscA3NhM,1768
78
78
  wolfhece/apps/curvedigitizer.py,sha256=Yps4bcayzbsz0AoVc_dkSk35dEhhn_esIBy1Ziefgmk,5334
79
79
  wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
80
80
  wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
81
81
  wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
82
- wolfhece/apps/version.py,sha256=JzbTGIrCJEVfos-Oqf4HYsLQF6ZIUulzpzVopj07hdk,389
82
+ wolfhece/apps/version.py,sha256=t4cIWqspnu6lsPYUT6cJplsMKfsss5TlTOmf7GsQ45o,389
83
83
  wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
84
84
  wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
85
85
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -292,8 +292,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
292
292
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
293
293
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
294
294
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
295
- wolfhece-2.1.103.dist-info/METADATA,sha256=P_o5O7D46xHTvlo0hbWZ22gjXmXz14bE2xqOjlekwD0,2618
296
- wolfhece-2.1.103.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
297
- wolfhece-2.1.103.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
298
- wolfhece-2.1.103.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
299
- wolfhece-2.1.103.dist-info/RECORD,,
295
+ wolfhece-2.1.105.dist-info/METADATA,sha256=5jWtyY__Cbebr4RvRW19ufqWB6mnLyqq7cvgtaQwiVA,2618
296
+ wolfhece-2.1.105.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
297
+ wolfhece-2.1.105.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
298
+ wolfhece-2.1.105.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
299
+ wolfhece-2.1.105.dist-info/RECORD,,