wolfhece 2.1.117__py3-none-any.whl → 2.1.118__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/CpGrid.py +1 -1
- wolfhece/PyDraw.py +359 -79
- wolfhece/apps/version.py +1 -1
- wolfhece/lazviewer/laz_viewer.py +647 -10
- wolfhece/lazviewer/viewer/viewer.py +2 -2
- wolfhece/wolf_array.py +278 -5
- wolfhece/wolf_vrt.py +18 -17
- {wolfhece-2.1.117.dist-info → wolfhece-2.1.118.dist-info}/METADATA +1 -1
- {wolfhece-2.1.117.dist-info → wolfhece-2.1.118.dist-info}/RECORD +12 -12
- {wolfhece-2.1.117.dist-info → wolfhece-2.1.118.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.117.dist-info → wolfhece-2.1.118.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.117.dist-info → wolfhece-2.1.118.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,7 @@ import warnings
|
|
9
9
|
# _viewer_dir = os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())),'..//libs')
|
10
10
|
_viewer_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
|
11
11
|
|
12
|
-
if
|
12
|
+
if not os.path.isabs(_viewer_dir):
|
13
13
|
_viewer_dir = os.path.abspath(_viewer_dir)
|
14
14
|
|
15
15
|
__all__ = ['viewer']
|
@@ -179,7 +179,7 @@ class viewer:
|
|
179
179
|
def attributes(self, *attr):
|
180
180
|
""" Loads point attributes
|
181
181
|
|
182
|
-
The loaded attributes are used to
|
182
|
+
The loaded attributes are used to color the currently loaded point
|
183
183
|
cloud. Supposing n points loaded, this function accepts attributes of
|
184
184
|
the following forms:
|
185
185
|
|
wolfhece/wolf_array.py
CHANGED
@@ -822,6 +822,39 @@ class header_wolf():
|
|
822
822
|
logging.error(_('See : read_txt_header and import_geotif in wolf_array.py'))
|
823
823
|
return
|
824
824
|
|
825
|
+
elif filename.endswith('.vrt'):
|
826
|
+
# Virtual raster
|
827
|
+
from osgeo import gdal
|
828
|
+
|
829
|
+
raster:gdal.Dataset
|
830
|
+
raster = gdal.Open(filename)
|
831
|
+
geotr = raster.GetGeoTransform()
|
832
|
+
self.dx = geotr[1]
|
833
|
+
self.dy = abs(geotr[5])
|
834
|
+
self.origx = geotr[0]
|
835
|
+
self.origy = geotr[3]
|
836
|
+
self.nbx = raster.RasterXSize
|
837
|
+
self.nby = raster.RasterYSize
|
838
|
+
|
839
|
+
dtype = raster.GetRasterBand(1).DataType
|
840
|
+
|
841
|
+
if dtype == 1:
|
842
|
+
self.wolftype = WOLF_ARRAY_FULL_INTEGER8
|
843
|
+
elif dtype in [2,3]:
|
844
|
+
self.wolftype = WOLF_ARRAY_FULL_INTEGER16
|
845
|
+
elif dtype in [4,5] :
|
846
|
+
self.wolftype = WOLF_ARRAY_FULL_INTEGER
|
847
|
+
elif dtype ==6:
|
848
|
+
self.wolftype = WOLF_ARRAY_FULL_SINGLE
|
849
|
+
elif dtype == 7:
|
850
|
+
self.wolftype = WOLF_ARRAY_FULL_DOUBLE
|
851
|
+
else:
|
852
|
+
logging.error(_('The datatype of the raster is not supported -- {}'.format(dtype)))
|
853
|
+
logging.error(_('Please convert the raster to a supported datatype - or upgrade the code to support this datatype'))
|
854
|
+
logging.error(_('See : read_txt_header and import_geotif in wolf_array.py'))
|
855
|
+
return
|
856
|
+
|
857
|
+
|
825
858
|
elif filename.endswith('.npy') and not os.path.exists(filename + '.txt'):
|
826
859
|
# Il y de fortes chances que cette matrice numpy provienne d'une modélisation GPU
|
827
860
|
# et donc que les coordonnées et la résolution soient disponibles dans un fichier parameters.json
|
@@ -1250,10 +1283,12 @@ class NewArray(wx.Dialog):
|
|
1250
1283
|
Once filled, user/__init__ must call "init_from_new"
|
1251
1284
|
"""
|
1252
1285
|
|
1253
|
-
def __init__(self, parent):
|
1286
|
+
def __init__(self, parent, mapviewer= None):
|
1254
1287
|
super(NewArray, self).__init__(parent, title=_('New array'), size=(300, 300),
|
1255
1288
|
style=wx.DEFAULT_DIALOG_STYLE | wx.TAB_TRAVERSAL | wx.OK)
|
1256
1289
|
|
1290
|
+
self._mapviewer = mapviewer
|
1291
|
+
|
1257
1292
|
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
|
1258
1293
|
|
1259
1294
|
glsizer = self.CreateSeparatedButtonSizer(wx.OK)
|
@@ -1313,6 +1348,19 @@ class NewArray(wx.Dialog):
|
|
1313
1348
|
# self.OK = wx.Button( self, wx.ID_ANY, u"Validate", wx.DefaultPosition, wx.DefaultSize, 0 )
|
1314
1349
|
# gSizer1.Add( self.OK, 0, wx.ALL, 5 )
|
1315
1350
|
|
1351
|
+
sizer_hor = wx.BoxSizer(wx.HORIZONTAL)
|
1352
|
+
self._sameas_button = wx.Button(self, wx.ID_ANY, u"Same as...", wx.DefaultPosition, wx.DefaultSize, 0)
|
1353
|
+
sizer_hor.Add(self._sameas_button, 0, wx.ALL, 5)
|
1354
|
+
|
1355
|
+
if self._mapviewer is not None:
|
1356
|
+
self._samezoom_parent = wx.Button(self, wx.ID_ANY, u"Current zoom...", wx.DefaultPosition, wx.DefaultSize, 0)
|
1357
|
+
sizer_hor.Add(self._samezoom_parent, 0, wx.ALL, 5)
|
1358
|
+
self._samezoom_parent.Bind(wx.EVT_BUTTON, self.on_samezoom_parent)
|
1359
|
+
|
1360
|
+
glsizer.Add(sizer_hor, 1, wx.ALL, 1)
|
1361
|
+
|
1362
|
+
self._sameas_button.Bind(wx.EVT_BUTTON, self.on_sameas)
|
1363
|
+
|
1316
1364
|
self.nbx.SetFocus()
|
1317
1365
|
self.nbx.SelectAll()
|
1318
1366
|
self.SetSizer(glsizer)
|
@@ -1320,6 +1368,50 @@ class NewArray(wx.Dialog):
|
|
1320
1368
|
|
1321
1369
|
self.Centre(wx.BOTH)
|
1322
1370
|
|
1371
|
+
def on_samezoom_parent(self, event):
|
1372
|
+
""" Fill the fields with the same values as the parent """
|
1373
|
+
|
1374
|
+
if self._mapviewer is not None:
|
1375
|
+
|
1376
|
+
with wx.TextEntryDialog(self, _('Round to the nearest x m ?'), _('Round to the nearest x m ?'), '10', style=wx.OK | wx.CANCEL) as dlg:
|
1377
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
1378
|
+
return # the user changed their mind
|
1379
|
+
|
1380
|
+
try:
|
1381
|
+
roundto = int(dlg.GetValue())
|
1382
|
+
except:
|
1383
|
+
logging.error(_('The value must be a number'))
|
1384
|
+
return
|
1385
|
+
|
1386
|
+
xmin, ymin, xmax, ymax = self._mapviewer.get_canvas_bounds()
|
1387
|
+
self.ox.SetValue(str((xmin // roundto) * roundto))
|
1388
|
+
self.oy.SetValue(str((ymin // roundto) * roundto))
|
1389
|
+
|
1390
|
+
self.dx.SetValue(str(1))
|
1391
|
+
self.dy.SetValue(str(1))
|
1392
|
+
|
1393
|
+
self.nbx.SetValue(str((math.ceil(xmax - xmin) // roundto) *roundto))
|
1394
|
+
self.nby.SetValue(str((math.ceil(ymax - ymin) // roundto) *roundto))
|
1395
|
+
|
1396
|
+
|
1397
|
+
def on_sameas(self, event):
|
1398
|
+
""" Fill the fields with the same values as a file array """
|
1399
|
+
|
1400
|
+
with wx.FileDialog(self, _("Choose a file"), wildcard="Wolf array files (*.bin;*.flt;*.tif,*.npy)|*.bin;*.flt;*.tif;*.npy",
|
1401
|
+
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fileDialog:
|
1402
|
+
if fileDialog.ShowModal() == wx.ID_CANCEL:
|
1403
|
+
return # the user changed their mind
|
1404
|
+
|
1405
|
+
filename = fileDialog.GetPath()
|
1406
|
+
header = header_wolf()
|
1407
|
+
header.read_txt_header(filename)
|
1408
|
+
|
1409
|
+
self.dx.SetValue(str(header.dx))
|
1410
|
+
self.dy.SetValue(str(header.dy))
|
1411
|
+
self.nbx.SetValue(str(header.nbx))
|
1412
|
+
self.nby.SetValue(str(header.nby))
|
1413
|
+
self.ox.SetValue(str(header.origx))
|
1414
|
+
self.oy.SetValue(str(header.origy))
|
1323
1415
|
|
1324
1416
|
#FIXME : Generalize to 3D
|
1325
1417
|
class CropDialog(wx.Dialog):
|
@@ -1329,10 +1421,12 @@ class CropDialog(wx.Dialog):
|
|
1329
1421
|
Used in "read_data" of a WolfArray
|
1330
1422
|
"""
|
1331
1423
|
|
1332
|
-
def __init__(self, parent):
|
1424
|
+
def __init__(self, parent, mapviewer=None):
|
1333
1425
|
super(CropDialog, self).__init__(parent, title=_('Cropping array'), size=(300, 300),
|
1334
1426
|
style=wx.DEFAULT_DIALOG_STYLE | wx.TAB_TRAVERSAL | wx.OK)
|
1335
1427
|
|
1428
|
+
self._mapviewer = mapviewer
|
1429
|
+
|
1336
1430
|
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
|
1337
1431
|
|
1338
1432
|
glsizer = self.CreateSeparatedButtonSizer(wx.OK)
|
@@ -1396,6 +1490,19 @@ class CropDialog(wx.Dialog):
|
|
1396
1490
|
# self.OK = wx.Button( self, wx.ID_ANY, u"Validate", wx.DefaultPosition, wx.DefaultSize, 0 )
|
1397
1491
|
# gSizer1.Add( self.OK, 0, wx.ALL, 5 )
|
1398
1492
|
|
1493
|
+
sizer_hor = wx.BoxSizer(wx.HORIZONTAL)
|
1494
|
+
self.sameas_button = wx.Button(self, wx.ID_ANY, u"Same as...", wx.DefaultPosition, wx.DefaultSize, 0)
|
1495
|
+
sizer_hor.Add(self.sameas_button, 0, wx.ALL, 5)
|
1496
|
+
|
1497
|
+
if self._mapviewer is not None:
|
1498
|
+
self.samezoom_parent = wx.Button(self, wx.ID_ANY, u"Current zoom...", wx.DefaultPosition, wx.DefaultSize, 0)
|
1499
|
+
sizer_hor.Add(self.samezoom_parent, 0, wx.ALL, 5)
|
1500
|
+
self.samezoom_parent.Bind(wx.EVT_BUTTON, self.on_samezoom_parent)
|
1501
|
+
|
1502
|
+
glsizer.Add(sizer_hor, 1, wx.ALL, 1)
|
1503
|
+
|
1504
|
+
self.sameas_button.Bind(wx.EVT_BUTTON, self.on_sameas)
|
1505
|
+
|
1399
1506
|
self.ox.SetFocus()
|
1400
1507
|
self.ox.SelectAll()
|
1401
1508
|
self.SetSizer(glsizer)
|
@@ -1416,6 +1523,51 @@ class CropDialog(wx.Dialog):
|
|
1416
1523
|
|
1417
1524
|
return myhead
|
1418
1525
|
|
1526
|
+
def on_samezoom_parent(self, event):
|
1527
|
+
""" Fill the fields with the same values as the parent """
|
1528
|
+
|
1529
|
+
if self._mapviewer is not None:
|
1530
|
+
|
1531
|
+
with wx.TextEntryDialog(self, _('Round to the nearest x m ?'), _('Round to the nearest x m ?'), '10', style=wx.OK | wx.CANCEL) as dlg:
|
1532
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
1533
|
+
return # the user changed their mind
|
1534
|
+
|
1535
|
+
try:
|
1536
|
+
roundto = int(dlg.GetValue())
|
1537
|
+
except:
|
1538
|
+
logging.error(_('The value must be a number'))
|
1539
|
+
return
|
1540
|
+
|
1541
|
+
xmin, ymin, xmax, ymax = self._mapviewer.get_canvas_bounds()
|
1542
|
+
self.ox.SetValue(str((xmin // roundto) * roundto))
|
1543
|
+
self.oy.SetValue(str((ymin // roundto) * roundto))
|
1544
|
+
|
1545
|
+
# self.dx.SetValue(str(1))
|
1546
|
+
# self.dy.SetValue(str(1))
|
1547
|
+
|
1548
|
+
self.ex.SetValue(str((math.ceil(xmax // roundto) * roundto)))
|
1549
|
+
self.ey.SetValue(str((math.ceil(ymax // roundto) * roundto)))
|
1550
|
+
|
1551
|
+
|
1552
|
+
def on_sameas(self, event):
|
1553
|
+
""" Fill the fields with the same values as a file array """
|
1554
|
+
|
1555
|
+
with wx.FileDialog(self, _("Choose a file"), wildcard="Wolf array files (*.bin;*.flt;*.tif,*.npy)|*.bin;*.flt;*.tif;*.npy",
|
1556
|
+
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fileDialog:
|
1557
|
+
if fileDialog.ShowModal() == wx.ID_CANCEL:
|
1558
|
+
return # the user changed their mind
|
1559
|
+
|
1560
|
+
filename = fileDialog.GetPath()
|
1561
|
+
header = header_wolf()
|
1562
|
+
header.read_txt_header(filename)
|
1563
|
+
|
1564
|
+
# self.dx.SetValue(str(header.dx))
|
1565
|
+
# self.dy.SetValue(str(header.dy))
|
1566
|
+
self.ox.SetValue(str(header.origx))
|
1567
|
+
self.oy.SetValue(str(header.origy))
|
1568
|
+
self.ex.SetValue(str(header.origx + header.nbx * header.dx))
|
1569
|
+
self.ey.SetValue(str(header.origy + header.nby * header.dy))
|
1570
|
+
|
1419
1571
|
import string
|
1420
1572
|
class IntValidator(wx.Validator):
|
1421
1573
|
''' Validates data as it is entered into the text controls. '''
|
@@ -5109,7 +5261,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5109
5261
|
elif create:
|
5110
5262
|
assert self.wx_exists, _('Array creation required a running wx App to display the UI')
|
5111
5263
|
# Dialog for the creation of a new array
|
5112
|
-
new = NewArray(None)
|
5264
|
+
new = NewArray(None, self.get_mapviewer())
|
5113
5265
|
|
5114
5266
|
ret = new.ShowModal()
|
5115
5267
|
if ret == wx.ID_CANCEL:
|
@@ -5830,6 +5982,117 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5830
5982
|
|
5831
5983
|
self.array = np.ma.asarray(locarray)
|
5832
5984
|
|
5985
|
+
def import_vrt(self, fn:str='', which:int = None, crop:list[float]=None):
|
5986
|
+
""" Import a VRT file
|
5987
|
+
|
5988
|
+
:param fn: filename
|
5989
|
+
:param which: band to import
|
5990
|
+
:param crop: crop the data - [xmin, xmax, ymin, ymax]
|
5991
|
+
"""
|
5992
|
+
|
5993
|
+
if fn !='':
|
5994
|
+
pass
|
5995
|
+
elif self.filename !='':
|
5996
|
+
fn = self.filename
|
5997
|
+
else:
|
5998
|
+
return
|
5999
|
+
|
6000
|
+
if not os.path.exists(fn):
|
6001
|
+
logging.error(_('File not found'))
|
6002
|
+
return
|
6003
|
+
|
6004
|
+
# convert vrt to tif and mport tif
|
6005
|
+
with tempfile.TemporaryDirectory() as tmpdirname:
|
6006
|
+
tmpfile = join(tmpdirname, 'tmp.tif')
|
6007
|
+
|
6008
|
+
if crop is not None:
|
6009
|
+
|
6010
|
+
tmpdx = self.dx
|
6011
|
+
|
6012
|
+
fn_crop = fn + '_crop.tif'
|
6013
|
+
if type(crop) is np.ndarray:
|
6014
|
+
pass
|
6015
|
+
elif type(crop) is list:
|
6016
|
+
pass
|
6017
|
+
else:
|
6018
|
+
if not self.wx_exists:
|
6019
|
+
logging.error(_('Crop must be a list or a numpy array with 4 values - xmin, xmax, ymin, ymax'))
|
6020
|
+
return
|
6021
|
+
|
6022
|
+
raster_in:gdal.Dataset
|
6023
|
+
raster_in = gdal.Open(fn)
|
6024
|
+
|
6025
|
+
proj = raster_in.GetProjection()
|
6026
|
+
# check if proj is epsg:31370
|
6027
|
+
if 'Lambert 72' not in proj and "31370" not in proj:
|
6028
|
+
logging.error(_('{} projection is not Lambert 72 - EPSG:31370').format(fn))
|
6029
|
+
|
6030
|
+
raster_in2 = gdal.Dataset()
|
6031
|
+
gdal.Warp(raster_in2, raster_in, dstSRS='EPSG:31370')
|
6032
|
+
|
6033
|
+
# Close the raster_in
|
6034
|
+
raster_in.FlushCache()
|
6035
|
+
raster_in = None
|
6036
|
+
|
6037
|
+
raster_in = raster_in2
|
6038
|
+
|
6039
|
+
if raster_in is None:
|
6040
|
+
logging.error(_('Could not reproject the file {fn}'))
|
6041
|
+
return
|
6042
|
+
|
6043
|
+
geotr = raster_in.GetGeoTransform()
|
6044
|
+
self.dx = geotr[1]
|
6045
|
+
self.dy = abs(geotr[5])
|
6046
|
+
|
6047
|
+
ulx = geotr[0]
|
6048
|
+
uly = geotr[3]
|
6049
|
+
llx = ulx + geotr[1] * raster_in.RasterXSize
|
6050
|
+
lly = uly + geotr[5] * raster_in.RasterYSize
|
6051
|
+
|
6052
|
+
newcrop = CropDialog(None, self.get_mapviewer())
|
6053
|
+
|
6054
|
+
if self.wx_exists:
|
6055
|
+
bounds = self.mapviewer.get_canvas_bounds()
|
6056
|
+
|
6057
|
+
newcrop.dx.Value = str(self.dx)
|
6058
|
+
newcrop.dy.Value = str(self.dy)
|
6059
|
+
|
6060
|
+
newcrop.dx.Enable(False)
|
6061
|
+
newcrop.dy.Enable(False)
|
6062
|
+
|
6063
|
+
newcrop.ox.Value = str(float((bounds[0] // 50.) * 50.))
|
6064
|
+
newcrop.ex.Value = str(float((bounds[2] // 50.) * 50.))
|
6065
|
+
newcrop.oy.Value = str(float((bounds[1] // 50.) * 50.))
|
6066
|
+
newcrop.ey.Value = str(float((bounds[3] // 50.) * 50.))
|
6067
|
+
|
6068
|
+
badvalues = True
|
6069
|
+
while badvalues:
|
6070
|
+
badvalues = False
|
6071
|
+
|
6072
|
+
ret = newcrop.ShowModal()
|
6073
|
+
if ret == wx.ID_CANCEL:
|
6074
|
+
newcrop.Destroy()
|
6075
|
+
return
|
6076
|
+
else:
|
6077
|
+
crop = [float(newcrop.ox.Value), float(newcrop.ex.Value),
|
6078
|
+
float(newcrop.oy.Value), float(newcrop.ey.Value)]
|
6079
|
+
|
6080
|
+
tmpdx = float(newcrop.dx.Value)
|
6081
|
+
tmpdy = float(newcrop.dy.Value)
|
6082
|
+
|
6083
|
+
if self.dx != tmpdx or self.dy != tmpdy:
|
6084
|
+
if tmpdx / self.dx != tmpdy / self.dy:
|
6085
|
+
badvalues = True
|
6086
|
+
|
6087
|
+
newcrop.Destroy()
|
6088
|
+
|
6089
|
+
xmin, xmax, ymin, ymax = crop
|
6090
|
+
|
6091
|
+
gdal.Translate(tmpfile, fn, projWin=[xmin, ymax, xmax, ymin])
|
6092
|
+
else:
|
6093
|
+
gdal.Translate(tmpfile, fn)
|
6094
|
+
self.import_geotif(tmpfile, which)
|
6095
|
+
|
5833
6096
|
def import_geotif(self, fn:str='', which:int = None, crop:list[float]=None):
|
5834
6097
|
"""
|
5835
6098
|
Import de la matrice au format Geotiff
|
@@ -5900,7 +6163,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5900
6163
|
llx = ulx + geotr[1] * raster_in.RasterXSize
|
5901
6164
|
lly = uly + geotr[5] * raster_in.RasterYSize
|
5902
6165
|
|
5903
|
-
newcrop = CropDialog(None)
|
6166
|
+
newcrop = CropDialog(None, self.get_mapviewer())
|
5904
6167
|
|
5905
6168
|
if self.wx_exists:
|
5906
6169
|
bounds = self.mapviewer.get_canvas_bounds()
|
@@ -7784,6 +8047,16 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7784
8047
|
if update_min_max:
|
7785
8048
|
self.mypal.distribute_values(self.array.min(), self.array.max())
|
7786
8049
|
|
8050
|
+
elif self.filename.endswith('.vrt'):
|
8051
|
+
self.read_txt_header()
|
8052
|
+
|
8053
|
+
if self.preload:
|
8054
|
+
update_min_max = check_threshold(self.nbx, self.nby, THRESHOLD)
|
8055
|
+
self.import_vrt(which= which_band, crop = self.cropini)
|
8056
|
+
self.loaded = True
|
8057
|
+
|
8058
|
+
if update_min_max:
|
8059
|
+
self.mypal.distribute_values(self.array.min(), self.array.max())
|
7787
8060
|
else:
|
7788
8061
|
self.read_txt_header()
|
7789
8062
|
|
@@ -8044,7 +8317,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
8044
8317
|
pass
|
8045
8318
|
else:
|
8046
8319
|
if self.wx_exists:
|
8047
|
-
newcrop = CropDialog(None)
|
8320
|
+
newcrop = CropDialog(None, self.get_mapviewer())
|
8048
8321
|
|
8049
8322
|
if self.mapviewer is not None:
|
8050
8323
|
bounds = self.mapviewer.get_canvas_bounds()
|
wolfhece/wolf_vrt.py
CHANGED
@@ -38,12 +38,13 @@ def create_vrt(wdir:str, fout:str='out.vrt', format:str='tif'):
|
|
38
38
|
myvrt = None
|
39
39
|
|
40
40
|
os.chdir(curdir)
|
41
|
+
|
41
42
|
def _get_diverged_relative_path(path: Path, base: Path) -> Path:
|
42
43
|
"""
|
43
44
|
Get relative path from base to path, even if they only share part of their paths.
|
44
45
|
More general than the next function "_get_relative_path", especially for not "child/parents paths"
|
45
46
|
"""
|
46
|
-
|
47
|
+
|
47
48
|
# Parts of the paths
|
48
49
|
relative_path_parts = path.parts
|
49
50
|
base_parts = base.parts
|
@@ -54,8 +55,8 @@ def _get_diverged_relative_path(path: Path, base: Path) -> Path:
|
|
54
55
|
|
55
56
|
# Building of the relative path, by adding ".." from the divergence point
|
56
57
|
return Path(*(['..'] * (len(base_parts) - i) + list(relative_path_parts[i:])))
|
57
|
-
|
58
|
-
|
58
|
+
|
59
|
+
|
59
60
|
def _get_relative_path(path:Path, base:Path):
|
60
61
|
"""
|
61
62
|
Get relative path from base to path
|
@@ -95,7 +96,7 @@ def create_vrt_from_files(files:list[Path]=[], fout:Path='assembly.vrt'):
|
|
95
96
|
# change working directory to the parent of the output file
|
96
97
|
os.chdir(fout.parent)
|
97
98
|
# work with relative paths
|
98
|
-
|
99
|
+
|
99
100
|
myvrt = gdal.BuildVRT(str(fout.with_suffix('.vrt').name) , [str(_get_diverged_relative_path(file, fout.parent)) for file in files])
|
100
101
|
# close the dataset -- force to write on disk
|
101
102
|
myvrt = None
|
@@ -108,7 +109,7 @@ def create_vrt_from_files_first_based(files:list[Path]=[], fout:Path='assembly.v
|
|
108
109
|
|
109
110
|
Restreint l'emprise et force la résolution sur le premier fichier listé
|
110
111
|
"""
|
111
|
-
|
112
|
+
|
112
113
|
if isinstance(fout, str):
|
113
114
|
fout = Path(fout)
|
114
115
|
|
@@ -146,17 +147,17 @@ def create_vrt_from_files_first_based(files:list[Path]=[], fout:Path='assembly.v
|
|
146
147
|
|
147
148
|
# retain current working directory
|
148
149
|
oldcwd = os.getcwd()
|
149
|
-
# change working directory to the parent of the output file
|
150
|
-
os.chdir(fout.parent.absolute())
|
151
|
-
# work with relative paths
|
150
|
+
# change working directory to the parent of the output file
|
151
|
+
os.chdir(fout.parent.absolute())
|
152
|
+
# work with relative paths
|
152
153
|
myvrt = gdal.BuildVRT(str(fout.with_suffix('.vrt').name),[str(_get_diverged_relative_path(file, fout.parent)) for file in files], options=options) #str(_get_diverged_relative_path(file, fout.parent)) for file in files
|
153
|
-
|
154
|
+
|
154
155
|
# close the dataset -- force to write on disk
|
155
156
|
myvrt = None
|
156
157
|
# restore working directory
|
157
158
|
os.chdir(oldcwd)
|
158
|
-
|
159
|
-
|
159
|
+
|
160
|
+
|
160
161
|
def create_vrt_from_diverged_files(files:list[Path]=[], fout:Path='assembly.vrt'):
|
161
162
|
"""
|
162
163
|
Agglomération de tous les fichiers énumérés dans files dans un layer virtuel .vrt
|
@@ -178,7 +179,7 @@ def create_vrt_from_diverged_files(files:list[Path]=[], fout:Path='assembly.vrt'
|
|
178
179
|
# change working directory to the parent of the output file
|
179
180
|
os.chdir(fout.parent)
|
180
181
|
# work with relative paths
|
181
|
-
|
182
|
+
|
182
183
|
myvrt = gdal.BuildVRT(str(fout.with_suffix('.vrt').name) , [str(_get_diverged_relative_path(file, fout.parent)) for file in files])
|
183
184
|
# close the dataset -- force to write on disk
|
184
185
|
myvrt = None
|
@@ -191,7 +192,7 @@ def create_vrt_from_diverged_files_first_based(files:list[Path]=[], fout:Path='a
|
|
191
192
|
|
192
193
|
Restreint l'emprise et force la résolution sur le premier fichier listé
|
193
194
|
"""
|
194
|
-
|
195
|
+
|
195
196
|
if isinstance(fout, str):
|
196
197
|
fout = Path(fout)
|
197
198
|
|
@@ -229,11 +230,11 @@ def create_vrt_from_diverged_files_first_based(files:list[Path]=[], fout:Path='a
|
|
229
230
|
|
230
231
|
# retain current working directory
|
231
232
|
oldcwd = os.getcwd()
|
232
|
-
# change working directory to the parent of the output file
|
233
|
-
os.chdir(fout.parent.absolute())
|
234
|
-
# work with relative paths
|
233
|
+
# change working directory to the parent of the output file
|
234
|
+
os.chdir(fout.parent.absolute())
|
235
|
+
# work with relative paths
|
235
236
|
myvrt = gdal.BuildVRT(str(fout.with_suffix('.vrt').name),[str(_get_diverged_relative_path(file, fout.parent)) for file in files], options=options) #str(_get_diverged_relative_path(file, fout.parent)) for file in files
|
236
|
-
|
237
|
+
|
237
238
|
# close the dataset -- force to write on disk
|
238
239
|
myvrt = None
|
239
240
|
# restore working directory
|
@@ -1,5 +1,5 @@
|
|
1
1
|
wolfhece/Coordinates_operations.py,sha256=YyWlAwKManb-ReQrmP37rEXxehunUCihmkeDYX6qTAQ,8037
|
2
|
-
wolfhece/CpGrid.py,sha256=
|
2
|
+
wolfhece/CpGrid.py,sha256=_piG1u-ua7NzWh_PHJYTmxuPJ43ZfeYKNEQgZIJwDJ8,10660
|
3
3
|
wolfhece/GraphNotebook.py,sha256=2TR8qjEwpMtl34QWgYNVe_PgTnuwhUxT5f9Y2zrmN2U,28257
|
4
4
|
wolfhece/GraphProfile.py,sha256=OCgJo0YFFBI6H1z-5egJsOOoWF_iziiza0-bbPejNMc,69656
|
5
5
|
wolfhece/Lidar2002.py,sha256=bX-nIzdpjD7rOfEgJpTeaW6rIdAXwDp_z4YTM9CgANY,6068
|
@@ -7,7 +7,7 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
|
|
7
7
|
wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
|
8
8
|
wolfhece/PyConfig.py,sha256=gyl1MesSJZaVpC1XtvD78PpnE1VD3hGM3HPQXTJ3eJg,12963
|
9
9
|
wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
|
10
|
-
wolfhece/PyDraw.py,sha256=
|
10
|
+
wolfhece/PyDraw.py,sha256=baeO6vrXsDEfAfYl6sjSiWNXJSDQ2vKhbB94X59GnlM,536663
|
11
11
|
wolfhece/PyGui.py,sha256=RlrLoCBdbiMnR4FSUD1yuy8fs--hxUl_zPu7zuduCLE,144706
|
12
12
|
wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
|
13
13
|
wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
|
@@ -52,11 +52,11 @@ wolfhece/pywalous.py,sha256=mWB7UxlYMIbPxNUDlONQEjcOOy9VSaRU9aYWZ5IFLu8,19164
|
|
52
52
|
wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
|
53
53
|
wolfhece/textpillow.py,sha256=map7HsGYML_o5NHRdFg2s_TVQed_lDnpYNDv27MM0Vw,14130
|
54
54
|
wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
|
55
|
-
wolfhece/wolf_array.py,sha256=
|
55
|
+
wolfhece/wolf_array.py,sha256=B29IemUUz358RKfNCkFOrwakKRQTZyCM6w3xQKQixqM,439060
|
56
56
|
wolfhece/wolf_hist.py,sha256=7jeVrgSkM3ErJO6SRMH_PGzfLjIdw8vTy87kesldggk,3582
|
57
57
|
wolfhece/wolf_texture.py,sha256=ecoXXmmcLuyG1oPqU2dB_k03qMTCLTVQoSq1xi1EalU,17359
|
58
58
|
wolfhece/wolf_tiles.py,sha256=v-HohqaWuMYdn75XLnA22dlloAG90iwnIqrgnB0ASQ4,10488
|
59
|
-
wolfhece/wolf_vrt.py,sha256=
|
59
|
+
wolfhece/wolf_vrt.py,sha256=wbxXVN7TL9zgdyF79S-4e3pje6wJEAgBEfF_Y8kkzxs,14271
|
60
60
|
wolfhece/wolf_zi_db.py,sha256=baE0niMCzybWGSvPJc5FNxo9ZxsGfU4p-FmfiavFHAs,12967
|
61
61
|
wolfhece/wolfresults_2D.py,sha256=GbuYSN1haTctY9AqUyAt1xQCOVpoUgSURD9d2XIqRXw,184827
|
62
62
|
wolfhece/xyz_file.py,sha256=1pzLFmmdHca4yBVR9Jitic6N82rY28mRytGC1zMbY28,6615
|
@@ -80,7 +80,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
|
|
80
80
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
81
81
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
82
82
|
wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
|
83
|
-
wolfhece/apps/version.py,sha256=
|
83
|
+
wolfhece/apps/version.py,sha256=wdCAGcw9n-tzO9jV57g9pm5Oa39DfEUaRLUH7_GIcB8,389
|
84
84
|
wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
|
85
85
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
86
86
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -154,7 +154,7 @@ wolfhece/lagrangian/particles.py,sha256=S52_-3rzgVhift6l4Gznvsf_RTggzvNaD1dPvQUr
|
|
154
154
|
wolfhece/lagrangian/velocity_field.py,sha256=oGVjNm98gEpawreFIrC1lDyC5bEhkk2CsyYAlF1Kq50,10574
|
155
155
|
wolfhece/lazviewer/__init__.py,sha256=lz60EpQOBZ-zjvYzff6Y11jzAmC7mjOaxRYAfoqizQs,473
|
156
156
|
wolfhece/lazviewer/_add_path.py,sha256=GDwPnzHuGRXGriDNcu1SQ6HetFDGIApeAQZEzYArGvI,605
|
157
|
-
wolfhece/lazviewer/laz_viewer.py,sha256=
|
157
|
+
wolfhece/lazviewer/laz_viewer.py,sha256=FvOerthjaWNE8g_Nbgahty2lrt-qPxTa07SFDg7AsNo,65595
|
158
158
|
wolfhece/lazviewer/libs/Qt5Core.dll,sha256=sTJ_ctYFY9KHMNytF-lzH_078zIvnKTjN-71FDkOWPw,4924928
|
159
159
|
wolfhece/lazviewer/libs/Qt5Gui.dll,sha256=07BeaOeYByraGkKYeDiSDYLawHM8tyd55pVJlKbZ4Y0,5436416
|
160
160
|
wolfhece/lazviewer/libs/Qt5Network.dll,sha256=U-9FiLE9LUKru8r8EQxTnwwlMpwS8JzUtenhkKTCox0,1038336
|
@@ -180,7 +180,7 @@ wolfhece/lazviewer/vfuncsdir/vfuncs.cp310-win_amd64.pyd,sha256=4mvnfY9Wd-oE7rJR1
|
|
180
180
|
wolfhece/lazviewer/vfuncsdir/vfuncs.cp39-win_amd64.pyd,sha256=MzAEyrgnqja-FjHGtL-jbWg9o0f2SWUDVimXBN-8kCA,135168
|
181
181
|
wolfhece/lazviewer/viewer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
182
182
|
wolfhece/lazviewer/viewer/viewer.exe,sha256=pF5nwE8vMWlEzkk-SOekae9zpOsPhTWhZbqaJntumJc,202240
|
183
|
-
wolfhece/lazviewer/viewer/viewer.py,sha256=
|
183
|
+
wolfhece/lazviewer/viewer/viewer.py,sha256=fdAyD9ImiIdxod9QsQfhlXfQsT_kRV1hzkeRaHRlGog,24669
|
184
184
|
wolfhece/libs/MSVCP140.dll,sha256=2GrBWBI6JFuSdZLIDMAg_qKcjErdwURGbEYloAypx3o,565640
|
185
185
|
wolfhece/libs/WolfDll.dll,sha256=E8SeV0AHVXW5ikAQuVtijqIvaYx7UIMeqvnnsmTMCT8,132934144
|
186
186
|
wolfhece/libs/__init__.py,sha256=x7QvPd7hjL-Xl7RjlA8y6rcvKCkYu3JpFE3YnzUJeCY,3326
|
@@ -293,8 +293,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
|
|
293
293
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
294
294
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
295
295
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
296
|
-
wolfhece-2.1.
|
297
|
-
wolfhece-2.1.
|
298
|
-
wolfhece-2.1.
|
299
|
-
wolfhece-2.1.
|
300
|
-
wolfhece-2.1.
|
296
|
+
wolfhece-2.1.118.dist-info/METADATA,sha256=Hmo148Zgb9q8lIydgjraMgU-UzRdAYO4-aFEQIX4Lvo,2587
|
297
|
+
wolfhece-2.1.118.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
298
|
+
wolfhece-2.1.118.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
|
299
|
+
wolfhece-2.1.118.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
300
|
+
wolfhece-2.1.118.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|