wolfhece 2.2.37__py3-none-any.whl → 2.2.39__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 +32 -0
- wolfhece/PyVertexvectors.py +147 -75
- 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/climate_data.py +334 -0
- wolfhece/hydrology/constant.py +11 -0
- wolfhece/hydrology/cst_exchanges.py +76 -1
- wolfhece/hydrology/forcedexchanges.py +413 -49
- wolfhece/hydrology/hyetograms.py +2095 -0
- wolfhece/hydrology/read.py +65 -5
- wolfhece/hydrometry/kiwis.py +42 -26
- wolfhece/hydrometry/kiwis_gui.py +7 -2
- 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/lifewatch.py +6 -3
- wolfhece/picc.py +124 -8
- wolfhece/pyLandUseFlanders.py +146 -0
- wolfhece/pydownloader.py +2 -1
- wolfhece/pywalous.py +225 -31
- wolfhece/toolshydrology_dll.py +149 -0
- wolfhece/wolf_array.py +63 -25
- {wolfhece-2.2.37.dist-info → wolfhece-2.2.39.dist-info}/METADATA +3 -1
- {wolfhece-2.2.37.dist-info → wolfhece-2.2.39.dist-info}/RECORD +53 -42
- {wolfhece-2.2.37.dist-info → wolfhece-2.2.39.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.37.dist-info → wolfhece-2.2.39.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.37.dist-info → wolfhece-2.2.39.dist-info}/top_level.txt +0 -0
wolfhece/PyWMS.py
CHANGED
@@ -216,10 +216,14 @@ def getLifeWatch(cat:Literal['None'],
|
|
216
216
|
wms=WebMapService(f'https://maps.elie.ucl.ac.be/cgi-bin/mapserv72?map=/maps_server/lifewatch/mapfiles/LW_Ecotopes/latest/{cat}.map&SERVICE=wms',
|
217
217
|
version='1.3.0', timeout=10)
|
218
218
|
|
219
|
-
|
219
|
+
# _p_ixel _p_er _k_ilo_m_etre
|
220
|
+
ppkm = 500
|
221
|
+
|
220
222
|
if w is None and h is None:
|
223
|
+
# Bounding dimensions width in kilometres
|
221
224
|
real_w = (xr-xl)/1000
|
222
225
|
real_h = (yr-yl)/1000
|
226
|
+
# Size in pixels of the requested area.
|
223
227
|
w = int(real_w * ppkm)
|
224
228
|
h = int(real_h * ppkm)
|
225
229
|
elif w is None:
|
@@ -235,6 +239,8 @@ def getLifeWatch(cat:Literal['None'],
|
|
235
239
|
# w = int(real_w * ppkm)
|
236
240
|
h = int(real_h * ppkm)
|
237
241
|
|
242
|
+
# If we ask for too many pixels, well, we reduce the number
|
243
|
+
# of pixels we ask for (keeping the aspect ratio)
|
238
244
|
MAXSIZE = 2048
|
239
245
|
if w > MAXSIZE:
|
240
246
|
pond = w / MAXSIZE
|
@@ -250,6 +256,8 @@ def getLifeWatch(cat:Literal['None'],
|
|
250
256
|
# styles=['default'],
|
251
257
|
srs='EPSG:31370',
|
252
258
|
bbox=(xl,yl,xr,yr),
|
259
|
+
# Width/Height of map output, in pixels.
|
260
|
+
# See: https://docs.geoserver.org/stable/en/user/services/wms/reference.html#getmap
|
253
261
|
size=(w,h),
|
254
262
|
format='image/png',
|
255
263
|
transparent=False)
|
@@ -540,41 +548,49 @@ def get_Alaro_legend(layer:str):
|
|
540
548
|
"""
|
541
549
|
import requests
|
542
550
|
from io import BytesIO
|
543
|
-
layers = ['10_m_u__wind_component',
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
551
|
+
# layers = ['10_m_u__wind_component',
|
552
|
+
# '10_m_v__wind_component',
|
553
|
+
# '2_m_Max_temp_since_ppp',
|
554
|
+
# '2_m_Min_temp_since_ppp',
|
555
|
+
# '2_m_dewpoint_temperature',
|
556
|
+
# '2_m_temperature',
|
557
|
+
# '2m_Relative_humidity',
|
558
|
+
# 'Convective_rain',
|
559
|
+
# 'Convective_snow',
|
560
|
+
# 'Geopotential',
|
561
|
+
# 'Inst_flx_Conv_Cld_Cover',
|
562
|
+
# 'Inst_flx_High_Cld_Cover',
|
563
|
+
# 'Inst_flx_Low_Cld_Cover',
|
564
|
+
# 'Inst_flx_Medium_Cld_Cover',
|
565
|
+
# 'Inst_flx_Tot_Cld_cover',
|
566
|
+
# 'Large_scale_rain',
|
567
|
+
# 'Large_scale_snow',
|
568
|
+
# 'Mean_sea_level_pressure',
|
569
|
+
# 'Relative_humidity',
|
570
|
+
# 'Relative_humidity_isobaric',
|
571
|
+
# 'SBL_Meridian_gust',
|
572
|
+
# 'SBL_Zonal_gust',
|
573
|
+
# 'Specific_humidity',
|
574
|
+
# 'Surf_Solar_radiation',
|
575
|
+
# 'Surf_Thermal_radiation',
|
576
|
+
# 'Surface_CAPE',
|
577
|
+
# 'Surface_Temperature',
|
578
|
+
# 'Surface_orography',
|
579
|
+
# 'Temperature',
|
580
|
+
# 'Total_precipitation',
|
581
|
+
# 'U-velocity',
|
582
|
+
# 'V-velocity',
|
583
|
+
# 'Vertical_velocity',
|
584
|
+
# 'Wet_Bulb_Poten_Temper',
|
585
|
+
# 'freezing_level_zeroDegC_isotherm']
|
586
|
+
layers = ['2_m_temperature',
|
587
|
+
'Surface_Temperature',
|
588
|
+
'Convective_rain',
|
589
|
+
'Convective_snow',
|
590
|
+
'Large_scale_rain',
|
591
|
+
'Large_scale_snow',
|
592
|
+
'Mean_sea_level_pressure',
|
593
|
+
'Total_precipitation',]
|
578
594
|
|
579
595
|
layers_lowercase = [l.lower() for l in layers]
|
580
596
|
if layer.lower() not in layers_lowercase:
|
@@ -5,7 +5,7 @@ Date: 2024
|
|
5
5
|
Copyright (c) 2024 University of Liege. All rights reserved.
|
6
6
|
|
7
7
|
This script and its content are protected by copyright law. Unauthorized
|
8
|
-
copying or distribution of this file, via any medium, is strictly prohibited.
|
8
|
+
copying or distribution of this file, via any medium, is strictly prohibited.batch_creation_and_interpolation
|
9
9
|
"""
|
10
10
|
|
11
11
|
from .Parallels import parallel_gpd_clip, parallel_v2r, parallel_datamod
|
@@ -13,6 +13,7 @@ from .func import data_modification, compute_vulnerability, compute_vulnerabilit
|
|
13
13
|
from .func import match_vulnerability2sim, compute_acceptability, shp_to_raster, clip_layer
|
14
14
|
from .func import Accept_Manager, cleaning_directory, EXTENT, Vulnerability_csv, compute_code
|
15
15
|
|
16
|
+
from ..PyTranslate import _
|
16
17
|
import pandas as pd
|
17
18
|
import os
|
18
19
|
from osgeo import gdal
|
@@ -52,6 +53,7 @@ class steps_vulnerability(Enum):
|
|
52
53
|
APPLY_MODIFS = 2
|
53
54
|
MATCH_SIMUL = 3
|
54
55
|
APPLY_SCENARIOSVULN = 4
|
56
|
+
APPLY_SCENARIOSVULN_BUG = 42
|
55
57
|
|
56
58
|
@classmethod
|
57
59
|
def get_list_names(cls):
|
@@ -215,7 +217,7 @@ def Base_data_creation(main_dir:str = 'Data',
|
|
215
217
|
|
216
218
|
shp:gpd.GeoDataFrame = gpd.read_file(in_file)
|
217
219
|
|
218
|
-
nb_lines,
|
220
|
+
nb_lines, unused = shp.shape
|
219
221
|
if nb_lines > 0:
|
220
222
|
shp["Path"] = curlayer
|
221
223
|
shp["Vulne"] = vulnerability_csv.get_vulnerability_level(curlayer)
|
@@ -391,13 +393,18 @@ def Vulnerability(main_dir:str = 'Data',
|
|
391
393
|
if 4 in steps or steps_vulnerability.APPLY_SCENARIOSVULN in steps:
|
392
394
|
if os.path.exists(manager.OUT_VULN):
|
393
395
|
existence=False
|
394
|
-
existence = manager.create_vrtIfExists(manager.OUT_VULN, manager.IN_CH_SA_SC, manager.OUT_VULN_VRT, name="vuln")
|
395
|
-
if existence ==
|
396
|
-
logging.
|
396
|
+
existence, fail = manager.create_vrtIfExists(manager.OUT_VULN, manager.IN_CH_SA_SC, manager.OUT_VULN_VRT, name="vuln")
|
397
|
+
if existence == None:
|
398
|
+
logging.error(_(f"Error in MNT_ files type : {fail}. Please correct them (int8 and Null value = 127)."))
|
399
|
+
return done.append(steps_vulnerability.APPLY_SCENARIOSVULN_BUG)
|
400
|
+
|
401
|
+
elif existence == True :
|
397
402
|
manager.translate_vrt2tif(manager.OUT_VULN_VRT, manager.OUT_VULN_S)
|
403
|
+
logging.info("Scenarios have been applied to the vulnerability matrix see _scenarios")
|
398
404
|
else :
|
399
405
|
logging.error(f"The baseline vulnerability does not exist ({manager.OUT_VULN}). Please, compute first the vulnerability without scenarios vuln_.")
|
400
406
|
done.append(steps_vulnerability.APPLY_SCENARIOSVULN)
|
407
|
+
|
401
408
|
#Delete _scenario folder is no scenario
|
402
409
|
if os.path.isdir(manager.OUT_WITHVULN) and not os.listdir(manager.OUT_WITHVULN):
|
403
410
|
os.rmdir(manager.OUT_WITHVULN)
|
@@ -429,7 +436,7 @@ def Acceptability(main_dir:str = 'Vesdre',
|
|
429
436
|
river_trace = manager.OUT_MASKED_RIVER
|
430
437
|
|
431
438
|
if 5 in steps or steps_acceptability.COMPUTE_WITH_SCENARIOS in steps:
|
432
|
-
river_trace = manager.wich_river_trace()
|
439
|
+
river_trace = manager.wich_river_trace(True)
|
433
440
|
change_vuln_files = [Path(a) for a in glob.glob(str(manager.IN_CH_SA_SC / "vuln_*.tif")) + glob.glob(str(manager.IN_CH_SA_SC / "vuln_*.tiff"))]
|
434
441
|
if len(change_vuln_files) != 0:
|
435
442
|
VulneToCompute.append(manager.OUT_VULN_Stif)
|
@@ -563,8 +570,8 @@ def Acceptability(main_dir:str = 'Vesdre',
|
|
563
570
|
assert len(pond) == len(return_periods), "The number of ponderations is not equal to the number of return periods"
|
564
571
|
|
565
572
|
# Initialize the combined acceptability matrix -- Ponderate mean of the local acceptability
|
566
|
-
comb = np.zeros(part_accept[return_periods[
|
567
|
-
|
573
|
+
comb = np.zeros(part_accept[return_periods[0]].shape, dtype=np.float32)
|
574
|
+
|
568
575
|
for curT in return_periods:
|
569
576
|
assert part_accept[curT].dtype == np.float32, "The dtype of the acceptability matrix is not np.float32"
|
570
577
|
assert part_accept[curT].shape == comb.shape, "The shape of the acceptability matrix is not the right one"
|