wolfhece 2.2.3__py3-none-any.whl → 2.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyDraw.py +65 -8
- wolfhece/PyPalette.py +26 -2
- wolfhece/PyVertex.py +15 -2
- wolfhece/PyWMS.py +13 -2
- wolfhece/apps/version.py +1 -1
- wolfhece/drowning_victims/{Class.py → drowning_class.py} +80 -121
- wolfhece/lifewatch.py +398 -63
- wolfhece/models/Lifewatch.pal +61 -0
- wolfhece/wolf_array.py +116 -14
- {wolfhece-2.2.3.dist-info → wolfhece-2.2.5.dist-info}/METADATA +1 -1
- {wolfhece-2.2.3.dist-info → wolfhece-2.2.5.dist-info}/RECORD +15 -14
- /wolfhece/drowning_victims/{Functions.py → drowning_functions.py} +0 -0
- {wolfhece-2.2.3.dist-info → wolfhece-2.2.5.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.3.dist-info → wolfhece-2.2.5.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.3.dist-info → wolfhece-2.2.5.dist-info}/top_level.txt +0 -0
wolfhece/wolf_array.py
CHANGED
@@ -8,6 +8,13 @@ This script and its content are protected by copyright law. Unauthorized
|
|
8
8
|
copying or distribution of this file, via any medium, is strictly prohibited.
|
9
9
|
"""
|
10
10
|
|
11
|
+
try:
|
12
|
+
from osgeo import gdal, osr
|
13
|
+
gdal.UseExceptions()
|
14
|
+
except ImportError as e:
|
15
|
+
print(e)
|
16
|
+
raise Exception(_('Error importing GDAL library'))
|
17
|
+
|
11
18
|
import os
|
12
19
|
import sys
|
13
20
|
|
@@ -127,13 +134,6 @@ VERSION_RGB = 3
|
|
127
134
|
|
128
135
|
from numba import jit
|
129
136
|
|
130
|
-
try:
|
131
|
-
from osgeo import gdal, osr
|
132
|
-
gdal.UseExceptions()
|
133
|
-
except ImportError as e:
|
134
|
-
print(e)
|
135
|
-
raise Exception(_('Error importing GDAL library'))
|
136
|
-
|
137
137
|
@jit(nopython=True)
|
138
138
|
def custom_gradient(array: np.ndarray):
|
139
139
|
""" Calculate the gradient manually """
|
@@ -5495,10 +5495,10 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5495
5495
|
return self.alpha
|
5496
5496
|
|
5497
5497
|
# def find_minmax(self, update=False):
|
5498
|
-
|
5498
|
+
|
5499
5499
|
# if update:
|
5500
5500
|
# [self.xmin, self.xmax], [self.ymin, self.ymax] = self.get_bounds()
|
5501
|
-
|
5501
|
+
|
5502
5502
|
@property
|
5503
5503
|
def memory_usage(self):
|
5504
5504
|
"""
|
@@ -8568,6 +8568,40 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
8568
8568
|
|
8569
8569
|
return self.get_values_underpoly(myvect, usemask, getxy)
|
8570
8570
|
|
8571
|
+
def count_unique_pixels(self) -> dict[int, int]:
|
8572
|
+
"""
|
8573
|
+
Count the number of pixels for each unique value in the array
|
8574
|
+
:return: dictionary with the code as key and the number of pixels as value
|
8575
|
+
"""
|
8576
|
+
if self.wolftype not in [WOLF_ARRAY_FULL_INTEGER, WOLF_ARRAY_FULL_INTEGER16, WOLF_ARRAY_FULL_INTEGER8, WOLF_ARRAY_FULL_UINTEGER8]:
|
8577
|
+
logging.error("Bad wolftype")
|
8578
|
+
return {}
|
8579
|
+
|
8580
|
+
counts = np.bincount(self.array[~self.array.mask].ravel())
|
8581
|
+
ret = {i: int(val) for i, val in enumerate(counts) if val > 0}
|
8582
|
+
|
8583
|
+
return ret
|
8584
|
+
|
8585
|
+
def get_unique_areas(self, format:Literal['m2', 'ha', 'km2'] = 'm2') -> dict[int, float]:
|
8586
|
+
"""
|
8587
|
+
Get the areas of each code in the array
|
8588
|
+
:param array: numpy array or WolfArray
|
8589
|
+
:return: dictionary with the code as key and the area in m² as value
|
8590
|
+
"""
|
8591
|
+
ret = self.count_unique_pixels()
|
8592
|
+
|
8593
|
+
fact = 1.0
|
8594
|
+
if format in ['ha', 'Ha']:
|
8595
|
+
fact = 0.0001
|
8596
|
+
elif format in ['km2', 'km²']:
|
8597
|
+
fact = 1e-6
|
8598
|
+
elif format not in ['m2', 'm²']:
|
8599
|
+
logging.error("Bad format")
|
8600
|
+
return {}
|
8601
|
+
|
8602
|
+
# Convert counts to areas in m²
|
8603
|
+
return {code: float(count) * self.dx * self.dy * fact for code, count in ret.items()}
|
8604
|
+
|
8571
8605
|
def count_insidepoly(self, myvect: vector,
|
8572
8606
|
usemask:bool=True,
|
8573
8607
|
method:Literal['mpl', 'shapely_strict', 'shapely_wboundary', 'rasterio']='shapely_strict',
|
@@ -9427,6 +9461,59 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
9427
9461
|
y, x = np.meshgrid(y_discr, x_discr)
|
9428
9462
|
return x, y
|
9429
9463
|
|
9464
|
+
def convolve(self,
|
9465
|
+
filter,
|
9466
|
+
method:Literal['scipyfft',
|
9467
|
+
'jaxfft',
|
9468
|
+
'classic']='scipyfft',
|
9469
|
+
inplace:bool=True) -> "WolfArray":
|
9470
|
+
"""
|
9471
|
+
Convolve the array with a filter
|
9472
|
+
|
9473
|
+
:param filter: filter to convolve with
|
9474
|
+
:param method: method to use for convolution ('scipyfft', 'jaxfft', 'classic')
|
9475
|
+
:param inplace: if True, the array is modified in place, otherwise a new array is returned
|
9476
|
+
:return: convolved array, WolfArray instance
|
9477
|
+
|
9478
|
+
"""
|
9479
|
+
|
9480
|
+
if isinstance(filter, WolfArray):
|
9481
|
+
_filter = filter.array.data.copy()
|
9482
|
+
_filter[filter.array.mask] = 0.0
|
9483
|
+
elif isinstance(filter, np.ndarray):
|
9484
|
+
_filter = filter.copy()
|
9485
|
+
_filter[np.isnan(_filter)] = 0.0
|
9486
|
+
else:
|
9487
|
+
logging.error("Filter must be a WolfArray or a numpy array")
|
9488
|
+
return None
|
9489
|
+
|
9490
|
+
if method == 'classic':
|
9491
|
+
from scipy.signal import convolve2d
|
9492
|
+
convolved = convolve2d(self.array.data, _filter, mode='same', fillvalue=0.0)
|
9493
|
+
elif method == 'scipyfft':
|
9494
|
+
from scipy.signal import fftconvolve
|
9495
|
+
convolved = fftconvolve(self.array.data, _filter, mode='same')
|
9496
|
+
elif method == 'jaxfft':
|
9497
|
+
import jax.numpy as jnp
|
9498
|
+
from jax.scipy.signal import fftconvolve as jax_fftconvolve
|
9499
|
+
jax_filter = jnp.array(_filter)
|
9500
|
+
jax_array = jnp.array(self.array.data)
|
9501
|
+
convolved = jax_fftconvolve(jax_array, jax_filter, mode='same')
|
9502
|
+
convolved = jnp.asarray(convolved)
|
9503
|
+
else:
|
9504
|
+
logging.error("Method not supported")
|
9505
|
+
return None
|
9506
|
+
|
9507
|
+
if inplace:
|
9508
|
+
self.array.data[:,:] = convolved
|
9509
|
+
return self
|
9510
|
+
else:
|
9511
|
+
newWolfArray = WolfArray(mold=self)
|
9512
|
+
newWolfArray.array.data[:,:] = convolved
|
9513
|
+
newWolfArray.array.mask[:,:] = self.array.mask[:,:]
|
9514
|
+
newWolfArray.count()
|
9515
|
+
return newWolfArray
|
9516
|
+
|
9430
9517
|
def crop_masked_at_edges(self):
|
9431
9518
|
|
9432
9519
|
"""
|
@@ -9933,11 +10020,26 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
9933
10020
|
logging.error(e)
|
9934
10021
|
|
9935
10022
|
if (vmin is None) and (vmax is None):
|
9936
|
-
im = ax.imshow(self.array.transpose(), origin='lower', cmap=self.mypal,
|
9937
|
-
|
9938
|
-
|
9939
|
-
|
9940
|
-
|
10023
|
+
# im = ax.imshow(self.array.transpose(), origin='lower', cmap=self.mypal,
|
10024
|
+
# extent=(self.origx, self.origx + self.dx * self.nbx, self.origy, self.origy + self.dy * self.nby))
|
10025
|
+
im = ax.imshow(self.array.transpose(),
|
10026
|
+
origin='lower',
|
10027
|
+
norm = self.mypal.norm,
|
10028
|
+
cmap=self.mypal.cmap,
|
10029
|
+
interpolation='none',
|
10030
|
+
extent=(self.origx,
|
10031
|
+
self.origx + self.dx * self.nbx,
|
10032
|
+
self.origy,
|
10033
|
+
self.origy + self.dy * self.nby))
|
10034
|
+
else:
|
10035
|
+
im = ax.imshow(self.array.transpose(),
|
10036
|
+
origin='lower',
|
10037
|
+
cmap=self.mypal,
|
10038
|
+
extent=(self.origx,
|
10039
|
+
self.origx + self.dx * self.nbx,
|
10040
|
+
self.origy,
|
10041
|
+
self.origy + self.dy * self.nby),
|
10042
|
+
vmin=vmin, vmax=vmax)
|
9941
10043
|
ax.set_aspect('equal')
|
9942
10044
|
|
9943
10045
|
if getdata_im:
|
@@ -8,17 +8,17 @@ wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
|
|
8
8
|
wolfhece/PandasGrid.py,sha256=YIleVkUkoP2MjtQBZ9Xgwk61zbgMj4Pmjj-clVTfPRs,2353
|
9
9
|
wolfhece/PyConfig.py,sha256=Y0wtSIFpAMYa7IByh7hbW-WEOVjNsQEduq7vhIYdZQw,16716
|
10
10
|
wolfhece/PyCrosssections.py,sha256=igU_ELrg5VrHU6RNbF5tHxPyVImpR3xdpfopJYc7haw,114711
|
11
|
-
wolfhece/PyDraw.py,sha256=
|
11
|
+
wolfhece/PyDraw.py,sha256=mCIcXgtTT3vvixO_bvo76HlgK9p1MKk1GljGGIuIosw,631732
|
12
12
|
wolfhece/PyGui.py,sha256=IU97wVlmer3Q2MpWbJv4MQWH7nYbc5uN4pRzhr4jdlM,145197
|
13
13
|
wolfhece/PyGuiHydrology.py,sha256=sKafpOopBg50L5llZCI_fZtbebVTDtxvoRI6-osUwhg,14745
|
14
14
|
wolfhece/PyHydrographs.py,sha256=1P5XAURNqCvtSsMQXhOn1ihjTpr725sRsZdlCEhhk6M,3730
|
15
|
-
wolfhece/PyPalette.py,sha256=
|
15
|
+
wolfhece/PyPalette.py,sha256=k9b_95GYD0USQ8DS5zGXeZ577712U6772kmhEbJtlXw,35406
|
16
16
|
wolfhece/PyParams.py,sha256=Dh9C_WYICMjo3m9roRySsu8ZgFzzYhSr6RpbaXZni0M,99423
|
17
17
|
wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
|
18
18
|
wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
|
19
|
-
wolfhece/PyVertex.py,sha256=
|
19
|
+
wolfhece/PyVertex.py,sha256=Ym42pHWwEVv6Fu5v-OzhlHiQB46DnvLf9MUe_c3lbR0,45610
|
20
20
|
wolfhece/PyVertexvectors.py,sha256=0lt0YyHIz_IxgXqdqPlTDruDwjeP6L1Dw6B2Q35a8kQ,325801
|
21
|
-
wolfhece/PyWMS.py,sha256=
|
21
|
+
wolfhece/PyWMS.py,sha256=LWkQk3R7miiVal-n5K5P5ClSQJA_vi5ImBxYGuxCx9A,9122
|
22
22
|
wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
|
23
23
|
wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
|
24
24
|
wolfhece/RatingCurve_xml.py,sha256=cUjReVMHFKtakA2wVey5zz6lCgHlSr72y7ZfswZDvTM,33891
|
@@ -41,7 +41,7 @@ wolfhece/ins.py,sha256=uUeLMS1n3GPnfJhxl0Z2l-UXpmPUgthuwct282OOEzk,36184
|
|
41
41
|
wolfhece/irm_qdf.py,sha256=DMdDEAYbgYxApObm6w-dZbBmA8ec6PghBLXR2lUEZLc,27457
|
42
42
|
wolfhece/ismember.py,sha256=fkLvaH9fhx-p0QrlEzqa6ySO-ios3ysjAgXVXzLgSpY,2482
|
43
43
|
wolfhece/lagrange_multiplier.py,sha256=0G-M7b2tGzLx9v0oNYYq4_tLAiHcs_39B4o4W3TUVWM,6567
|
44
|
-
wolfhece/lifewatch.py,sha256=
|
44
|
+
wolfhece/lifewatch.py,sha256=AszCItQCq3Z3d-gznsjtYU9FIKJaWAcr1gafBxb-qHs,16265
|
45
45
|
wolfhece/matplotlib_fig.py,sha256=vnFI6sghw9N9jKhR8X1Z4aWli_5fPNylZQtFuujFJDY,84075
|
46
46
|
wolfhece/multiprojects.py,sha256=Sd6Bl6YP33jlR79A6rvSLu23vq8sqbFYL8lWuVPkEpE,21549
|
47
47
|
wolfhece/picc.py,sha256=0X_pzhSBoVxgtTfJ37pkOQO3Vbr9yurPaD1nVeurx8k,8531
|
@@ -58,7 +58,7 @@ wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
|
|
58
58
|
wolfhece/textpillow.py,sha256=map7HsGYML_o5NHRdFg2s_TVQed_lDnpYNDv27MM0Vw,14130
|
59
59
|
wolfhece/tools2d_dll.py,sha256=oU0m9XYAf4CZsMoB68IuKeE6SQh-AqY7O5NVED8r9uw,13125
|
60
60
|
wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
|
61
|
-
wolfhece/wolf_array.py,sha256=
|
61
|
+
wolfhece/wolf_array.py,sha256=YtrTYzYhJKMewxDkkaiVjFfd7XBq6DNBE3uHdIpgmJY,490755
|
62
62
|
wolfhece/wolf_hist.py,sha256=7jeVrgSkM3ErJO6SRMH_PGzfLjIdw8vTy87kesldggk,3582
|
63
63
|
wolfhece/wolf_texture.py,sha256=IvFtekT5iLU2sivZOOlJXpE4CevjTQYSxHaOp4cH_wI,17723
|
64
64
|
wolfhece/wolf_tiles.py,sha256=v-HohqaWuMYdn75XLnA22dlloAG90iwnIqrgnB0ASQ4,10488
|
@@ -86,7 +86,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
|
|
86
86
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
87
87
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
88
88
|
wolfhece/apps/splashscreen.py,sha256=eCPAUYscZPWDYKBHDBWum_VIcE7WXOCBe1GLHL3KUmU,3088
|
89
|
-
wolfhece/apps/version.py,sha256=
|
89
|
+
wolfhece/apps/version.py,sha256=imjv2iLmDitvnvE91s2oHHPHEwKdSfXQkxnrkAddHV4,387
|
90
90
|
wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
|
91
91
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
92
92
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -112,9 +112,9 @@ wolfhece/clientserver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
112
112
|
wolfhece/clientserver/clientserver.py,sha256=sNJ8STw0kqUjCB4AerqZNbzCtl5WRe_JRvhe7whNoSE,2798
|
113
113
|
wolfhece/coupling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
114
114
|
wolfhece/coupling/hydrology_2d.py,sha256=QBIcgujfOX1xX3ARF2PQz6Uqwu3j6EaRw0QlGjG_H7k,53090
|
115
|
-
wolfhece/drowning_victims/Class.py,sha256=W7oliBnGE_4i2NwkLgOqdq4eo0EuDdR1qMDF1fGfYUo,94132
|
116
|
-
wolfhece/drowning_victims/Functions.py,sha256=hlAOyzt15GYe0urDPYquJaV6i0LyDj7X5BAUGE6ppso,47535
|
117
115
|
wolfhece/drowning_victims/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
116
|
+
wolfhece/drowning_victims/drowning_class.py,sha256=xWr_SoFqpodQ51x2CqCRbfIiL903kk2YqIRoU35xZy0,93482
|
117
|
+
wolfhece/drowning_victims/drowning_functions.py,sha256=hlAOyzt15GYe0urDPYquJaV6i0LyDj7X5BAUGE6ppso,47535
|
118
118
|
wolfhece/eva/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
119
119
|
wolfhece/eva/bootstrap.py,sha256=Ys4xTDIvG_QtxCKWLYzb3_XAZU441jGX7fHIbd9Mvr0,840
|
120
120
|
wolfhece/eva/hydrogramme_mono.py,sha256=uZFIgJJ-JogMFzt7D7OnyVaHvgxCQJPZz9W9FgnuthA,8138
|
@@ -249,6 +249,7 @@ wolfhece/models/6_coul.pal,sha256=z7NK2dg0tAQBUweRQV54dIwJbPM1U5y1AR2LLw19Idw,14
|
|
249
249
|
wolfhece/models/7_coul.pal,sha256=XTnnUyCE8ONokScB2YzYDnSTft7E6sppmr7P-XwMsCE,205
|
250
250
|
wolfhece/models/Froude.pal,sha256=FmrvUI01fv4k0ygqDJEYdC1M9Fn72Sr6Sn2IlZAm0KA,138
|
251
251
|
wolfhece/models/HECE_169.pptx,sha256=OWJtsWz504A-REFaaxw8lwStHyQU2l7KEeiE7IZvtbk,3396930
|
252
|
+
wolfhece/models/Lifewatch.pal,sha256=ZSmJtTvwU37kDlNgtc6ohh2M19EhVSbdeyiJIS4wId8,292
|
252
253
|
wolfhece/models/Risque_TAF.pal,sha256=Tnbx-_gIyCszzwmwo0I9vvFfVVKmATjFXS89AoZwTOs,135
|
253
254
|
wolfhece/models/blue.pal,sha256=s9-wEPzSiKMMHuKofUB2FPjmyO7HfGM2xWaUJwsKAY8,39
|
254
255
|
wolfhece/models/blues.pal,sha256=0ZEU1p9EcKwsCvNjU0s9_9aVakqQ71LDNoddVBAluEs,509
|
@@ -313,8 +314,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
|
|
313
314
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
314
315
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
315
316
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
316
|
-
wolfhece-2.2.
|
317
|
-
wolfhece-2.2.
|
318
|
-
wolfhece-2.2.
|
319
|
-
wolfhece-2.2.
|
320
|
-
wolfhece-2.2.
|
317
|
+
wolfhece-2.2.5.dist-info/METADATA,sha256=9v84rbmTr0ngAwq3vgROTfRNq7plNxUkXPxWVWhoq-E,2744
|
318
|
+
wolfhece-2.2.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
319
|
+
wolfhece-2.2.5.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
|
320
|
+
wolfhece-2.2.5.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
321
|
+
wolfhece-2.2.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|