wolfhece 2.1.95__py3-none-any.whl → 2.1.97__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyConfig.py +18 -3
- wolfhece/PyDraw.py +194 -94
- wolfhece/PyVertexvectors.py +34 -9
- wolfhece/apps/version.py +1 -1
- wolfhece/scenario/config_manager.py +15 -1
- wolfhece/wolf_array.py +24 -5
- wolfhece/wolfresults_2D.py +264 -1
- {wolfhece-2.1.95.dist-info → wolfhece-2.1.97.dist-info}/METADATA +1 -1
- {wolfhece-2.1.95.dist-info → wolfhece-2.1.97.dist-info}/RECORD +12 -12
- {wolfhece-2.1.95.dist-info → wolfhece-2.1.97.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.95.dist-info → wolfhece-2.1.97.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.95.dist-info → wolfhece-2.1.97.dist-info}/top_level.txt +0 -0
wolfhece/PyConfig.py
CHANGED
@@ -29,6 +29,7 @@ class ConfigurationKeys(Enum):
|
|
29
29
|
COLOR_BACKGROUND = "ColorBackground"
|
30
30
|
ACTIVE_ARRAY_PALETTE_FOR_IMAGE = "Use active array palette for image"
|
31
31
|
ACTIVE_RES2D_PALETTE_FOR_IMAGE = "Use active result palette for image"
|
32
|
+
ASSEMBLY_IMAGES = "AssemblyImages"
|
32
33
|
|
33
34
|
class WolfConfiguration:
|
34
35
|
""" Holds the PyWolf configuration.
|
@@ -71,7 +72,8 @@ class WolfConfiguration:
|
|
71
72
|
ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE.value: True,
|
72
73
|
ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE.value: False,
|
73
74
|
ConfigurationKeys.TICKS_BOUNDS.value: True,
|
74
|
-
ConfigurationKeys.COLOR_BACKGROUND.value: [255, 255, 255, 255]
|
75
|
+
ConfigurationKeys.COLOR_BACKGROUND.value: [255, 255, 255, 255],
|
76
|
+
ConfigurationKeys.ASSEMBLY_IMAGES.value: 0
|
75
77
|
}
|
76
78
|
self._types = {
|
77
79
|
ConfigurationKeys.VERSION.value: int,
|
@@ -80,7 +82,8 @@ class WolfConfiguration:
|
|
80
82
|
ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE.value: bool,
|
81
83
|
ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE.value: bool,
|
82
84
|
ConfigurationKeys.TICKS_BOUNDS.value: bool,
|
83
|
-
ConfigurationKeys.COLOR_BACKGROUND.value: list
|
85
|
+
ConfigurationKeys.COLOR_BACKGROUND.value: list,
|
86
|
+
ConfigurationKeys.ASSEMBLY_IMAGES.value: int
|
84
87
|
}
|
85
88
|
|
86
89
|
|
@@ -128,7 +131,7 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
128
131
|
super(GlobalOptionsDialog, self).__init__(*args, **kw)
|
129
132
|
|
130
133
|
self.InitUI()
|
131
|
-
self.SetSize((400,
|
134
|
+
self.SetSize((400, 400))
|
132
135
|
self.SetTitle(_("Global options"))
|
133
136
|
|
134
137
|
def push_configuration(self, configuration):
|
@@ -138,6 +141,7 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
138
141
|
self.cfg_bkg_color.SetColour(configuration[ConfigurationKeys.COLOR_BACKGROUND])
|
139
142
|
self.cfg_active_array_pal.SetValue(configuration[ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE])
|
140
143
|
self.cfg_active_res_pal.SetValue(configuration[ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE])
|
144
|
+
self.cfg_assembly_images.SetSelection(configuration[ConfigurationKeys.ASSEMBLY_IMAGES])
|
141
145
|
|
142
146
|
def pull_configuration(self, configuration):
|
143
147
|
configuration[ConfigurationKeys.PLAY_WELCOME_SOUND] = self.cfg_welcome_voice.IsChecked()
|
@@ -146,6 +150,7 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
146
150
|
configuration[ConfigurationKeys.COLOR_BACKGROUND] = list(self.cfg_bkg_color.GetColour())
|
147
151
|
configuration[ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE] = self.cfg_active_array_pal.IsChecked()
|
148
152
|
configuration[ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE] = self.cfg_active_res_pal.IsChecked()
|
153
|
+
configuration[ConfigurationKeys.ASSEMBLY_IMAGES] = self.cfg_assembly_images.GetSelection()
|
149
154
|
|
150
155
|
def InitUI(self):
|
151
156
|
|
@@ -207,6 +212,16 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
207
212
|
self.cfg_active_res_pal.SetToolTip(_('If checked, the active result palette will be used for the image (but priority to active array palette if checked)'))
|
208
213
|
sbs.Add(self.cfg_active_res_pal, 1, wx.EXPAND, 5)
|
209
214
|
|
215
|
+
locsizer = wx.BoxSizer(wx.HORIZONTAL)
|
216
|
+
self.label_assembly_images = wx.StaticText(pnl, label=_('Assembly mode for images (if linked viewers)'))
|
217
|
+
self.cfg_assembly_images = wx.ListBox(pnl, choices=['horizontal', 'vertical', 'square'], style=wx.LB_SINGLE)
|
218
|
+
self.cfg_assembly_images.SetToolTip(_('Choose the assembly mode for images -- horizontal, vertical or square'))
|
219
|
+
|
220
|
+
locsizer.Add(self.label_assembly_images, 1, wx.EXPAND, 2)
|
221
|
+
locsizer.Add(self.cfg_assembly_images, 1, wx.EXPAND)
|
222
|
+
|
223
|
+
sbs.Add(locsizer, 3, wx.EXPAND, 5)
|
224
|
+
|
210
225
|
pnl.SetSizer(sbs)
|
211
226
|
pnl.Layout()
|
212
227
|
|
wolfhece/PyDraw.py
CHANGED
@@ -1027,10 +1027,6 @@ class WolfMapViewer(wx.Frame):
|
|
1027
1027
|
_("Apply mask from sim2D"))
|
1028
1028
|
filterinund = self.analyzemenu.Append(wx.ID_ANY, _("Filter inundation arrays..."),
|
1029
1029
|
_("Filter arrays"))
|
1030
|
-
exporttif = self.analyzemenu.Append(wx.ID_ANY, _("Export arrays as Geotif..."),
|
1031
|
-
_("Export arrays as Geotif"))
|
1032
|
-
exportshape = self.analyzemenu.Append(wx.ID_ANY, _("Export arrays as Shapefile..."),
|
1033
|
-
_("Export arrays as Shapefile"))
|
1034
1030
|
plotqvect = self.analyzemenu.Append(wx.ID_ANY, _("Integrate Q along active vector..."),
|
1035
1031
|
_("Integrate Q along the active vector"))
|
1036
1032
|
plotqvect = self.analyzemenu.Append(wx.ID_ANY, _("Integrate Q along active zone..."),
|
@@ -1462,6 +1458,11 @@ class WolfMapViewer(wx.Frame):
|
|
1462
1458
|
|
1463
1459
|
self.menuwolf2d.AppendSeparator()
|
1464
1460
|
|
1461
|
+
self.menu2d_export_as = self.menuwolf2d.Append(wx.ID_ANY, _("Export results as..."), _("Export results as Geotif or Shapefile"))
|
1462
|
+
|
1463
|
+
self.menuwolf2d.AppendSeparator()
|
1464
|
+
# Possible cache entries will be added after this separator
|
1465
|
+
|
1465
1466
|
self.menubar.Append(self.menuwolf2d, _('Results 2D'))
|
1466
1467
|
|
1467
1468
|
self.menuwolf2d.Bind(wx.EVT_MENU, self.Onmenuwolf2d)
|
@@ -1665,6 +1666,10 @@ class WolfMapViewer(wx.Frame):
|
|
1665
1666
|
|
1666
1667
|
self.read_last_result()
|
1667
1668
|
|
1669
|
+
elif itemlabel == _("Export results as..."):
|
1670
|
+
|
1671
|
+
self.export_results_as()
|
1672
|
+
|
1668
1673
|
elif itemlabel == _("Change current view"):
|
1669
1674
|
|
1670
1675
|
# Change view for results
|
@@ -5385,16 +5390,6 @@ class WolfMapViewer(wx.Frame):
|
|
5385
5390
|
fig.canvas.draw()
|
5386
5391
|
fig.canvas.flush_events()
|
5387
5392
|
|
5388
|
-
elif itemlabel == _("Export arrays as Geotif..."):
|
5389
|
-
autoscale = False
|
5390
|
-
|
5391
|
-
self.export_results_as('geotiff')
|
5392
|
-
|
5393
|
-
elif itemlabel == _("Export arrays as Shapefile..."):
|
5394
|
-
autoscale = False
|
5395
|
-
|
5396
|
-
self.export_results_as('shape')
|
5397
|
-
|
5398
5393
|
elif itemlabel == _("Compute and apply unique colormap on all..."):
|
5399
5394
|
autoscale = False
|
5400
5395
|
|
@@ -6097,8 +6092,11 @@ class WolfMapViewer(wx.Frame):
|
|
6097
6092
|
|
6098
6093
|
elif itemlabel == 'Save to image...':
|
6099
6094
|
autoscale = False
|
6100
|
-
|
6101
|
-
|
6095
|
+
|
6096
|
+
fn, ds = self.save_canvasogl(mpl=True)
|
6097
|
+
all_images = self.save_linked_canvas(fn[:-4], mpl= True, ds= ds)
|
6098
|
+
|
6099
|
+
self.assembly_images(all_images)
|
6102
6100
|
|
6103
6101
|
elif itemlabel == _('Copy image...'):
|
6104
6102
|
autoscale = False
|
@@ -6407,16 +6405,13 @@ class WolfMapViewer(wx.Frame):
|
|
6407
6405
|
|
6408
6406
|
logging.info(_('Filtering done !'))
|
6409
6407
|
|
6410
|
-
def export_results_as(self,which
|
6411
|
-
|
6408
|
+
def export_results_as(self, which:Literal['geotiff','shape'] = None, multiband:bool = None):
|
6412
6409
|
"""
|
6413
6410
|
Export des résultats WOLF2D vers le format GeoTiff
|
6414
6411
|
On attend que les matrices ".hbin" aient été chargées dans l'interface
|
6415
|
-
|
6416
|
-
TODO : Modifier la routine pour prendre les classe de résultats 2D
|
6417
6412
|
"""
|
6418
6413
|
|
6419
|
-
dlg = wx.DirDialog(self,_('Choose output directory'),style = wx.DD_DIR_MUST_EXIST)
|
6414
|
+
dlg = wx.DirDialog(self,_('Choose output directory'), style = wx.DD_DIR_MUST_EXIST)
|
6420
6415
|
ret=dlg.ShowModal()
|
6421
6416
|
|
6422
6417
|
if ret == wx.ID_CANCEL:
|
@@ -6426,63 +6421,81 @@ class WolfMapViewer(wx.Frame):
|
|
6426
6421
|
outdir = dlg.GetPath()
|
6427
6422
|
dlg.Destroy()
|
6428
6423
|
|
6429
|
-
|
6430
|
-
|
6431
|
-
|
6432
|
-
|
6433
|
-
if curarray.plotted:
|
6424
|
+
if which not in ['geotiff','shape']:
|
6425
|
+
dlg = wx.SingleChoiceDialog(self,_('Choose output format'), _('Format'), ['Geotiff','Shape file'])
|
6426
|
+
dlg.ShowModal()
|
6427
|
+
sel = dlg.GetSelection()
|
6434
6428
|
|
6435
|
-
|
6436
|
-
|
6437
|
-
|
6438
|
-
|
6439
|
-
qx = WolfArray(fn+'.qxbin')
|
6440
|
-
qx.array.mask = curarray.array.mask
|
6441
|
-
qx.array.data[np.where(qx.array.mask)] = 0.
|
6442
|
-
qy = WolfArray(fn+'.qybin')
|
6443
|
-
qy.array.mask = curarray.array.mask
|
6444
|
-
qy.array.data[np.where(qy.array.mask)] = 0.
|
6429
|
+
if sel == 0:
|
6430
|
+
which = 'geotiff'
|
6431
|
+
else:
|
6432
|
+
which = 'shape'
|
6445
6433
|
|
6446
|
-
|
6447
|
-
vnorm=qnorm/curarray
|
6448
|
-
froude=vnorm/(curarray*9.81)**.5
|
6434
|
+
dlg.Destroy()
|
6449
6435
|
|
6450
|
-
|
6436
|
+
if which == 'geotiff':
|
6437
|
+
if multiband is None:
|
6438
|
+
dlg = wx.SingleChoiceDialog(self,_('Choose output format'), _('Format'), ['Multiband (single file)',
|
6439
|
+
'Single band (multiple files)'])
|
6440
|
+
dlg.ShowModal()
|
6451
6441
|
|
6452
|
-
|
6442
|
+
sel = dlg.GetSelection()
|
6443
|
+
if sel == 1:
|
6444
|
+
multiband = False
|
6445
|
+
else:
|
6446
|
+
multiband = True
|
6447
|
+
dlg.Destroy()
|
6453
6448
|
|
6454
|
-
|
6449
|
+
logging.info(_('Exporting results -- Be patient !'))
|
6455
6450
|
|
6456
|
-
|
6457
|
-
diamcrit_izbach = WolfArray(mold=h)
|
6451
|
+
loaded_res = self.get_list_keys(drawing_type= draw_type.RES2D, checked_state=None)
|
6458
6452
|
|
6459
|
-
|
6453
|
+
dlg = wx.MultiChoiceDialog(self,_('Choose results to export'), _('Results'), choices=loaded_res)
|
6454
|
+
dlg.SetSelections([idx for idx, res in enumerate(loaded_res) if self.get_obj_from_id(res, drawtype=draw_type.RES2D).plotted])
|
6455
|
+
dlg.ShowModal()
|
6456
|
+
sel = dlg.GetSelections() # Get a list if integers
|
6457
|
+
sel_res = [self.get_obj_from_id(loaded_res[cursel], drawtype=draw_type.RES2D) for cursel in sel] # convert to list of objects
|
6460
6458
|
|
6461
|
-
|
6462
|
-
diamcrit_izbach.array[ij[:,0],ij[:,1]] = diam[:,1]
|
6459
|
+
dlg.Destroy()
|
6463
6460
|
|
6464
|
-
|
6461
|
+
if len(sel) == 0:
|
6462
|
+
logging.warning(_('No results selected for export'))
|
6463
|
+
return
|
6465
6464
|
|
6466
|
-
|
6465
|
+
fields = [(views_2D.TOPOGRAPHY, True),
|
6466
|
+
(views_2D.WATERDEPTH, True),
|
6467
|
+
(views_2D.QX, True),
|
6468
|
+
(views_2D.QY, True),
|
6469
|
+
(views_2D.UNORM, True),
|
6470
|
+
(views_2D.FROUDE, True),
|
6471
|
+
(views_2D.HEAD, True),
|
6472
|
+
(views_2D.CRITICAL_DIAMETER_SHIELDS, False),
|
6473
|
+
(views_2D.CRITICAL_DIAMETER_IZBACH, False),
|
6474
|
+
(views_2D.QNORM, False),
|
6475
|
+
(views_2D.WATERLEVEL, False),
|
6476
|
+
(views_2D.CRITICAL_DIAMETER_SUSPENSION_50, False),
|
6477
|
+
(views_2D.CRITICAL_DIAMETER_SUSPENSION_100, False),]
|
6478
|
+
|
6479
|
+
dlg = wx.MultiChoiceDialog(self,_('Choose fields to export'), _('Fields'), choices= [str(field[0]) for field in fields])
|
6480
|
+
dlg.SetSelections([idx for idx, field in enumerate(fields) if field[1]])
|
6481
|
+
dlg.ShowModal()
|
6482
|
+
sel_fields = dlg.GetSelections() # Get a list if integers
|
6483
|
+
dlg.Destroy()
|
6467
6484
|
|
6468
|
-
|
6469
|
-
|
6470
|
-
|
6471
|
-
'QX [m2s-1]',
|
6472
|
-
'QY [m2s-1]',
|
6473
|
-
'Un [ms-1]',
|
6474
|
-
'Fr [-]',
|
6475
|
-
'D_Sh [m]',
|
6476
|
-
'D_Iz [m]']
|
6485
|
+
if len(sel_fields) == 0:
|
6486
|
+
logging.warning(_('No fields selected for export'))
|
6487
|
+
return
|
6477
6488
|
|
6478
|
-
|
6479
|
-
|
6489
|
+
# Get the views_2D values associated with the selected field names
|
6490
|
+
fields = [fields[cursel][0] for cursel in sel_fields]
|
6480
6491
|
|
6481
|
-
|
6482
|
-
|
6483
|
-
|
6492
|
+
for cur_res in tqdm(sel_res):
|
6493
|
+
cur_res:Wolfresults_2D
|
6494
|
+
cur_res.export_as(outdir, fields, which, multiband)
|
6484
6495
|
|
6485
|
-
|
6496
|
+
logging.info(_('Export done -- Thanks for your patience !'))
|
6497
|
+
|
6498
|
+
def export_shape(self, outdir:str= '', fn:str = '', myarrays:list[WolfArray]= [], descr:list[str]= [], mask:WolfArray=None):
|
6486
6499
|
""" Export multiple arrays to shapefile
|
6487
6500
|
|
6488
6501
|
:param outdir: output directory
|
@@ -6559,7 +6572,7 @@ class WolfMapViewer(wx.Frame):
|
|
6559
6572
|
# Save and close DataSource
|
6560
6573
|
ds = None
|
6561
6574
|
|
6562
|
-
def export_geotif(self, outdir='', fn = '', myarrays=[], descr=[]):
|
6575
|
+
def export_geotif(self, outdir:str= '', fn:str = '', myarrays:list[WolfArray]= [], descr:list[str]= [], multiband:bool= True):
|
6563
6576
|
""" Export multiple arrays to geotiff
|
6564
6577
|
|
6565
6578
|
:param outdir: output directory
|
@@ -6578,38 +6591,62 @@ class WolfMapViewer(wx.Frame):
|
|
6578
6591
|
srs = osr.SpatialReference()
|
6579
6592
|
srs.ImportFromEPSG(31370)
|
6580
6593
|
|
6581
|
-
filename = join(outdir,fn)
|
6582
|
-
if not filename.endswith('.tif'):
|
6583
|
-
filename+='.tif'
|
6584
|
-
|
6585
|
-
arr=myarrays[0].array
|
6586
|
-
if arr.dtype == np.float32:
|
6587
|
-
arr_type = gdal.GDT_Float32
|
6588
|
-
else:
|
6589
|
-
arr_type = gdal.GDT_Int32
|
6590
|
-
|
6591
6594
|
driver: gdal.Driver
|
6592
6595
|
out_ds: gdal.Dataset
|
6593
6596
|
band: gdal.Band
|
6594
6597
|
driver = gdal.GetDriverByName("GTiff")
|
6595
|
-
|
6596
|
-
|
6597
|
-
|
6598
|
-
|
6599
|
-
|
6600
|
-
|
6601
|
-
|
6602
|
-
|
6603
|
-
|
6604
|
-
|
6605
|
-
|
6606
|
-
|
6607
|
-
|
6608
|
-
|
6609
|
-
|
6610
|
-
|
6611
|
-
|
6612
|
-
|
6598
|
+
|
6599
|
+
if multiband:
|
6600
|
+
filename = join(outdir,fn)
|
6601
|
+
if not filename.endswith('.tif'):
|
6602
|
+
filename+='.tif'
|
6603
|
+
|
6604
|
+
arr = myarrays[0]
|
6605
|
+
out_ds = driver.Create(filename, arr.shape[0], arr.shape[1], len(myarrays), arr.dtype_gdal, options=['COMPRESS=LZW'])
|
6606
|
+
out_ds.SetProjection(srs.ExportToWkt())
|
6607
|
+
out_ds.SetGeoTransform([myarrays[0].origx+myarrays[0].translx,
|
6608
|
+
myarrays[0].dx,
|
6609
|
+
0.,
|
6610
|
+
myarrays[0].origy+myarrays[0].transly,
|
6611
|
+
0.,
|
6612
|
+
myarrays[0].dy])
|
6613
|
+
|
6614
|
+
k=1
|
6615
|
+
for arr, name in zip(myarrays,descr):
|
6616
|
+
band = out_ds.GetRasterBand(k)
|
6617
|
+
band.SetNoDataValue(0.)
|
6618
|
+
band.SetDescription(name)
|
6619
|
+
band.WriteArray(arr.array.transpose())
|
6620
|
+
band.FlushCache()
|
6621
|
+
band.ComputeStatistics(True)
|
6622
|
+
k+=1
|
6623
|
+
|
6624
|
+
out_ds = None
|
6625
|
+
|
6626
|
+
else:
|
6627
|
+
for arr, name in zip(myarrays,descr):
|
6628
|
+
|
6629
|
+
if filename.endswith('.tif'):
|
6630
|
+
filename = filename[:-4]
|
6631
|
+
filename = join(outdir,fn+'_'+name)
|
6632
|
+
filename += '.tif'
|
6633
|
+
|
6634
|
+
out_ds = driver.Create(filename, arr.shape[0], arr.shape[1], 1, arr.dtype_gdal, options=['COMPRESS=LZW'])
|
6635
|
+
out_ds.SetProjection(srs.ExportToWkt())
|
6636
|
+
out_ds.SetGeoTransform([myarrays[0].origx+myarrays[0].translx,
|
6637
|
+
myarrays[0].dx,
|
6638
|
+
0.,
|
6639
|
+
myarrays[0].origy+myarrays[0].transly,
|
6640
|
+
0.,
|
6641
|
+
myarrays[0].dy])
|
6642
|
+
|
6643
|
+
band = out_ds.GetRasterBand(1)
|
6644
|
+
band.SetNoDataValue(0.)
|
6645
|
+
band.SetDescription(name)
|
6646
|
+
band.WriteArray(arr.array.transpose())
|
6647
|
+
band.FlushCache()
|
6648
|
+
band.ComputeStatistics(True)
|
6649
|
+
out_ds = None
|
6613
6650
|
|
6614
6651
|
def get_linked_arrays(self, linked:bool = True) -> dict:
|
6615
6652
|
""" Get all arrays in the viewer and linked viewers """
|
@@ -6632,9 +6669,72 @@ class WolfMapViewer(wx.Frame):
|
|
6632
6669
|
def save_linked_canvas(self, fn, mpl=True, ds=0.):
|
6633
6670
|
""" Save canvas of all linked viewers """
|
6634
6671
|
|
6672
|
+
ret = []
|
6635
6673
|
if self.linked:
|
6636
6674
|
for idx, curel in enumerate(self.linkedList):
|
6637
|
-
curel.save_canvasogl(fn + '_' + str(idx) + '.png', mpl, ds)
|
6675
|
+
ret.append(curel.save_canvasogl(fn + '_' + str(idx) + '.png', mpl, ds))
|
6676
|
+
|
6677
|
+
return ret
|
6678
|
+
|
6679
|
+
def assembly_images(self, all_images, mode:Literal['horizontal', 'vertical', 'square']= 'square'):
|
6680
|
+
""" Assembly images
|
6681
|
+
|
6682
|
+
Every image has the same size (width, height)
|
6683
|
+
"""
|
6684
|
+
|
6685
|
+
from PIL import Image
|
6686
|
+
|
6687
|
+
images = [Image.open(fn) for fn, ds in all_images]
|
6688
|
+
|
6689
|
+
widths, heights = zip(*(i.size for i in images))
|
6690
|
+
|
6691
|
+
if mode == 'horizontal':
|
6692
|
+
|
6693
|
+
total_width = sum(widths)
|
6694
|
+
max_height = max(heights)
|
6695
|
+
|
6696
|
+
new_im = Image.new('RGB', (total_width, max_height))
|
6697
|
+
|
6698
|
+
x_offset = 0
|
6699
|
+
for im in images:
|
6700
|
+
new_im.paste(im, (x_offset,0))
|
6701
|
+
x_offset += im.size[0]
|
6702
|
+
|
6703
|
+
new_im.save(all_images[0][0][:-4] + '_assembly.png')
|
6704
|
+
|
6705
|
+
elif mode == 'vertical':
|
6706
|
+
|
6707
|
+
total_height = sum(heights)
|
6708
|
+
max_width = max(widths)
|
6709
|
+
|
6710
|
+
new_im = Image.new('RGB', (max_width, total_height))
|
6711
|
+
|
6712
|
+
y_offset = 0
|
6713
|
+
for im in images:
|
6714
|
+
new_im.paste(im, (0, y_offset))
|
6715
|
+
y_offset += im.size[1]
|
6716
|
+
|
6717
|
+
new_im.save(all_images[0][0][:-4] + '_assembly.png')
|
6718
|
+
|
6719
|
+
elif mode == 'square':
|
6720
|
+
|
6721
|
+
max_width = max(widths)
|
6722
|
+
max_height = max(heights)
|
6723
|
+
|
6724
|
+
nb_hor = int(np.ceil(np.sqrt(len(images))))
|
6725
|
+
|
6726
|
+
new_im = Image.new('RGB', (max_width*nb_hor, max_height*nb_hor))
|
6727
|
+
|
6728
|
+
x_offset = 0
|
6729
|
+
y_offset = 0
|
6730
|
+
for idx, im in enumerate(images):
|
6731
|
+
new_im.paste(im, (x_offset, y_offset))
|
6732
|
+
x_offset += im.size[0]
|
6733
|
+
if (idx+1) % nb_hor == 0:
|
6734
|
+
y_offset += im.size[1]
|
6735
|
+
x_offset = 0
|
6736
|
+
|
6737
|
+
new_im.save(all_images[0][0][:-4] + '_assembly.png')
|
6638
6738
|
|
6639
6739
|
def thread_update_blender(self):
|
6640
6740
|
print("Update blender")
|
wolfhece/PyVertexvectors.py
CHANGED
@@ -2238,6 +2238,9 @@ class vector:
|
|
2238
2238
|
"""
|
2239
2239
|
Graphique Matplolib de valeurs dans les matrices liées
|
2240
2240
|
"""
|
2241
|
+
from .wolf_array import WolfArray
|
2242
|
+
from .wolfresults_2D import Wolfresults_2D
|
2243
|
+
|
2241
2244
|
colors=['red','blue','green']
|
2242
2245
|
|
2243
2246
|
exit=True
|
@@ -2257,30 +2260,52 @@ class vector:
|
|
2257
2260
|
|
2258
2261
|
zmin=99999.
|
2259
2262
|
zmax=-99999.
|
2263
|
+
nullvalue = -99999
|
2260
2264
|
|
2261
2265
|
for curlabel, curarray in linked_arrays.items():
|
2262
2266
|
if curarray.plotted:
|
2263
2267
|
|
2264
|
-
|
2268
|
+
if isinstance(curarray, WolfArray):
|
2269
|
+
ds = min(curarray.dx,curarray.dy)
|
2270
|
+
elif isinstance(curarray, Wolfresults_2D):
|
2271
|
+
ds = min(curarray[0].dx,curarray[0].dy)
|
2272
|
+
|
2265
2273
|
nb = int(np.ceil(length/ds*2))
|
2266
2274
|
|
2267
2275
|
alls = np.linspace(0,int(length),nb)
|
2268
2276
|
|
2269
2277
|
pts = [myls.interpolate(curs) for curs in alls]
|
2270
2278
|
|
2271
|
-
allz = [curarray.get_value(curpt.x,curpt.y) for curpt in pts]
|
2279
|
+
allz = np.asarray([curarray.get_value(curpt.x,curpt.y, nullvalue= nullvalue) for curpt in pts])
|
2272
2280
|
|
2273
|
-
zmaxloc=np.max(allz)
|
2274
|
-
zminloc=np.min(allz)
|
2281
|
+
zmaxloc=np.max(allz[allz!=nullvalue])
|
2282
|
+
zminloc=np.min(allz[allz!=nullvalue])
|
2275
2283
|
|
2276
2284
|
zmax=max(zmax,zmaxloc)
|
2277
2285
|
zmin=min(zmin,zminloc)
|
2278
2286
|
|
2279
|
-
if np.max(allz)
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2287
|
+
if np.max(allz)>nullvalue:
|
2288
|
+
# select parts
|
2289
|
+
if nullvalue in allz:
|
2290
|
+
# find all parts separated by nullvalue
|
2291
|
+
nulls = np.argwhere(allz==nullvalue)
|
2292
|
+
nulls = np.insert(nulls,0,-1)
|
2293
|
+
nulls = np.append(nulls,len(allz))
|
2294
|
+
|
2295
|
+
addlabel = True
|
2296
|
+
for i in range(len(nulls)-1):
|
2297
|
+
if nulls[i+1]-nulls[i]>1:
|
2298
|
+
ax.plot(alls[nulls[i]+1:nulls[i+1]],allz[nulls[i]+1:nulls[i+1]],
|
2299
|
+
color=colors[np.mod(k,3)],
|
2300
|
+
lw=2.0,
|
2301
|
+
label=curlabel if addlabel else None)
|
2302
|
+
addlabel = False
|
2303
|
+
|
2304
|
+
else:
|
2305
|
+
ax.plot(alls,allz,
|
2306
|
+
color=colors[np.mod(k,3)],
|
2307
|
+
lw=2.0,
|
2308
|
+
label=curlabel)
|
2284
2309
|
k+=1
|
2285
2310
|
|
2286
2311
|
ax.set_ylim(zmin,zmax)
|
wolfhece/apps/version.py
CHANGED
@@ -709,7 +709,21 @@ class Config_Manager_2D_GPU:
|
|
709
709
|
|
710
710
|
def _select_tif_partname(self, curdict:dict, tifstr:Literal['bath_', 'mann_', 'infil_']):
|
711
711
|
""" Select tif files with a 'str' as name's prefix """
|
712
|
-
|
712
|
+
|
713
|
+
if tifstr == 'bath_':
|
714
|
+
forced_add = ['bathymetry.tif']
|
715
|
+
elif tifstr == 'mann_':
|
716
|
+
forced_add = ['manning.tif']
|
717
|
+
elif tifstr == 'infil_':
|
718
|
+
forced_add = ['infiltration.tif']
|
719
|
+
|
720
|
+
tif_list = [curtif for curtif in curdict[GPU_2D_file_extensions.TIF.value] \
|
721
|
+
if curtif.name.lower().startswith(tifstr) or \
|
722
|
+
curtif.name.lower() in forced_add]
|
723
|
+
|
724
|
+
tif_list += [curtif for curtif in curdict[GPU_2D_file_extensions.TIFF.value] \
|
725
|
+
if curtif.name.lower().startswith(tifstr) or \
|
726
|
+
curtif.name.lower() in forced_add]
|
713
727
|
|
714
728
|
return tif_list
|
715
729
|
|
wolfhece/wolf_array.py
CHANGED
@@ -2600,7 +2600,7 @@ class Ops_Array(wx.Frame):
|
|
2600
2600
|
|
2601
2601
|
def OnContourInt(self, event:wx.MouseEvent):
|
2602
2602
|
""" Create contour - number of contours """
|
2603
|
-
|
2603
|
+
|
2604
2604
|
with wx.NumberEntryDialog(None, 'Number of contours', 'Number of contours', 'Number of contours', 20, 1, 1000) as dlg:
|
2605
2605
|
if dlg.ShowModal() == wx.ID_OK:
|
2606
2606
|
nbcontours = dlg.GetValue()
|
@@ -2617,7 +2617,7 @@ class Ops_Array(wx.Frame):
|
|
2617
2617
|
def OnContourList(self, event:wx.MouseEvent):
|
2618
2618
|
""" Create contour - list of values """
|
2619
2619
|
|
2620
|
-
with wx.TextEntryDialog(None, 'List of specific values separated by comma or tuple (min;max;step)',
|
2620
|
+
with wx.TextEntryDialog(None, 'List of specific values separated by comma or tuple (min;max;step)',
|
2621
2621
|
'List of values', f'{self.parentarray.array.min()}, {self.parentarray.array.max()}') as dlg:
|
2622
2622
|
|
2623
2623
|
if dlg.ShowModal() == wx.ID_OK:
|
@@ -5358,6 +5358,25 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5358
5358
|
|
5359
5359
|
return dtype
|
5360
5360
|
|
5361
|
+
@property
|
5362
|
+
def dtype_gdal(self):
|
5363
|
+
""" Return the GDAL dtype corresponding to the WOLF type """
|
5364
|
+
|
5365
|
+
if self.wolftype in [WOLF_ARRAY_FULL_DOUBLE, WOLF_ARRAY_SYM_DOUBLE, WOLF_ARRAY_CSR_DOUBLE]:
|
5366
|
+
dtype = gdal.GDT_Float64
|
5367
|
+
elif self.wolftype in [WOLF_ARRAY_FULL_SINGLE, WOLF_ARRAY_FULL_SINGLE_3D, WOLF_ARRAY_MB_SINGLE]:
|
5368
|
+
dtype = gdal.GDT_Float32
|
5369
|
+
elif self.wolftype in [WOLF_ARRAY_FULL_INTEGER, WOLF_ARRAY_MB_INTEGER, WOLF_ARRAY_MNAP_INTEGER]:
|
5370
|
+
dtype = gdal.GDT_Int32
|
5371
|
+
elif self.wolftype in [WOLF_ARRAY_FULL_INTEGER16, WOLF_ARRAY_FULL_INTEGER16_2]:
|
5372
|
+
dtype = gdal.GDT_Int16
|
5373
|
+
elif self.wolftype == WOLF_ARRAY_FULL_INTEGER8:
|
5374
|
+
dtype = gdal.GDT_Byte
|
5375
|
+
elif self.wolftype == WOLF_ARRAY_FULL_LOGICAL:
|
5376
|
+
dtype = gdal.GDT_Int16
|
5377
|
+
|
5378
|
+
return dtype
|
5379
|
+
|
5361
5380
|
@property
|
5362
5381
|
def dtype_str(self):
|
5363
5382
|
"""
|
@@ -5597,7 +5616,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5597
5616
|
# Check if estimated file size exceeds 4GB
|
5598
5617
|
if (estimated_file_size > 4 * 1024**3): # 4GB in bytes
|
5599
5618
|
options = ['COMPRESS=LZW', 'BIGTIFF=YES']
|
5600
|
-
|
5619
|
+
logging.info('BigTIFF format will be used!')
|
5601
5620
|
else:
|
5602
5621
|
options = ['COMPRESS=LZW']
|
5603
5622
|
|
@@ -9059,7 +9078,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
9059
9078
|
|
9060
9079
|
if isinstance(levels, int):
|
9061
9080
|
levels = np.linspace(self.array.min(), self.array.max(), levels)
|
9062
|
-
|
9081
|
+
|
9063
9082
|
x, y = self.meshgrid()
|
9064
9083
|
cs = plt.contour(x, y, self.array, levels=levels)
|
9065
9084
|
|
@@ -10275,7 +10294,7 @@ class WolfArrayMNAP(WolfArrayMB):
|
|
10275
10294
|
key = which
|
10276
10295
|
|
10277
10296
|
return self.myblocks[key].array.data != 1
|
10278
|
-
|
10297
|
+
|
10279
10298
|
def get_all_masks(self):
|
10280
10299
|
"""
|
10281
10300
|
Return all masks
|
wolfhece/wolfresults_2D.py
CHANGED
@@ -1430,6 +1430,17 @@ class views_2D(Enum):
|
|
1430
1430
|
T_WD_Q = _('Top + WD + Q')
|
1431
1431
|
T_WD_U = _('Top + WD + U')
|
1432
1432
|
|
1433
|
+
@classmethod
|
1434
|
+
def get_view(cls, value):
|
1435
|
+
for cur in views_2D:
|
1436
|
+
if cur.value == value:
|
1437
|
+
return cur
|
1438
|
+
|
1439
|
+
return None
|
1440
|
+
|
1441
|
+
def __str__(self):
|
1442
|
+
return self.value
|
1443
|
+
|
1433
1444
|
VIEWS_SEDIMENTARY = [views_2D.SHIELDS_NUMBER,
|
1434
1445
|
views_2D.CRITICAL_DIAMETER_SHIELDS,
|
1435
1446
|
views_2D.CRITICAL_DIAMETER_IZBACH,
|
@@ -1899,7 +1910,7 @@ class OneWolfResult:
|
|
1899
1910
|
logging.info(_('End of computing critical diameters'))
|
1900
1911
|
|
1901
1912
|
return diamcrit
|
1902
|
-
|
1913
|
+
|
1903
1914
|
def get_u_shear(self) -> WolfArray:
|
1904
1915
|
"""
|
1905
1916
|
Calcul de la vitesse de cisaillement
|
@@ -4420,3 +4431,255 @@ class Wolfresults_2D(Element_To_Draw):
|
|
4420
4431
|
danger_map_matrix_h.mask_lower(self.epsilon)
|
4421
4432
|
|
4422
4433
|
return danger_map_matrix_h
|
4434
|
+
|
4435
|
+
def export_as(self,
|
4436
|
+
outdir:str,
|
4437
|
+
fields:list[views_2D],
|
4438
|
+
which:Literal['geotiff', 'shape'],
|
4439
|
+
multiband:bool=True):
|
4440
|
+
""" Export as geotiff or shapefile """
|
4441
|
+
|
4442
|
+
oldview = self.get_currentview()
|
4443
|
+
old_plotted = self.plotted
|
4444
|
+
|
4445
|
+
arrays:dict[views_2D, WolfArray] = {}
|
4446
|
+
for curfield in tqdm(fields, _('Concatenating fields')):
|
4447
|
+
self.set_currentview(curfield)
|
4448
|
+
arrays[curfield] = self.as_WolfArray()
|
4449
|
+
arrays[curfield].nullvalue = 0.
|
4450
|
+
arrays[curfield].set_nullvalue_in_mask()
|
4451
|
+
|
4452
|
+
if which =='geotiff':
|
4453
|
+
self.export_as_geotif(outdir,
|
4454
|
+
self.idx,
|
4455
|
+
[arr for arr in arrays.values()],
|
4456
|
+
[key.value for key,arr in arrays.items()],
|
4457
|
+
multiband= multiband)
|
4458
|
+
|
4459
|
+
elif which=='shape':
|
4460
|
+
if views_2D.WATERDEPTH in arrays:
|
4461
|
+
shape_mask = arrays[views_2D.WATERDEPTH]
|
4462
|
+
else:
|
4463
|
+
logging.warning(_('No waterdepth found for shape export'))
|
4464
|
+
logging.warning(_('The first field will be used as mask for shape export'))
|
4465
|
+
shape_mask = arrays[fields[0]]
|
4466
|
+
|
4467
|
+
self.export_as_shape(outdir,
|
4468
|
+
self.idx,
|
4469
|
+
[arr for arr in arrays.values()],
|
4470
|
+
[key.value for key,arr in arrays.items()],
|
4471
|
+
shape_mask)
|
4472
|
+
|
4473
|
+
self.plotted = old_plotted
|
4474
|
+
self.set_currentview(oldview)
|
4475
|
+
|
4476
|
+
def export_as_shape(self,
|
4477
|
+
outdir:str= '',
|
4478
|
+
fn:str = '',
|
4479
|
+
myarrays:list[WolfArray]= [],
|
4480
|
+
descr:list[str]= [],
|
4481
|
+
mask:WolfArray=None):
|
4482
|
+
""" Export multiple arrays to shapefile
|
4483
|
+
|
4484
|
+
:param outdir: output directory
|
4485
|
+
:param fn: filename -- .shp will be added if not present
|
4486
|
+
:param myarrays: list of Wolfarrays to export
|
4487
|
+
:param descr: list of descriptions
|
4488
|
+
:param mask: mask array -- export only where mask > 0
|
4489
|
+
"""
|
4490
|
+
|
4491
|
+
if len(myarrays)==0:
|
4492
|
+
logging.warning(_('No arrays provided for shapefile export'))
|
4493
|
+
return
|
4494
|
+
|
4495
|
+
if mask is None:
|
4496
|
+
logging.warning(_('No mask provided for shapefile export'))
|
4497
|
+
return
|
4498
|
+
|
4499
|
+
from osgeo import gdal, osr, gdalconst,ogr
|
4500
|
+
|
4501
|
+
# create the spatial reference system, Lambert72
|
4502
|
+
srs = osr.SpatialReference()
|
4503
|
+
srs.ImportFromEPSG(31370)
|
4504
|
+
|
4505
|
+
# create the data source
|
4506
|
+
driver: ogr.Driver
|
4507
|
+
driver = ogr.GetDriverByName("ESRI Shapefile")
|
4508
|
+
|
4509
|
+
# create the data source
|
4510
|
+
filename = join(outdir,fn)
|
4511
|
+
if not filename.endswith('.shp'):
|
4512
|
+
filename+='.shp'
|
4513
|
+
|
4514
|
+
ds = driver.CreateDataSource(filename)
|
4515
|
+
|
4516
|
+
# create one layer
|
4517
|
+
layer = ds.CreateLayer("results", srs, ogr.wkbPolygon)
|
4518
|
+
|
4519
|
+
# Convert Fields
|
4520
|
+
new_descr = []
|
4521
|
+
for curfield in descr:
|
4522
|
+
if curfield == views_2D.TOPOGRAPHY.value:
|
4523
|
+
new_descr.append('TOP[m]')
|
4524
|
+
elif curfield == views_2D.WATERDEPTH.value:
|
4525
|
+
new_descr.append('WD[m]')
|
4526
|
+
elif curfield == views_2D.QX.value:
|
4527
|
+
new_descr.append('QX[m2/s]')
|
4528
|
+
elif curfield == views_2D.QY.value:
|
4529
|
+
new_descr.append('QY[m2/s]')
|
4530
|
+
elif curfield == views_2D.UNORM.value:
|
4531
|
+
new_descr.append('UN[m/s]')
|
4532
|
+
elif curfield == views_2D.FROUDE.value:
|
4533
|
+
new_descr.append('FR[-]')
|
4534
|
+
elif curfield == views_2D.HEAD.value:
|
4535
|
+
new_descr.append('HEAD[m]')
|
4536
|
+
elif curfield == views_2D.CRITICAL_DIAMETER_SHIELDS.value:
|
4537
|
+
new_descr.append('DSh[m]')
|
4538
|
+
elif curfield == views_2D.CRITICAL_DIAMETER_IZBACH.value:
|
4539
|
+
new_descr.append('DIz[m]')
|
4540
|
+
elif curfield == views_2D.QNORM.value:
|
4541
|
+
new_descr.append('QN[m2/s]')
|
4542
|
+
elif curfield == views_2D.WATERLEVEL.value:
|
4543
|
+
new_descr.append('WL[m]')
|
4544
|
+
elif curfield == views_2D.CRITICAL_DIAMETER_SUSPENSION_50.value:
|
4545
|
+
new_descr.append('DS50[m]')
|
4546
|
+
elif curfield == views_2D.CRITICAL_DIAMETER_SUSPENSION_100.value:
|
4547
|
+
new_descr.append('DS100[m]')
|
4548
|
+
|
4549
|
+
descr = new_descr
|
4550
|
+
|
4551
|
+
# Add ID fields
|
4552
|
+
idFields=[]
|
4553
|
+
for curlab in descr:
|
4554
|
+
idFields.append(ogr.FieldDefn(curlab, ogr.OFTReal))
|
4555
|
+
layer.CreateField(idFields[-1])
|
4556
|
+
|
4557
|
+
# Create the feature and set values
|
4558
|
+
featureDefn = layer.GetLayerDefn()
|
4559
|
+
feature = ogr.Feature(featureDefn)
|
4560
|
+
|
4561
|
+
usednodes = np.argwhere(mask.array>0.)
|
4562
|
+
for i,j in tqdm(usednodes):
|
4563
|
+
|
4564
|
+
x,y = mask.get_xy_from_ij(i,j)
|
4565
|
+
# Creating a line geometry
|
4566
|
+
ring = ogr.Geometry(ogr.wkbLinearRing)
|
4567
|
+
ring.AddPoint(x-mask.dx/2,y-mask.dy/2)
|
4568
|
+
ring.AddPoint(x+mask.dx/2,y-mask.dy/2)
|
4569
|
+
ring.AddPoint(x+mask.dx/2,y+mask.dy/2)
|
4570
|
+
ring.AddPoint(x-mask.dx/2,y+mask.dy/2)
|
4571
|
+
ring.AddPoint(x-mask.dx/2,y-mask.dy/2)
|
4572
|
+
|
4573
|
+
# Create polygon
|
4574
|
+
poly = ogr.Geometry(ogr.wkbPolygon)
|
4575
|
+
poly.AddGeometry(ring)
|
4576
|
+
|
4577
|
+
feature.SetGeometry(poly)
|
4578
|
+
|
4579
|
+
for arr, id in zip(myarrays,descr):
|
4580
|
+
|
4581
|
+
feature.SetField(id, float(arr.array[i,j]))
|
4582
|
+
|
4583
|
+
layer.CreateFeature(feature)
|
4584
|
+
|
4585
|
+
feature = None
|
4586
|
+
|
4587
|
+
# Save and close DataSource
|
4588
|
+
ds = None
|
4589
|
+
|
4590
|
+
def export_as_geotif(self,
|
4591
|
+
outdir:str= '',
|
4592
|
+
fn:str = '',
|
4593
|
+
myarrays:list[WolfArray]= [],
|
4594
|
+
descr:list[str]= [],
|
4595
|
+
multiband:bool= True):
|
4596
|
+
""" Export results as geotiff
|
4597
|
+
|
4598
|
+
:param outdir: output directory
|
4599
|
+
:param fn: filename -- .tif will be added if not present
|
4600
|
+
:param myarrays: list of Wolfarrays to export
|
4601
|
+
:param descr: list of descriptions -- Bands names
|
4602
|
+
|
4603
|
+
"""
|
4604
|
+
|
4605
|
+
if len(myarrays)==0:
|
4606
|
+
logging.warning(_('No arrays provided for geotiff export'))
|
4607
|
+
return
|
4608
|
+
|
4609
|
+
from osgeo import gdal, osr, gdalconst
|
4610
|
+
|
4611
|
+
srs = osr.SpatialReference()
|
4612
|
+
srs.ImportFromEPSG(31370)
|
4613
|
+
|
4614
|
+
driver: gdal.Driver
|
4615
|
+
out_ds: gdal.Dataset
|
4616
|
+
band: gdal.Band
|
4617
|
+
driver = gdal.GetDriverByName("GTiff")
|
4618
|
+
|
4619
|
+
if multiband:
|
4620
|
+
filename = join(outdir,fn)
|
4621
|
+
if not filename.endswith('.tif'):
|
4622
|
+
filename+='.tif'
|
4623
|
+
|
4624
|
+
arr = myarrays[0]
|
4625
|
+
|
4626
|
+
# Check if estimated file size exceeds 4GB
|
4627
|
+
estimated_file_size = arr.memory_usage * len(myarrays)
|
4628
|
+
if (estimated_file_size > 4 * 1024**3): # 4GB in bytes
|
4629
|
+
options = ['COMPRESS=LZW', 'BIGTIFF=YES']
|
4630
|
+
logging.info('BigTIFF format will be used!')
|
4631
|
+
else:
|
4632
|
+
options = ['COMPRESS=LZW']
|
4633
|
+
|
4634
|
+
out_ds = driver.Create(filename, arr.shape[0], arr.shape[1], len(myarrays), arr.dtype_gdal, options= options)
|
4635
|
+
out_ds.SetProjection(srs.ExportToWkt())
|
4636
|
+
out_ds.SetGeoTransform([myarrays[0].origx+myarrays[0].translx,
|
4637
|
+
myarrays[0].dx,
|
4638
|
+
0.,
|
4639
|
+
myarrays[0].origy+myarrays[0].transly,
|
4640
|
+
0.,
|
4641
|
+
myarrays[0].dy])
|
4642
|
+
|
4643
|
+
k=1
|
4644
|
+
for arr, name in tqdm(zip(myarrays,descr), 'Writing geotiff - bands'):
|
4645
|
+
band = out_ds.GetRasterBand(k)
|
4646
|
+
band.SetNoDataValue(arr.nullvalue)
|
4647
|
+
band.SetDescription(name)
|
4648
|
+
band.WriteArray(arr.array.transpose())
|
4649
|
+
band.FlushCache()
|
4650
|
+
band.ComputeStatistics(True)
|
4651
|
+
k+=1
|
4652
|
+
|
4653
|
+
out_ds = None
|
4654
|
+
|
4655
|
+
else:
|
4656
|
+
for arr, name in tqdm(zip(myarrays,descr), 'Writing geotiff'):
|
4657
|
+
|
4658
|
+
filename = join(outdir,fn)
|
4659
|
+
if filename.endswith('.tif'):
|
4660
|
+
filename = filename[:-4]
|
4661
|
+
filename = filename+'_'+name+'.tif'
|
4662
|
+
|
4663
|
+
estimated_file_size = arr.memory_usage
|
4664
|
+
if (estimated_file_size > 4 * 1024**3): # 4GB in bytes
|
4665
|
+
options = ['COMPRESS=LZW', 'BIGTIFF=YES']
|
4666
|
+
logging.info('BigTIFF format will be used!')
|
4667
|
+
else:
|
4668
|
+
options = ['COMPRESS=LZW']
|
4669
|
+
|
4670
|
+
out_ds = driver.Create(filename, arr.shape[0], arr.shape[1], 1, arr.dtype_gdal, options= options)
|
4671
|
+
out_ds.SetProjection(srs.ExportToWkt())
|
4672
|
+
out_ds.SetGeoTransform([myarrays[0].origx+myarrays[0].translx,
|
4673
|
+
myarrays[0].dx,
|
4674
|
+
0.,
|
4675
|
+
myarrays[0].origy+myarrays[0].transly,
|
4676
|
+
0.,
|
4677
|
+
myarrays[0].dy])
|
4678
|
+
|
4679
|
+
band = out_ds.GetRasterBand(1)
|
4680
|
+
band.SetNoDataValue(arr.nullvalue)
|
4681
|
+
band.SetDescription(name)
|
4682
|
+
band.WriteArray(arr.array.transpose())
|
4683
|
+
band.FlushCache()
|
4684
|
+
band.ComputeStatistics(True)
|
4685
|
+
out_ds = None
|
@@ -5,9 +5,9 @@ wolfhece/GraphProfile.py,sha256=OCgJo0YFFBI6H1z-5egJsOOoWF_iziiza0-bbPejNMc,6965
|
|
5
5
|
wolfhece/Lidar2002.py,sha256=bX-nIzdpjD7rOfEgJpTeaW6rIdAXwDp_z4YTM9CgANY,6068
|
6
6
|
wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
|
7
7
|
wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
|
8
|
-
wolfhece/PyConfig.py,sha256=
|
8
|
+
wolfhece/PyConfig.py,sha256=Mbzh9PxAjBI-XnVOoYh0clykGqRlrgtxjxHr3_3TqIY,11390
|
9
9
|
wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
|
10
|
-
wolfhece/PyDraw.py,sha256=
|
10
|
+
wolfhece/PyDraw.py,sha256=eTk6e6awgr_41s6tg5BjFQAibAJz_Evee0QKTDGZkeE,445795
|
11
11
|
wolfhece/PyGui.py,sha256=HY0beOMSp1JEyq8-vfVynzVrmKxvaO_sJSMwlNqCNrg,105289
|
12
12
|
wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
|
13
13
|
wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
|
@@ -16,7 +16,7 @@ wolfhece/PyParams.py,sha256=6fREK5cUCGw84SDyPvuSzidnX-9BXOX3fve5XBG1K_I,98114
|
|
16
16
|
wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
|
17
17
|
wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
|
18
18
|
wolfhece/PyVertex.py,sha256=aj1Xp6n0pMb_q6AMADHnQ9pgjjRU4EQm0m4Tmc1uoEM,41912
|
19
|
-
wolfhece/PyVertexvectors.py,sha256=
|
19
|
+
wolfhece/PyVertexvectors.py,sha256=dLdRt6f8AQrWT_EsPfJCGHkOgrFLH5zycN0mNcGSF0Y,253832
|
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
|
@@ -48,13 +48,13 @@ wolfhece/pywalous.py,sha256=yRaWJjKckXef1d9D5devP0yFHC9uc6kRV4G5x9PNq9k,18972
|
|
48
48
|
wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
|
49
49
|
wolfhece/textpillow.py,sha256=map7HsGYML_o5NHRdFg2s_TVQed_lDnpYNDv27MM0Vw,14130
|
50
50
|
wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
|
51
|
-
wolfhece/wolf_array.py,sha256=
|
51
|
+
wolfhece/wolf_array.py,sha256=Pv7Kbimou7t-wXkixwZ0Gcv2N9kTPWJxiHI8VYD8sCk,407304
|
52
52
|
wolfhece/wolf_hist.py,sha256=7jeVrgSkM3ErJO6SRMH_PGzfLjIdw8vTy87kesldggk,3582
|
53
53
|
wolfhece/wolf_texture.py,sha256=DS5eobLxrq9ljyebYfpMSQPn8shkUAZZVfqrOKN_QUU,16951
|
54
54
|
wolfhece/wolf_tiles.py,sha256=2Ho2I20rHRY81KXxjgLOYISdF4OkJ2d6omeY4shDoGI,10386
|
55
55
|
wolfhece/wolf_vrt.py,sha256=89XoDhCJMHiwPQUuOduxtTRKuIa8RDxgNqX65S4xp9M,10569
|
56
56
|
wolfhece/wolf_zi_db.py,sha256=baE0niMCzybWGSvPJc5FNxo9ZxsGfU4p-FmfiavFHAs,12967
|
57
|
-
wolfhece/wolfresults_2D.py,sha256
|
57
|
+
wolfhece/wolfresults_2D.py,sha256=-Un0F7GsfSJetycyYc-6UeOrXEFCu9eH9Fumj-Qe4cM,179603
|
58
58
|
wolfhece/xyz_file.py,sha256=Se4nCPwYAYLSA5i0zsbnZUKoAMAD0mK1FJea5WSZUkk,5755
|
59
59
|
wolfhece/acceptability/Parallels.py,sha256=h4tu3SpC_hR5Hqa68aruxhtAyhs8u666YuZ40_fR5zg,3979
|
60
60
|
wolfhece/acceptability/__init__.py,sha256=hfgoPKLDpX7drN1Vpvux-_5Lfyc_7feT2C2zQr5v-Os,258
|
@@ -75,7 +75,7 @@ wolfhece/apps/curvedigitizer.py,sha256=Yps4bcayzbsz0AoVc_dkSk35dEhhn_esIBy1Ziefg
|
|
75
75
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
76
76
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
77
77
|
wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
|
78
|
-
wolfhece/apps/version.py,sha256=
|
78
|
+
wolfhece/apps/version.py,sha256=NRYKULEmomDYlRJya_ox0EwLq8fqyB2CbzOltiPmlOo,388
|
79
79
|
wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
|
80
80
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
81
81
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -262,7 +262,7 @@ wolfhece/report/reporting.py,sha256=JUEXovx_S4jpYkJEBU0AC-1Qw2OkkWyV3VAp6iOfSHc,
|
|
262
262
|
wolfhece/report/wolf_report.png,sha256=NoSV58LSwb-oxCcZScRiJno-kxDwRdm_bK-fiMsKJdA,592485
|
263
263
|
wolfhece/scenario/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
264
264
|
wolfhece/scenario/check_scenario.py,sha256=VVjtxfcLAgq_Pf8VSqRq6BJ-y4Zi24CntJpZWxAv3n8,5162
|
265
|
-
wolfhece/scenario/config_manager.py,sha256=
|
265
|
+
wolfhece/scenario/config_manager.py,sha256=sILVXCdSsB-LcfVbCIF33fkPAGd-8qZR9q2598TxVcU,91130
|
266
266
|
wolfhece/scenario/imposebc_void.py,sha256=PqA_99hKcaqK5zsK6IRIc5Exgg3WVpgWU8xpwNL49zQ,5571
|
267
267
|
wolfhece/scenario/update_void.py,sha256=ay8C_FxfXN627Hx46waaAO6F3ovYmOCTxseUumKAY7c,7474
|
268
268
|
wolfhece/shaders/fragment_shader_texture.glsl,sha256=w6h8d5mJqFaGbao0LGmjRcFFdcEQ3ICIl9JpuT71K5k,177
|
@@ -285,8 +285,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
|
|
285
285
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
286
286
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
287
287
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
288
|
-
wolfhece-2.1.
|
289
|
-
wolfhece-2.1.
|
290
|
-
wolfhece-2.1.
|
291
|
-
wolfhece-2.1.
|
292
|
-
wolfhece-2.1.
|
288
|
+
wolfhece-2.1.97.dist-info/METADATA,sha256=74i0-s485_JqC2Pb5WGIg19uvs3o2pyeGpg7KFvgtZU,2570
|
289
|
+
wolfhece-2.1.97.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
290
|
+
wolfhece-2.1.97.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
|
291
|
+
wolfhece-2.1.97.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
292
|
+
wolfhece-2.1.97.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|