wolfhece 2.2.38__py3-none-any.whl → 2.2.40__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/Coordinates_operations.py +5 -0
- wolfhece/GraphNotebook.py +72 -1
- wolfhece/GraphProfile.py +1 -1
- wolfhece/MulticriteriAnalysis.py +1579 -0
- wolfhece/PandasGrid.py +62 -1
- wolfhece/PyCrosssections.py +194 -43
- wolfhece/PyDraw.py +891 -73
- wolfhece/PyGui.py +913 -72
- wolfhece/PyGuiHydrology.py +528 -74
- wolfhece/PyPalette.py +26 -4
- wolfhece/PyParams.py +33 -0
- wolfhece/PyPictures.py +2 -2
- wolfhece/PyVertex.py +25 -0
- wolfhece/PyVertexvectors.py +94 -28
- wolfhece/PyWMS.py +52 -36
- wolfhece/acceptability/acceptability.py +15 -8
- wolfhece/acceptability/acceptability_gui.py +507 -360
- wolfhece/acceptability/func.py +80 -183
- wolfhece/apps/version.py +1 -1
- wolfhece/compare_series.py +480 -0
- wolfhece/drawing_obj.py +12 -1
- wolfhece/hydrology/Catchment.py +228 -162
- wolfhece/hydrology/Internal_variables.py +43 -2
- wolfhece/hydrology/Models_characteristics.py +69 -67
- wolfhece/hydrology/Optimisation.py +893 -182
- wolfhece/hydrology/PyWatershed.py +267 -165
- wolfhece/hydrology/SubBasin.py +185 -140
- wolfhece/hydrology/cst_exchanges.py +76 -1
- wolfhece/hydrology/forcedexchanges.py +413 -49
- wolfhece/hydrology/read.py +65 -5
- wolfhece/hydrometry/kiwis.py +14 -7
- wolfhece/insyde_be/INBE_func.py +746 -0
- wolfhece/insyde_be/INBE_gui.py +1776 -0
- wolfhece/insyde_be/__init__.py +3 -0
- wolfhece/interpolating_raster.py +366 -0
- wolfhece/irm_alaro.py +1457 -0
- wolfhece/irm_qdf.py +889 -57
- wolfhece/lazviewer/laz_viewer.py +4 -1
- wolfhece/lifewatch.py +6 -3
- wolfhece/picc.py +124 -8
- wolfhece/pyLandUseFlanders.py +146 -0
- wolfhece/pydownloader.py +35 -1
- wolfhece/pywalous.py +225 -31
- wolfhece/toolshydrology_dll.py +149 -0
- wolfhece/wolf_array.py +63 -25
- {wolfhece-2.2.38.dist-info → wolfhece-2.2.40.dist-info}/METADATA +3 -1
- {wolfhece-2.2.38.dist-info → wolfhece-2.2.40.dist-info}/RECORD +50 -41
- {wolfhece-2.2.38.dist-info → wolfhece-2.2.40.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.38.dist-info → wolfhece-2.2.40.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.38.dist-info → wolfhece-2.2.40.dist-info}/top_level.txt +0 -0
wolfhece/lazviewer/laz_viewer.py
CHANGED
@@ -537,6 +537,9 @@ class xyz_laz_grids():
|
|
537
537
|
""" Ensemble de grids """
|
538
538
|
|
539
539
|
def __init__(self, dir_grids:str, create:bool=False) -> None:
|
540
|
+
|
541
|
+
dir_grids = str(dir_grids)
|
542
|
+
|
540
543
|
self.grids:list[xyz_laz_grid] = []
|
541
544
|
self.colors = Classification_LAZ()
|
542
545
|
self.colors.init_2023()
|
@@ -747,7 +750,7 @@ class xyz_laz_grids():
|
|
747
750
|
|
748
751
|
return figmpl
|
749
752
|
|
750
|
-
def create_from_laz(self, dir_laz:
|
753
|
+
def create_from_laz(self, dir_laz:Path, shape:str=None, ds:float = 50, force_format = np.float64):
|
751
754
|
|
752
755
|
try:
|
753
756
|
from ..PyVertexvectors import Zones
|
wolfhece/lifewatch.py
CHANGED
@@ -269,7 +269,7 @@ def get_LifeWatch_bounds(year:int,
|
|
269
269
|
'RGBA',
|
270
270
|
'Palette'] = 'WolfArray',
|
271
271
|
force_size:bool= True,
|
272
|
-
) -> WolfArray | np.ndarray | Image.Image:
|
272
|
+
) -> tuple[WolfArray | np.ndarray | Image.Image, tuple[float, float, float, float]]:
|
273
273
|
|
274
274
|
|
275
275
|
if year not in YEARS:
|
@@ -297,7 +297,10 @@ def get_LifeWatch_bounds(year:int,
|
|
297
297
|
mybytes = getLifeWatch(f'{MAP_LW}_{year}',
|
298
298
|
xmin, ymin, # Lower left corner
|
299
299
|
xmax, ymax, # Upper right corner
|
300
|
-
w=
|
300
|
+
# Previous version was w=MAX_SIZE, h=None
|
301
|
+
# but that ignores the computation of w,h above.
|
302
|
+
# Moreover it makes it hard to get a specific size/resolution.
|
303
|
+
w, h, # Width and height of the image [pixels]
|
301
304
|
tofile=False, # Must be False to get bytes --> save the image to ".\Lifewatch.png" if True
|
302
305
|
format='image/png; mode=8bit')
|
303
306
|
|
@@ -366,7 +369,7 @@ def get_LifeWatch_center_width_height(year: int,
|
|
366
369
|
'NUMPY',
|
367
370
|
'RGB',
|
368
371
|
'RGBA',
|
369
|
-
'Palette'] = 'WolfArray') -> WolfArray | np.ndarray | Image.Image:
|
372
|
+
'Palette'] = 'WolfArray') -> tuple[WolfArray | np.ndarray | Image.Image, tuple[float, float, float, float]]:
|
370
373
|
"""
|
371
374
|
Get the LifeWatch map for the given year and center
|
372
375
|
:param year: year of the map
|
wolfhece/picc.py
CHANGED
@@ -14,17 +14,58 @@ from typing import List, Union
|
|
14
14
|
from shapely.geometry import Polygon, Point
|
15
15
|
import logging
|
16
16
|
import wx
|
17
|
-
|
17
|
+
import geopandas as gpd
|
18
|
+
import numpy as np
|
18
19
|
from .PyTranslate import _
|
19
20
|
from .PyVertexvectors import Zones, zone, vector, wolfvertex
|
20
21
|
from .PyVertex import cloud_vertices, getRGBfromI, getIfromRGB
|
21
22
|
from .drawing_obj import Element_To_Draw
|
22
23
|
from .wolf_array import WolfArray
|
23
24
|
|
25
|
+
def bbox_creation(study_area_path):
|
26
|
+
|
27
|
+
gdf = gpd.read_file(study_area_path)
|
28
|
+
bounds = gdf.total_bounds # [minx, miny, maxx, maxy]
|
29
|
+
minx, miny, maxx, maxy = bounds
|
30
|
+
|
31
|
+
points = [
|
32
|
+
(minx, miny), # coin inférieur gauche
|
33
|
+
(minx, maxy), # coin supérieur gauche
|
34
|
+
(maxx, maxy), # coin supérieur droit
|
35
|
+
(maxx, miny), # coin inférieur droit
|
36
|
+
(minx, miny) # contour fermé
|
37
|
+
]
|
38
|
+
bbox = Polygon(points)
|
39
|
+
return bbox
|
40
|
+
|
41
|
+
def adding_layer_to_zone(fn:Path, bbox:Polygon = None, ZonesPicc: Zones = None):
|
42
|
+
"""
|
43
|
+
Add other layers informations to the picc zones
|
44
|
+
! Need GEOREF_ID as principal "name" of the zone !
|
45
|
+
"""
|
46
|
+
content = gpd.read_file(fn, bbox=bbox)
|
47
|
+
if bbox is not None:
|
48
|
+
# filter content
|
49
|
+
content = content.cx[bbox.bounds[0]:bbox.bounds[2], bbox.bounds[1]:bbox.bounds[3]]
|
50
|
+
|
51
|
+
for row in content.iterrows(): #lire picc
|
52
|
+
_, row = row
|
53
|
+
keys = list(row.keys())
|
54
|
+
keys.remove('geometry') #already into vectors (.myvectors)
|
55
|
+
keys = ['GEOREF_ID', 'NATUR_CODE', 'NATUR_DESC']
|
56
|
+
for zones in ZonesPicc.myzones: #lire Zones
|
57
|
+
for vector in zones.myvectors:
|
58
|
+
if str(vector) == str(row['GEOREF_ID']) : #si le même id, alors compléter
|
59
|
+
for key in keys:
|
60
|
+
read_value = []
|
61
|
+
read_value.append(row[key])
|
62
|
+
arr = np.array(read_value, dtype=str)
|
63
|
+
zones.add_values(key=str(key), values=arr)
|
64
|
+
return print("Traitement des layers spécifiques du PICC terminé")
|
65
|
+
|
24
66
|
class Picc_data(Element_To_Draw):
|
25
67
|
"""
|
26
68
|
Read and show PICC data -- see https://geoportail.wallonie.be/georeferentiel/PICC
|
27
|
-
|
28
69
|
"""
|
29
70
|
|
30
71
|
def __init__(self,
|
@@ -33,13 +74,15 @@ class Picc_data(Element_To_Draw):
|
|
33
74
|
mapviewer = None,
|
34
75
|
need_for_wx:bool = False,
|
35
76
|
data_dir:Path = Path(r'./data/PICC'),
|
36
|
-
bbox:Union[Polygon, list[float]] = None
|
77
|
+
bbox:Union[Polygon, list[float]] = None,
|
78
|
+
filename_vector:str='PICC_Vesdre.shp',
|
79
|
+
filename_point:str='PICC_Vesdre_points.shp') -> None:
|
37
80
|
|
38
81
|
super().__init__(idx = idx, plotted = plotted, mapviewer = mapviewer, need_for_wx= need_for_wx)
|
39
82
|
|
40
83
|
self.data_dir = data_dir
|
41
|
-
self._filename_vector =
|
42
|
-
self._filename_points =
|
84
|
+
self._filename_vector = filename_vector
|
85
|
+
self._filename_points = filename_point
|
43
86
|
self.zones = None
|
44
87
|
self.cloud = None
|
45
88
|
self._colors = {'Habitation': [255, 0, 0], 'Annexe': [0, 255, 0], 'Culture, sport ou loisir': [0, 0, 255], 'Autre': [10, 10, 10]}
|
@@ -120,7 +163,7 @@ class Picc_data(Element_To_Draw):
|
|
120
163
|
self.cloud.myprop.color = getIfromRGB([0, 0, 255])
|
121
164
|
else:
|
122
165
|
logging.error(_('Point file not found : {}').format(pointfile))
|
123
|
-
|
166
|
+
|
124
167
|
if self.mapviewer is not None:
|
125
168
|
dlg = wx.FileDialog(None, _('Select a point file'), wildcard="Shapefile (*.shp)|*.shp|Gpkg (*.gpkg)|*.gpkg", style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
126
169
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
@@ -139,7 +182,80 @@ class Picc_data(Element_To_Draw):
|
|
139
182
|
except:
|
140
183
|
logging.error(_('File not found : {}').format(pathname))
|
141
184
|
|
185
|
+
|
142
186
|
|
187
|
+
def read_vectors_cloud_picc(self, data_dir:Path = None, path_vector:str = r"PICC_Vesdre.shp", path_points:str = r"PICC_Vesdre_points.shp",
|
188
|
+
bbox:Union[Polygon, list[float]] = None, column:str = "GEOREF_ID", additional_layers:bool = None) -> None:
|
189
|
+
"""
|
190
|
+
Complete reading of the PICC files : vectors (.shp) and clouds (.shp). For the vectors, read any attributes that exist, a priori :
|
191
|
+
['NATUR_CODE', 'NATUR_DESC', 'PRECIS_XY', 'PRECIS_Z', 'TECH_LEVE','DATE_LEVE', 'DATE_CREAT', 'DATE_MODIF', 'DATE_TRANS', 'CODE_WALTO']
|
192
|
+
Pay attention, this uses directly Zone() but may be slow for a large raster. Use "create_zone_picc"
|
193
|
+
"""
|
194
|
+
if data_dir is None:
|
195
|
+
data_dir = self.data_dir
|
196
|
+
|
197
|
+
logging.info('*PICC reading and Zone creation')
|
198
|
+
self._filename_vector = path_vector
|
199
|
+
vector_file = data_dir / self._filename_vector
|
200
|
+
if vector_file.exists():
|
201
|
+
#Charger la Zones contenants les zone (GEOREF_ID, vectors)
|
202
|
+
self.zones = Zones(data_dir / self._filename_vector, bbox = bbox, colname = column)
|
203
|
+
#Ajouter des attributs du PICC ['GEOREF_ID', 'NATUR_CODE', 'NATUR_DESC', 'PRECIS_XY', 'PRECIS_Z', 'TECH_LEVE', 'DATE_LEVE', 'DATE_CREAT', 'DATE_MODIF', 'DATE_TRANS', 'CODE_WALTO']
|
204
|
+
if additional_layers == True:
|
205
|
+
adding_layer_to_zone(data_dir / self._filename_vector, bbox = bbox, ZonesPicc=self.zones)
|
206
|
+
else :
|
207
|
+
print('Not existing vector file at the given paths!')
|
208
|
+
self.zones = None
|
209
|
+
|
210
|
+
self._filename_points = path_points
|
211
|
+
pointfile = data_dir / self._filename_points
|
212
|
+
|
213
|
+
#if pointfile.exists():
|
214
|
+
# self.cloud = cloud_vertices(data_dir / self._filename_points, bbox = bbox)
|
215
|
+
#else:
|
216
|
+
# self.cloud = None
|
217
|
+
# print('Not existing point file at the given paths!')
|
218
|
+
|
219
|
+
return self.zones, self.cloud
|
220
|
+
|
221
|
+
def filter_by_name(self, path_vector:str, path_points:str, name:str="Habitation",
|
222
|
+
bbox:Union[Polygon, list[float]] = None):
|
223
|
+
"""
|
224
|
+
Filter the PICC by a name of 'NATUR_DESC' attribute, and only keeps properties ['GEOREF_ID', 'NATUR_CODE', 'NATUR_DESC']
|
225
|
+
"""
|
226
|
+
|
227
|
+
if path_vector.exists():
|
228
|
+
gdf = gpd.read_file(path_vector, include_fields=["geometry", 'GEOREF_ID', 'NATUR_CODE', 'NATUR_DESC'], bbox=bbox)
|
229
|
+
self.gdf_filtered = gdf[gdf["NATUR_DESC"] == name]
|
230
|
+
|
231
|
+
else :
|
232
|
+
print('Not existing vector file at the given paths!')
|
233
|
+
self.zones = None
|
234
|
+
|
235
|
+
#self._filename_points = path_points
|
236
|
+
#pointfile = data_dir / self._filename_points
|
237
|
+
|
238
|
+
return self.gdf_filtered
|
239
|
+
|
240
|
+
def create_zone_picc(self, path_vector:str = r"PICC_Vesdre.shp", path_points:str = r"PICC_Vesdre_points.shp", name:str="Habitation",
|
241
|
+
bbox:Union[Polygon, list[float]] = None, column:str = "GEOREF_ID"):
|
242
|
+
|
243
|
+
"""Complete reading of the PICC files : vectors (.shp) and clouds (.shp). For the vectors, read any attributes that exist, among
|
244
|
+
['NATUR_CODE', 'NATUR_DESC', 'PRECIS_XY', 'PRECIS_Z', 'TECH_LEVE','DATE_LEVE', 'DATE_CREAT', 'DATE_MODIF', 'DATE_TRANS', 'CODE_WALTO']
|
245
|
+
For now, path_points not used but may be useful later
|
246
|
+
"""
|
247
|
+
|
248
|
+
#Filtering from the start
|
249
|
+
self.gdf_filtered = self.filter_by_name(path_vector, path_points, name, bbox)
|
250
|
+
|
251
|
+
#Creating the Zone with desired attributes
|
252
|
+
Zones_picc = Zones()
|
253
|
+
Zones_picc.import_GeoDataFrame(self.gdf_filtered, bbox, colname=column)
|
254
|
+
return Zones_picc
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
143
259
|
def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
|
144
260
|
""" Plot data in OpenGL context
|
145
261
|
|
@@ -227,8 +343,8 @@ class Picc_data(Element_To_Draw):
|
|
227
343
|
|
228
344
|
else:
|
229
345
|
logging.warning(_('No mapviewer to activate zone !'))
|
230
|
-
|
231
|
-
def extrude_polygons(self, dest_array
|
346
|
+
|
347
|
+
def extrude_polygons(self, dest_array):
|
232
348
|
""" Extrude the active polygon along the z-axis """
|
233
349
|
|
234
350
|
if self.zones is not None:
|
@@ -0,0 +1,146 @@
|
|
1
|
+
import numpy as np
|
2
|
+
import logging
|
3
|
+
from pathlib import Path
|
4
|
+
from enum import Enum
|
5
|
+
|
6
|
+
from osgeo import gdal, osr
|
7
|
+
|
8
|
+
from .wolf_array import WolfArray
|
9
|
+
|
10
|
+
class Legend_LU_Flanders_NL(Enum):
|
11
|
+
"""
|
12
|
+
Enum for Legend Land Use Flanders
|
13
|
+
"""
|
14
|
+
HUIZEN_EN_TUINEN = {"color": "#ff0000", "quantity": 1, "label": "Huizen en tuinen"}
|
15
|
+
INDUSTRIE = {"color": "#8400a8", "quantity": 2, "label": "Industrie"}
|
16
|
+
COMMERCIELE_DOELEINDEN = {"color": "#ff00c5", "quantity": 3, "label": "Commerciële doeleinden"}
|
17
|
+
DIENSTEN = {"color": "#002673", "quantity": 4, "label": "Diensten"}
|
18
|
+
TRANSPORTINFRASTRUCTUUR = {"color": "#686868", "quantity": 5, "label": "Transportinfrastructuur"}
|
19
|
+
RECREATIE = {"color": "#ffaa00", "quantity": 6, "label": "Recreatie"}
|
20
|
+
LANDBOUWGEBOUWEN_EN_INFRASTRUCTUUR = {"color": "#a87000", "quantity": 7, "label": "Landbouwgebouwen en -infrastructuur"}
|
21
|
+
OVERIGE_BEBOWDE_TERREINEN = {"color": "#cccccc", "quantity": 8, "label": "Overige bebouwde terreinen"}
|
22
|
+
OVERIGE_ONBEBOWDE_TERREINEN = {"color": "#828282", "quantity": 9, "label": "Overige onbebouwde terreinen"}
|
23
|
+
ACTIEVE_GROEVES = {"color": "#dfe6a9", "quantity": 10, "label": "Actieve groeves"}
|
24
|
+
LUCHTHAVENS = {"color": "#df73ff", "quantity": 11, "label": "Luchthavens"}
|
25
|
+
BOS = {"color": "#267300", "quantity": 12, "label": "Bos"}
|
26
|
+
AKKER = {"color": "#ffffbe", "quantity": 13, "label": "Akker"}
|
27
|
+
GRASLAND_IN_LANDBOUWGEBRUIK = {"color": "#a3ff73", "quantity": 14, "label": "Grasland in landbouwgebruik"}
|
28
|
+
STRUIKGEWAS = {"color": "#897044", "quantity": 15, "label": "Struikgewas"}
|
29
|
+
BRAAKLIGGEND_EN_DUINEN = {"color": "#ffd37f", "quantity": 16, "label": "Braakliggend en duinen"}
|
30
|
+
WATER = {"color": "#005ce6", "quantity": 17, "label": "Water"}
|
31
|
+
MOERAS = {"color": "#00a884", "quantity": 18, "label": "Moeras"}
|
32
|
+
OVERIGE_GRASLANDEN = {"color": "#82ca5b", "quantity": 19, "label": "Overige graslanden"}
|
33
|
+
|
34
|
+
class Legend_LU_Flanders_EN(Enum):
|
35
|
+
"""
|
36
|
+
Enum for Legend Land Use Flanders in English
|
37
|
+
"""
|
38
|
+
HOUSES_AND_GARDENS = {"color": "#ff0000", "quantity": 1, "label": "Houses and gardens"}
|
39
|
+
INDUSTRY = {"color": "#8400a8", "quantity": 2, "label": "Industry"}
|
40
|
+
COMMERCIAL_PURPOSES = {"color": "#ff00c5", "quantity": 3, "label": "Commercial purposes"}
|
41
|
+
SERVICES = {"color": "#002673", "quantity": 4, "label": "Services"}
|
42
|
+
TRANSPORT_INFRASTRUCTURE = {"color": "#686868", "quantity": 5, "label": "Transport infrastructure"}
|
43
|
+
RECREATION = {"color": "#ffaa00", "quantity": 6, "label": "Recreation"}
|
44
|
+
AGRICULTURAL_BUILDINGS_AND_INFRASTRUCTURE = {"color": "#a87000", "quantity": 7, "label": "Agricultural buildings and infrastructure"}
|
45
|
+
OTHER_BUILT_UP_LAND = {"color": "#cccccc", "quantity": 8, "label": "Other built-up land"}
|
46
|
+
OTHER_UNBUILT_LAND = {"color": "#828282", "quantity": 9, "label": "Other unbuilt land"}
|
47
|
+
ACTIVE_QUARRIES = {"color": "#dfe6a9", "quantity": 10, "label": "Active quarries"}
|
48
|
+
AIRPORTS = {"color": "#df73ff", "quantity": 11, "label": "Airports"}
|
49
|
+
FOREST = {"color": "#267300", "quantity": 12, "label": "Forest"}
|
50
|
+
CROP_LAND = {"color": "#ffffbe", "quantity": 13, "label": "Crop land"}
|
51
|
+
GRASSLAND_IN_AGRICULTURAL_USE = {"color": "#a3ff73", "quantity": 14, "label": "Grassland in agricultural use"}
|
52
|
+
SHRUB_LAND = {"color": "#897044", "quantity": 15, "label": "Shrub land"}
|
53
|
+
FALLOW_AND_DUNES = {"color": "#ffd37f", "quantity": 16, "label": "Fallow and dunes"}
|
54
|
+
WATER = {"color": "#005ce6", "quantity": 17, "label": "Water"}
|
55
|
+
MARSHLAND = {"color": "#00a884", "quantity": 18, "label": "Marshland"}
|
56
|
+
OTHER_GRASSLANDS = {"color": "#82ca5b", "quantity": 19, "label": "Other grasslands"}
|
57
|
+
|
58
|
+
class Legend_LU_Flanders_FR(Enum):
|
59
|
+
"""
|
60
|
+
Enum for Legend Land Use Flanders in French
|
61
|
+
"""
|
62
|
+
MAISONS_ET_JARDINS = {"color": "#ff0000", "quantity": 1, "label": "Maisons et jardins"}
|
63
|
+
INDUSTRIE = {"color": "#8400a8", "quantity": 2, "label": "Industrie"}
|
64
|
+
USAGES_COMMERCIAUX = {"color": "#ff00c5", "quantity": 3, "label": "Usages commerciaux"}
|
65
|
+
SERVICES = {"color": "#002673", "quantity": 4, "label": "Services"}
|
66
|
+
INFRASTRUCTURE_DE_TRANSPORT = {"color": "#686868", "quantity": 5, "label": "Infrastructure de transport"}
|
67
|
+
LOISIRS = {"color": "#ffaa00", "quantity": 6, "label": "Loisirs"}
|
68
|
+
BÂTIMENTS_AGRICOLES_ET_INFRASTRUCTURE = {"color": "#a87000", "quantity": 7, "label": "Bâtiments agricoles et infrastructure"}
|
69
|
+
AUTRES_TERRAINS_BÂTIS = {"color": "#cccccc", "quantity": 8, "label": "Autres terrains bâtis"}
|
70
|
+
AUTRES_TERRAINS_NON_BÂTIS = {"color": "#828282", "quantity": 9, "label": "Autres terrains non bâtis"}
|
71
|
+
CARRIÈRES_ACTIVES = {"color": "#dfe6a9", "quantity": 10, "label": "Carrières actives"}
|
72
|
+
AÉROPORTS = {"color": "#df73ff", "quantity": 11, "label": "Aéroports"}
|
73
|
+
FORÊT = {"color": "#267300", "quantity": 12, "label": "Forêt"}
|
74
|
+
CULTURES = {"color": "#ffffbe", "quantity": 13, "label": "Cultures"}
|
75
|
+
PRAIRIES_EN_UTILISATION_AGRICOLE = {"color": "#a3ff73", "quantity": 14, "label": "Prairies en utilisation agricole"}
|
76
|
+
LANDES_ARBUSTIVES = {"color": "#897044", "quantity": 15, "label": "Landes arbustives"}
|
77
|
+
TERRES_EN_FRICHE_ET_DUNES = {"color": "#ffd37f", "quantity": 16, "label": "Terres en friche et dunes"}
|
78
|
+
EAU = {"color": "#005ce6", "quantity": 17, "label": "Eau"}
|
79
|
+
MARAIS = {"color": "#00a884", "quantity": 18, "label": "Marais"}
|
80
|
+
AUTRES_TERRAINS_ENHERBES = {"color": "#82ca5b", "quantity": 19, "label": "Autres terrains enherbés"}
|
81
|
+
|
82
|
+
FLANDERS_OCS_COLORMAP = {
|
83
|
+
1.: (255,0,0,255), # Maisons et jardins,
|
84
|
+
2.: (132,0,168,255), # Industrie
|
85
|
+
3.: (255,0,197,255), # Usages commerciaux
|
86
|
+
4.: (0,38,115,255), # Services
|
87
|
+
5.: (104,104,104,255), # Infrastructure de transport
|
88
|
+
6.: (255,170,0,255), # Loisirs
|
89
|
+
7.: (168,112,0,255), # Bâtiments agricoles et infrastructure
|
90
|
+
8.: (204,204,204,255), # Autres terrains bâtis
|
91
|
+
9.: (130,130,130,255), # Autres terrains non bâtis
|
92
|
+
10.: (223,230,169,255), # Carrières actives
|
93
|
+
11.: (223,115,255,255), # Aéroports
|
94
|
+
12.: (38,115,0,255), # Forêt
|
95
|
+
13.: (255,255,190,255), # Cultures
|
96
|
+
14.: (163,255,115,255), # Prairies en utilisation agricole
|
97
|
+
15.: (137,112,68,255), # Landes arbustives
|
98
|
+
16.: (255,211,127,255), # Terres en friche et dunes
|
99
|
+
17.: (0,92,230,255), # Eau
|
100
|
+
18.: (0,168,132,255), # Marais
|
101
|
+
19.: (130,202,91,255), # Autres terrains enherbés
|
102
|
+
}
|
103
|
+
|
104
|
+
MAPPING_FLANDERS_TO_WALOUS = {
|
105
|
+
1.: 11., # Maisons et jardins -> Construction artificielles hors sol
|
106
|
+
2.: 11., # Industrie -> Revêtement artificiels au sol
|
107
|
+
3.: 9., # Usages commerciaux -> Revêtement artificiels au sol
|
108
|
+
4.: 9., # Services -> Revêtement artificiels au sol
|
109
|
+
5.: 10., # Infrastructure de transport -> Réseau ferroviaire
|
110
|
+
6.: 9., # Loisirs -> Revêtement artificiels au sol
|
111
|
+
7.: 9., # Bâtiments agricoles et infrastructure -> Revêtement artificiels au sol
|
112
|
+
8.: 9., # Autres terrains bâtis -> Revêtement artificiels au sol
|
113
|
+
9.: 7., # Autres terrains non bâtis -> Sols nus
|
114
|
+
10.: 7., # Carrières actives -> Sols nus
|
115
|
+
11.: 8., # Aéroports -> Revêtement artificiels au sol
|
116
|
+
12.: 4., # Forêt -> Feuillus (> 3m)
|
117
|
+
13.: 1., # Cultures -> Couvert herbacé en rotation dans l'année
|
118
|
+
14.: 1., # Prairies en utilisation agricole -> Couvert herbacé en rotation dans l'année
|
119
|
+
15.: 6., # Landes arbustives -> Feuillus (<= 3m)
|
120
|
+
16.: 7., # Terres en friche et dunes -> Sols nus
|
121
|
+
17.: 8., # Eau -> Eaux de surface
|
122
|
+
18.: 8., # Marais -> Eaux de surface
|
123
|
+
19.: 2., # Autres terrains enherbés -> Couvert herbacé toute l'année
|
124
|
+
}
|
125
|
+
|
126
|
+
MAPPING_FLANDERS_TO_HYDROLOGY = {
|
127
|
+
1.: 4., # Maisons et jardins -> Pavés/urbain
|
128
|
+
2.: 4., # Industrie -> Pavés/urbain
|
129
|
+
3.: 4., # Usages commerciaux -> Pavés/urbain
|
130
|
+
4.: 4., # Services -> Pavés/urbain
|
131
|
+
5.: 4., # Infrastructure de transport -> Pavés/urbain
|
132
|
+
6.: 4., # Loisirs -> Pavés/urbain
|
133
|
+
7.: 4., # Bâtiments agricoles et infrastructure -> Pavés/urbain
|
134
|
+
8.: 4., # Autres terrains bâtis -> Pavés/urbain
|
135
|
+
9.: 3., # Autres terrains non bâtis -> Culture
|
136
|
+
10.: 3., # Carrières actives -> Culture
|
137
|
+
11.: 4., # Aéroports -> Pavés/urbain
|
138
|
+
12.: 1., # Forêt -> Forêt
|
139
|
+
13.: 3., # Cultures -> Culture
|
140
|
+
14.: 3., # Prairies en utilisation agricole -> Culture
|
141
|
+
15.: 3., # Landes arbustives -> Culture
|
142
|
+
16.: 3., # Terres en friche et dunes -> Culture
|
143
|
+
17.: 6., # Eau -> Plan d'eau
|
144
|
+
18.: 6., # Marais -> Plan d'eau
|
145
|
+
19.: 2., # Autres terrains enherbés -> Prairie
|
146
|
+
}
|
wolfhece/pydownloader.py
CHANGED
@@ -42,6 +42,10 @@ class DownloadFiles(Enum):
|
|
42
42
|
TXTFILES = ('txt',)
|
43
43
|
CSVFILES = ('csv',)
|
44
44
|
DXFFILES = ('dxf',)
|
45
|
+
ZIPFILES = ('zip',)
|
46
|
+
LAZFILES = ('laz',)
|
47
|
+
GRIDWOLF = ('lst',)
|
48
|
+
LAZBIN = ('bin',)
|
45
49
|
|
46
50
|
class DonwloadDirectories(Enum):
|
47
51
|
""" Enum to define the directories for downloads. """
|
@@ -79,7 +83,7 @@ def clean_url(url: str) -> str:
|
|
79
83
|
raise ValueError(f"Invalid URL: {url}. Must start with http://, https://, or ftp://")
|
80
84
|
return cleaned_url.strip()
|
81
85
|
|
82
|
-
def download_file(url: str, destination: Union[str, Path] = None, download_type: DownloadType = DownloadType.HTTP, load_from_cache:bool = True)
|
86
|
+
def download_file(url: str, destination: Union[str, Path] = None, download_type: DownloadType = DownloadType.HTTP, load_from_cache:bool = True):
|
83
87
|
""" Download a file from the specified URL to the destination path.
|
84
88
|
|
85
89
|
:param url: The URL of the file to download.
|
@@ -112,6 +116,11 @@ def download_file(url: str, destination: Union[str, Path] = None, download_type:
|
|
112
116
|
# Find the download type based on the URL suffix
|
113
117
|
for file_type_enum in DownloadFiles:
|
114
118
|
if suffix in file_type_enum.value:
|
119
|
+
|
120
|
+
if suffix == 'bin' and '_xyz.bin' in url:
|
121
|
+
# special case for LAZ bin files
|
122
|
+
file_type_enum = DownloadFiles.LAZBIN
|
123
|
+
|
115
124
|
file_type = file_type_enum
|
116
125
|
break
|
117
126
|
|
@@ -253,6 +262,31 @@ def toys_gpu_dataset(dir:str, dirweb:str = None, load_from_cache:bool = True):
|
|
253
262
|
|
254
263
|
return download_gpu_simulation(f"{GITLAB_EXAMPLE_GPU}/{dirweb}", DATADIR / dir, load_from_cache=load_from_cache)
|
255
264
|
|
265
|
+
def toys_laz_grid(dir:str, file:str, load_from_cache:bool = True):
|
266
|
+
""" Download toy LAZ or GRIDWOLF files from the WOLFHECE dataset.
|
267
|
+
|
268
|
+
:param dir: The directory where the file will be saved.
|
269
|
+
:param file: The name of the file to download.
|
270
|
+
:type dir: str
|
271
|
+
:type file: str
|
272
|
+
:return: The path to the downloaded directory.
|
273
|
+
"""
|
274
|
+
url = f"{GITLAB_EXAMPLE}/{dir}/{file}"
|
275
|
+
destination = DATADIR / dir / file
|
276
|
+
lst = download_file(url, destination, load_from_cache=load_from_cache)
|
277
|
+
|
278
|
+
with open(lst, 'r') as f:
|
279
|
+
lines = f.read().splitlines()
|
280
|
+
|
281
|
+
for line in lines:
|
282
|
+
line = line.strip().replace('\\', '/')
|
283
|
+
if line:
|
284
|
+
url = f"{GITLAB_EXAMPLE}/{dir}/{line}"
|
285
|
+
destination = DATADIR / dir / line
|
286
|
+
download_file(url, destination, load_from_cache=load_from_cache)
|
287
|
+
|
288
|
+
return DATADIR / dir
|
289
|
+
|
256
290
|
if __name__ == "__main__":
|
257
291
|
# Example usage
|
258
292
|
print(download_file(r'https:\\gitlab.uliege.be\HECE\wolf_examples\-\raw\main\Extract_part_array\extraction.vec'))
|