wolfhece 2.2.16__py3-none-any.whl → 2.2.17__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 +30 -5
- wolfhece/PyParams.py +29 -0
- wolfhece/Results2DGPU.py +6 -0
- wolfhece/apps/version.py +1 -1
- wolfhece/assets/mesh.py +128 -6
- wolfhece/hydrometry/kiwis_wolfgui.py +7 -8
- wolfhece/wolf_array.py +59 -8
- wolfhece/wolfresults_2D.py +563 -194
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.17.dist-info}/METADATA +1 -1
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.17.dist-info}/RECORD +13 -13
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.17.dist-info}/WHEEL +1 -1
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.17.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.17.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -797,7 +797,12 @@ class DragdropFileTarget(wx.FileDropTarget):
|
|
797
797
|
id = id + '_1'
|
798
798
|
|
799
799
|
try:
|
800
|
-
|
800
|
+
h = header_wolf.read_header(name)
|
801
|
+
|
802
|
+
if h.nb_blocks>0:
|
803
|
+
newobj = WolfArrayMB(fname=name, mapviewer= self.window)
|
804
|
+
else:
|
805
|
+
newobj = WolfArray(fname=name, mapviewer= self.window)
|
801
806
|
self.window.add_object('array', newobj = newobj, id = id)
|
802
807
|
except:
|
803
808
|
logging.error(_('Error while loading array : ') + name)
|
@@ -2887,7 +2892,7 @@ class WolfMapViewer(wx.Frame):
|
|
2887
2892
|
self.menuwolf2d.AppendSeparator()
|
2888
2893
|
|
2889
2894
|
self.menu2d_dangermap = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map"), _("Compute the danger map"))
|
2890
|
-
|
2895
|
+
self.menu2d_dangermap_mp = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map (multiprocess)"), _("Compute the danger map using multiprocessing -- Need to duplicate the model, the memory usage can be very high for large model"))
|
2891
2896
|
self.menu2d_dangermaph = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map - only h"), _("Compute the danger map - only waterdepth"))
|
2892
2897
|
|
2893
2898
|
self.menuwolf2d.AppendSeparator()
|
@@ -3519,16 +3524,21 @@ class WolfMapViewer(wx.Frame):
|
|
3519
3524
|
every = dlg.GetValue()
|
3520
3525
|
|
3521
3526
|
if itemlabel == _("Danger map"):
|
3527
|
+
logging.info(_('Danger map -- Be patient !'))
|
3522
3528
|
pgbar = wx.ProgressDialog(_('Danger map'), _('Danger map'), maximum = end_step-1, parent=self, style = wx.PD_APP_MODAL | wx.PD_AUTO_HIDE)
|
3523
3529
|
def _callback(id, msg):
|
3524
3530
|
pgbar.Update(id+1-start_step, msg)
|
3525
3531
|
|
3526
|
-
danger_maps = self.active_res2d.
|
3532
|
+
danger_maps = self.active_res2d.danger_map(start_step-1, end_step-1, every, _callback)
|
3527
3533
|
|
3528
3534
|
pgbar.Hide()
|
3529
3535
|
pgbar.Destroy()
|
3536
|
+
logging.info(_('Danger map done !'))
|
3530
3537
|
else:
|
3538
|
+
|
3539
|
+
logging.info(_('Multiprocess danger map -- Be patient !'))
|
3531
3540
|
danger_maps = self.active_res2d.danger_map_multiprocess(start_step-1, end_step-1, every)
|
3541
|
+
logging.info(_('Multiprocess danger map done !'))
|
3532
3542
|
|
3533
3543
|
with wx.DirDialog(None, _('Choose a directory to store results'), style=wx.DD_DEFAULT_STYLE) as dlg:
|
3534
3544
|
|
@@ -3537,9 +3547,24 @@ class WolfMapViewer(wx.Frame):
|
|
3537
3547
|
|
3538
3548
|
outdir = dlg.GetPath()
|
3539
3549
|
|
3540
|
-
names = ['danger_h
|
3550
|
+
names = ['danger_h', 'danger_u',
|
3551
|
+
'danger_q', 'danger_Z',
|
3552
|
+
'danger_head',
|
3553
|
+
'danger_toal', 'danger_tom']
|
3554
|
+
|
3541
3555
|
for name, danger_map in zip(names, danger_maps):
|
3542
|
-
|
3556
|
+
|
3557
|
+
if isinstance(danger_map, WolfArrayMB):
|
3558
|
+
name = name + '.bin'
|
3559
|
+
logging.info(_('Saving danger map {}').format(name))
|
3560
|
+
danger_map.write_all(Path(outdir) / name)
|
3561
|
+
elif isinstance(danger_map, WolfArray):
|
3562
|
+
name = name + '.tif'
|
3563
|
+
logging.info(_('Saving danger map {}').format(name))
|
3564
|
+
danger_map.write_all(Path(outdir) / name)
|
3565
|
+
else:
|
3566
|
+
logging.error(_('Bad type for danger map {} -- not saved !').format(name))
|
3567
|
+
continue
|
3543
3568
|
|
3544
3569
|
elif itemlabel == _("Setup cache..."):
|
3545
3570
|
|
wolfhece/PyParams.py
CHANGED
@@ -333,6 +333,35 @@ class Wolf_Param(wx.Frame):
|
|
333
333
|
toShow,
|
334
334
|
toolbar=toolbar)
|
335
335
|
|
336
|
+
def __getstate__(self):
|
337
|
+
state = self.__dict__.copy()
|
338
|
+
# Remove the wxPython GUI from the state to avoid pickling issues
|
339
|
+
state.pop('prop', None)
|
340
|
+
state.pop('sizer', None)
|
341
|
+
state.pop('callback', None)
|
342
|
+
state.pop('callbackdestroy', None)
|
343
|
+
state.pop('DestroyAtClosing', None)
|
344
|
+
state.pop('show_in_active_if_default', None)
|
345
|
+
state.pop('sizerbut', None)
|
346
|
+
state.pop('myIncGroup', None)
|
347
|
+
state.pop('myIncParam', None)
|
348
|
+
state.pop('update_incr_at_every_change', None)
|
349
|
+
state.pop('wxparent', None)
|
350
|
+
state.pop('gui_hydrometry', None)
|
351
|
+
state.pop('cloud_stations_real', None)
|
352
|
+
state.pop('cloud_stations', None)
|
353
|
+
state.pop('gui_hydrometry', None)
|
354
|
+
|
355
|
+
return state
|
356
|
+
|
357
|
+
def __setstate__(self, state):
|
358
|
+
|
359
|
+
self.__dict__.update(state)
|
360
|
+
|
361
|
+
# Reinitialize the wxPython GUI if it was not initialized before pickling
|
362
|
+
if self.wx_exists:
|
363
|
+
self._set_gui()
|
364
|
+
|
336
365
|
@property
|
337
366
|
def has_prop(self) -> bool:
|
338
367
|
""" Return True if the property grid is available """
|
wolfhece/Results2DGPU.py
CHANGED
@@ -193,11 +193,17 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
193
193
|
if key in dct:
|
194
194
|
dct.pop(key)
|
195
195
|
|
196
|
+
dct['isGPU'] = True
|
197
|
+
|
196
198
|
return dct
|
197
199
|
|
198
200
|
def __setstate__(self, dct):
|
201
|
+
|
199
202
|
super().__setstate__(dct)
|
200
203
|
|
204
|
+
self._loader(self.filename)
|
205
|
+
self._post_loader()
|
206
|
+
|
201
207
|
self._result_store = None
|
202
208
|
self._cache = None
|
203
209
|
self.setup_store(self._result_store)
|
wolfhece/apps/version.py
CHANGED
wolfhece/assets/mesh.py
CHANGED
@@ -16,7 +16,7 @@ class Mesh2D(header_wolf):
|
|
16
16
|
self.shape = src_header.shape
|
17
17
|
self._factor = None
|
18
18
|
|
19
|
-
def plot_cells(self, ax:Axes=None, color='black', **kwargs):
|
19
|
+
def plot_cells(self, ax:Axes=None, transpose:bool= False, color='black', **kwargs):
|
20
20
|
""" Plot the grid of the mesh.
|
21
21
|
"""
|
22
22
|
|
@@ -27,13 +27,28 @@ class Mesh2D(header_wolf):
|
|
27
27
|
|
28
28
|
[xmin, xmax], [ymin, ymax] = self.get_bounds()
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
if transpose:
|
31
|
+
|
32
|
+
# plot the grid of the mesh in a transposed way
|
33
|
+
for x in np.linspace(xmin, xmax, endpoint=True, num=self.nbx + 1):
|
34
|
+
ax.plot([ymin, ymax], [x, x], color=color, **kwargs)
|
32
35
|
|
33
|
-
|
34
|
-
|
36
|
+
for y in np.linspace(ymin, ymax, endpoint=True, num=self.nby + 1):
|
37
|
+
ax.plot([y, y], [xmin, xmax], color=color, **kwargs)
|
38
|
+
|
39
|
+
self.set_aspect_labels_matrice(ax=ax, **kwargs)
|
40
|
+
|
41
|
+
else:
|
42
|
+
|
43
|
+
# plot the grid of the mesh
|
44
|
+
for y in np.linspace(ymin, ymax, endpoint=True, num=self.nby + 1):
|
45
|
+
ax.plot([xmin, xmax], [y, y], color=color, **kwargs)
|
46
|
+
|
47
|
+
for x in np.linspace(xmin, xmax, endpoint=True, num=self.nbx + 1):
|
48
|
+
ax.plot([x, x], [ymin, ymax], color=color, **kwargs)
|
49
|
+
|
50
|
+
self.set_aspect_labels(ax=ax, **kwargs)
|
35
51
|
|
36
|
-
self.set_aspect_labels(ax=ax, **kwargs)
|
37
52
|
return fig, ax
|
38
53
|
|
39
54
|
def plot_center_cells(self, ax:Axes=None, color='black', linestyle='--', **kwargs):
|
@@ -77,6 +92,34 @@ class Mesh2D(header_wolf):
|
|
77
92
|
|
78
93
|
return fig, ax
|
79
94
|
|
95
|
+
def set_ticks_as_matrice(self, ax:Axes=None, Fortran_type:bool = True, **kwargs):
|
96
|
+
""" Set the ticks of the axis as the row and column of a matrice """
|
97
|
+
|
98
|
+
if ax is None:
|
99
|
+
fig, ax = plt.subplots()
|
100
|
+
else:
|
101
|
+
fig = ax.figure
|
102
|
+
|
103
|
+
[xmin, xmax], [ymin, ymax] = self.get_bounds()
|
104
|
+
|
105
|
+
if Fortran_type:
|
106
|
+
x_ticks = [f'{i}' for i in range(1,self.nbx+1)]
|
107
|
+
y_ticks = [f'{i}' for i in range(1,self.nby+1)]
|
108
|
+
else:
|
109
|
+
x_ticks = [f'{i}' for i in range(self.nbx)]
|
110
|
+
y_ticks = [f'{i}' for i in range(self.nby)]
|
111
|
+
|
112
|
+
ax.set_yticks(np.linspace(xmin+self.dx/2., xmax-self.dx/2., endpoint=True, num=self.nbx))
|
113
|
+
ax.set_xticks(np.linspace(ymin+self.dy/2., ymax-self.dy/2., endpoint=True, num=self.nby))
|
114
|
+
|
115
|
+
x_ticks.reverse()
|
116
|
+
ax.set_yticklabels(x_ticks)
|
117
|
+
ax.set_xticklabels(y_ticks)
|
118
|
+
|
119
|
+
self.set_aspect_labels_matrice(ax=ax, **kwargs)
|
120
|
+
|
121
|
+
return fig, ax
|
122
|
+
|
80
123
|
def plot_circle_at_centers(self, ax:Axes=None, color='black', radius:float=None, **kwargs):
|
81
124
|
""" Plot circles at the center of the cells.
|
82
125
|
"""
|
@@ -124,6 +167,64 @@ class Mesh2D(header_wolf):
|
|
124
167
|
self.set_aspect_labels(ax=ax, **kwargs)
|
125
168
|
|
126
169
|
return fig, ax
|
170
|
+
|
171
|
+
def plot_memoryposition_at_centers(self, ax:Axes=None,
|
172
|
+
transpose=False,
|
173
|
+
Fortran_type:bool = True,
|
174
|
+
f_contiguous:bool = True,
|
175
|
+
**kwargs):
|
176
|
+
""" Plot the position of the cells at the center of the cells.
|
177
|
+
"""
|
178
|
+
|
179
|
+
if ax is None:
|
180
|
+
fig, ax = plt.subplots()
|
181
|
+
else:
|
182
|
+
fig = ax.figure
|
183
|
+
|
184
|
+
[xmin, xmax], [ymin, ymax] = self.get_bounds()
|
185
|
+
|
186
|
+
if transpose:
|
187
|
+
k = 0
|
188
|
+
if Fortran_type:
|
189
|
+
k+=1
|
190
|
+
|
191
|
+
all_y = list(np.linspace(xmin + self.dx/2., xmax - self.dx/2., endpoint=True, num=self.nbx))
|
192
|
+
all_x = list(np.linspace(ymin + self.dy/2., ymax - self.dy/2., endpoint=True, num=self.nby))
|
193
|
+
|
194
|
+
all_y.reverse()
|
195
|
+
|
196
|
+
if f_contiguous:
|
197
|
+
|
198
|
+
for x in all_x:
|
199
|
+
for y in all_y:
|
200
|
+
|
201
|
+
ax.text(x, y, f'{k}', horizontalalignment='center', verticalalignment='center', **kwargs)
|
202
|
+
k+=1
|
203
|
+
else:
|
204
|
+
|
205
|
+
for y in all_y:
|
206
|
+
for x in all_x:
|
207
|
+
|
208
|
+
ax.text(x, y, f'{k}', horizontalalignment='center', verticalalignment='center', **kwargs)
|
209
|
+
k+=1
|
210
|
+
|
211
|
+
self.set_aspect_labels_matrice(ax=ax, **kwargs)
|
212
|
+
|
213
|
+
else:
|
214
|
+
|
215
|
+
k = 0
|
216
|
+
if Fortran_type:
|
217
|
+
k+=1
|
218
|
+
|
219
|
+
for y in np.linspace(ymin + self.dy/2., ymax - self.dy/2., endpoint=True, num=self.nby):
|
220
|
+
for x in np.linspace(xmin + self.dx/2., xmax - self.dx/2., endpoint=True, num=self.nbx):
|
221
|
+
|
222
|
+
ax.text(x, y, f'{k}', horizontalalignment='center', verticalalignment='center', **kwargs)
|
223
|
+
k+=1
|
224
|
+
|
225
|
+
self.set_aspect_labels(ax=ax, **kwargs)
|
226
|
+
|
227
|
+
return fig, ax
|
127
228
|
|
128
229
|
def plot_indices_at_bordersX(self, ax:Axes=None, Fortran_type:bool = True, **kwargs):
|
129
230
|
""" Plot the indices of the cells at the borders of the cells.
|
@@ -599,6 +700,27 @@ class Mesh2D(header_wolf):
|
|
599
700
|
ax.set_xlabel('X (m)')
|
600
701
|
ax.set_ylabel('Y (m)')
|
601
702
|
return fig, ax
|
703
|
+
|
704
|
+
def set_aspect_labels_matrice(self, ax:Axes=None, **kwargs):
|
705
|
+
""" Set the aspect of the plot to be equal.
|
706
|
+
"""
|
707
|
+
if ax is None:
|
708
|
+
fig, ax = plt.subplots()
|
709
|
+
else:
|
710
|
+
fig = ax.figure
|
711
|
+
|
712
|
+
[xmin, xmax], [ymin, ymax] = self.get_bounds()
|
713
|
+
|
714
|
+
ax.set_aspect('equal')
|
715
|
+
ax.set_ylim(xmin, xmax)
|
716
|
+
ax.set_xlim(ymin, ymax)
|
717
|
+
ax.set_xlabel('columns')
|
718
|
+
ax.set_ylabel('rows')
|
719
|
+
|
720
|
+
#set x ais on the upper side
|
721
|
+
ax.xaxis.set_ticks_position('top')
|
722
|
+
ax.xaxis.set_label_position('top')
|
723
|
+
return fig, ax
|
602
724
|
|
603
725
|
def zeros(self):
|
604
726
|
""" Return a 2D array of zeros with the shape of the mesh.
|
@@ -13,14 +13,13 @@ import logging
|
|
13
13
|
|
14
14
|
from ..drawing_obj import Element_To_Draw
|
15
15
|
|
16
|
-
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
from .kiwis import hydrometry
|
16
|
+
try:
|
17
|
+
# Trying to import the hydrometry_hece module from the hydrometry_hece package
|
18
|
+
# containing the KEY access to the SPW server
|
19
|
+
from ..hydrometry_hece.kiwis_hece import hydrometry_hece as hydrometry
|
20
|
+
except:
|
21
|
+
# If the hydrometry_hece module is not found, we import the hydrometry module from the hydrometry package
|
22
|
+
from .kiwis import hydrometry
|
24
23
|
|
25
24
|
from .kiwis_gui import hydrometry_gui
|
26
25
|
from ..PyVertex import cloud_vertices, wolfvertex, Cloud_Styles, getIfromRGB, getRGBfromI
|
wolfhece/wolf_array.py
CHANGED
@@ -7699,7 +7699,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7699
7699
|
self.nby)
|
7700
7700
|
cursel = [(x, y) for x in xall for y in yall]
|
7701
7701
|
|
7702
|
-
z = griddata(curlist, z, cursel, fill_value=np.
|
7702
|
+
z = griddata(curlist, z, cursel, fill_value=np.nan)
|
7703
7703
|
|
7704
7704
|
for cur, curz in zip(cursel, z):
|
7705
7705
|
if not np.isnan(curz):
|
@@ -10068,7 +10068,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10068
10068
|
figsize:tuple=None,
|
10069
10069
|
Walonmap:bool=False,
|
10070
10070
|
cat:str='IMAGERIE/ORTHO_2022_ETE',
|
10071
|
-
first_mask_data:bool=True
|
10071
|
+
first_mask_data:bool=True,
|
10072
|
+
with_legend:bool=False):
|
10072
10073
|
"""
|
10073
10074
|
Plot the array - Matplotlib version
|
10074
10075
|
|
@@ -10117,6 +10118,10 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10117
10118
|
- `'IMAGERIE/ORTHO_2023_ETE'`
|
10118
10119
|
- `'IMAGERIE/ORTHO_LAST'`
|
10119
10120
|
:type cat: str, optional (Default value = `'IMAGERIE/ORTHO_2022_ETE'`)
|
10121
|
+
:param first_mask_data: If True, applies the mask to the data before plotting. Default is True.
|
10122
|
+
:type first_mask_data: bool, optional (Default value = True)
|
10123
|
+
:param with_legend: If True, adds a color legend to the plot. Default is False.
|
10124
|
+
:type with_legend: bool, optional (Default value = False)
|
10120
10125
|
:return: If `getdata_im` is False, returns (fig, ax), where `fig` is the Matplotlib figure and `ax` is the axis. If `getdata_im` is True, returns (fig, ax, im), where `im` is the image object created by `imshow`.
|
10121
10126
|
:rtype: tuple
|
10122
10127
|
"""
|
@@ -10146,6 +10151,11 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10146
10151
|
logging.error(_('Error while fetching the map image from WalOnMap'))
|
10147
10152
|
logging.error(e)
|
10148
10153
|
|
10154
|
+
if vmin is None and vmax is not None:
|
10155
|
+
vmin = self.mypal.values[0]
|
10156
|
+
elif vmax is None and vmin is not None:
|
10157
|
+
vmax = self.mypal.values[-1]
|
10158
|
+
|
10149
10159
|
if (vmin is None) and (vmax is None):
|
10150
10160
|
# im = ax.imshow(self.array.transpose(), origin='lower', cmap=self.mypal,
|
10151
10161
|
# extent=(self.origx, self.origx + self.dx * self.nbx, self.origy, self.origy + self.dy * self.nby))
|
@@ -10160,6 +10170,21 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10160
10170
|
self.origy + self.dy * self.nby),
|
10161
10171
|
alpha=np.select([self.array.mask.T, ~self.array.mask.T],
|
10162
10172
|
[np.zeros(self.shape).T, np.ones(self.shape).T]))
|
10173
|
+
|
10174
|
+
if with_legend:
|
10175
|
+
# add a legend in a new axis
|
10176
|
+
ax_leg = fig.add_axes([0.92, 0.12, 0.04, 0.8])
|
10177
|
+
from matplotlib.colorbar import ColorbarBase
|
10178
|
+
from matplotlib import colors
|
10179
|
+
cbar = ColorbarBase(ax_leg, cmap=self.mypal.cmap, norm=self.mypal.norm, orientation='vertical')
|
10180
|
+
cbar.set_ticks(self.mypal.values)
|
10181
|
+
cbar.set_ticklabels(self.mypal.values)
|
10182
|
+
cbar.ax.tick_params(labelsize=8)
|
10183
|
+
cbar.ax.yaxis.set_label_position('left')
|
10184
|
+
cbar.ax.yaxis.set_ticks_position('right')
|
10185
|
+
cbar.ax.yaxis.set_tick_params(width=0.5, size=2, direction='in', color='black')
|
10186
|
+
|
10187
|
+
|
10163
10188
|
else:
|
10164
10189
|
im = ax.imshow(self.array.transpose(),
|
10165
10190
|
origin='lower',
|
@@ -10171,7 +10196,27 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
10171
10196
|
vmin=vmin, vmax=vmax,
|
10172
10197
|
alpha=np.select([self.array.mask.T, ~self.array.mask.T],
|
10173
10198
|
[np.zeros(self.shape).T, np.ones(self.shape).T]) )
|
10199
|
+
|
10200
|
+
|
10201
|
+
if with_legend:
|
10202
|
+
# add a legend in a new axis
|
10203
|
+
ax_leg = fig.add_axes([0.92, 0.12, 0.04, 0.8])
|
10204
|
+
from matplotlib.colorbar import ColorbarBase
|
10205
|
+
from matplotlib import colors
|
10206
|
+
from matplotlib.colors import Normalize
|
10207
|
+
cbar = ColorbarBase(ax_leg, cmap=self.mypal.cmap, norm= Normalize(vmin, vmax), orientation='vertical')
|
10208
|
+
vals = list(np.linspace(vmin, vmax, self.mypal.nb, endpoint=True))
|
10209
|
+
# limit to 2 decimal places
|
10210
|
+
vals = [round(val, 2) for val in vals]
|
10211
|
+
cbar.set_ticks(vals)
|
10212
|
+
cbar.set_ticklabels(vals)
|
10213
|
+
cbar.ax.tick_params(labelsize=8)
|
10214
|
+
cbar.ax.yaxis.set_label_position('left')
|
10215
|
+
cbar.ax.yaxis.set_ticks_position('right')
|
10216
|
+
cbar.ax.yaxis.set_tick_params(width=0.5, size=2, direction='in', color='black')
|
10217
|
+
|
10174
10218
|
ax.set_aspect('equal')
|
10219
|
+
fig.tight_layout()
|
10175
10220
|
|
10176
10221
|
if getdata_im:
|
10177
10222
|
return fig, ax, im
|
@@ -11437,7 +11482,7 @@ class WolfArrayMB(WolfArray):
|
|
11437
11482
|
:param j: j index
|
11438
11483
|
:param which_block: block index 1-based
|
11439
11484
|
"""
|
11440
|
-
h = np.
|
11485
|
+
h = np.nan
|
11441
11486
|
if which_block == 0:
|
11442
11487
|
logging.warning("Block index is probably 0-based. It should be 1-based.")
|
11443
11488
|
return h
|
@@ -11458,7 +11503,7 @@ class WolfArrayMB(WolfArray):
|
|
11458
11503
|
Read the value at world coordinate (x,y). if `abs` is
|
11459
11504
|
given, then the translation is is taken into account.
|
11460
11505
|
|
11461
|
-
If no block covers the coordinate, then np.
|
11506
|
+
If no block covers the coordinate, then np.nan is returned
|
11462
11507
|
If several blocks cover the given coordinate then the first
|
11463
11508
|
match is returned (and thus, the others are ignored).
|
11464
11509
|
|
@@ -11466,10 +11511,10 @@ class WolfArrayMB(WolfArray):
|
|
11466
11511
|
:param y: y coordinate
|
11467
11512
|
:param abs: if True, then the translation is taken into account
|
11468
11513
|
|
11469
|
-
:return: the value at (x,y) or np.
|
11514
|
+
:return: the value at (x,y) or np.nan if no block covers the coordinate
|
11470
11515
|
"""
|
11471
11516
|
|
11472
|
-
h = np.
|
11517
|
+
h = np.nan
|
11473
11518
|
for curblock in self.myblocks.values():
|
11474
11519
|
curblock: WolfArray
|
11475
11520
|
nbx = curblock.nbx
|
@@ -12101,7 +12146,8 @@ class WolfArrayMB(WolfArray):
|
|
12101
12146
|
figsize:tuple=None,
|
12102
12147
|
Walonmap:bool=False,
|
12103
12148
|
cat:str='IMAGERIE/ORTHO_2022_ETE',
|
12104
|
-
first_mask_data:bool=True
|
12149
|
+
first_mask_data:bool=True,
|
12150
|
+
with_legend:bool=False):
|
12105
12151
|
"""
|
12106
12152
|
Plot the multi-block (MB) array - Matplotlib version
|
12107
12153
|
|
@@ -12153,6 +12199,10 @@ class WolfArrayMB(WolfArray):
|
|
12153
12199
|
- `'IMAGERIE/ORTHO_2023_ETE'`
|
12154
12200
|
- `'IMAGERIE/ORTHO_LAST'`
|
12155
12201
|
:type cat: str, optional (Default value = `'IMAGERIE/ORTHO_2022_ETE'`)
|
12202
|
+
:param first_mask_data: If True, applies the mask to the data before plotting. Default is True.
|
12203
|
+
:type first_mask_data: bool, optional (Default value = True)
|
12204
|
+
:param with_legend: If True, adds a color legend to the plot. Default is False.
|
12205
|
+
:type with_legend: bool, optional (Default value = False)
|
12156
12206
|
:return: If `getdata_im` is False, returns (fig, ax), where `fig` is the Matplotlib figure and `ax` is the axis. If `getdata_im` is True, returns (fig, ax, im), where `im` is the image object created by `imshow`.
|
12157
12207
|
:rtype: tuple
|
12158
12208
|
"""
|
@@ -12167,7 +12217,8 @@ class WolfArrayMB(WolfArray):
|
|
12167
12217
|
figsize=figsize,
|
12168
12218
|
Walonmap=Walonmap,
|
12169
12219
|
cat=cat,
|
12170
|
-
first_mask_data=first_mask_data
|
12220
|
+
first_mask_data=first_mask_data,
|
12221
|
+
with_legend=with_legend)
|
12171
12222
|
|
12172
12223
|
|
12173
12224
|
class WolfArrayMNAP(WolfArrayMB):
|