wolfhece 2.0.53__py3-none-any.whl → 2.0.55__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/apps/version.py CHANGED
@@ -5,7 +5,7 @@ class WolfVersion():
5
5
 
6
6
  self.major = 2
7
7
  self.minor = 0
8
- self.patch = 53
8
+ self.patch = 55
9
9
 
10
10
  def __str__(self):
11
11
 
@@ -3040,7 +3040,7 @@ class prev_sim2D():
3040
3040
  ('.top','Bed Elevation [m]',WOLF_ARRAY_FULL_SINGLE),
3041
3041
  ('.topini_fine','Bed Elevation - computed [m]',WOLF_ARRAY_FULL_SINGLE),
3042
3042
  ('.frot','Roughness coefficient [law dependent]',WOLF_ARRAY_FULL_SINGLE),
3043
- ('.inf','Infiltration zone [-]',WOLF_ARRAY_FULL_SINGLE),
3043
+ ('.inf','Infiltration zone [-]',WOLF_ARRAY_FULL_INTEGER),
3044
3044
  ('.hbin','Initial water depth [m]',WOLF_ARRAY_FULL_SINGLE),
3045
3045
  ('.qxbin','Initial discharge along X [m^2/s]',WOLF_ARRAY_FULL_SINGLE),
3046
3046
  ('.qybin','Initial discharge along Y [m^2/s]',WOLF_ARRAY_FULL_SINGLE)
@@ -3154,13 +3154,17 @@ class prev_sim2D():
3154
3154
  def nb_blocks(self):
3155
3155
  return self.mymnap.nb_blocks
3156
3156
 
3157
- def read_fine_array(self, which:Literal['.top', '.hbin', '.qxbin', '.qybin', '.napbin', '.topini_fine', '.frot', '.inf']=''):
3157
+ def read_fine_array(self, which:Literal['.top', '.hbin', '.qxbin', '.qybin', '.napbin', '.topini_fine', '.frot', '.inf']='') -> WolfArray:
3158
3158
  """
3159
3159
  Lecture d'une matrice fine
3160
3160
 
3161
- @param which: suffixe du fichier
3162
- @type which: str -- extension with point (e.g. '.hbin')
3161
+ :param which: suffixe du fichier
3162
+ :type which: str -- extension with point (e.g. '.hbin')
3163
+ :return: WolfArray
3163
3164
  """
3165
+ which = str(which)
3166
+ if not which.startswith('.'):
3167
+ which = '.' + which
3164
3168
 
3165
3169
  if Path(self.filenamegen + which).exists():
3166
3170
  myarray = WolfArray(fname = self.filenamegen + which)
@@ -3172,14 +3176,19 @@ class prev_sim2D():
3172
3176
 
3173
3177
  return myarray
3174
3178
 
3175
- def read_MB_array(self, which:Literal['.hbinb', '.qxbinb', '.qybinb', '.frotini', '.topini']=''):
3179
+ def read_MB_array(self, which:Literal['.hbinb', '.qxbinb', '.qybinb', '.frotini', '.topini']='') -> WolfArrayMB:
3176
3180
  """
3177
3181
  Lecture d'une matrice MB
3178
3182
 
3179
- @param which: suffixe du fichier
3180
- @type which: str -- extension with point (e.g. '.hbinb')
3183
+ :param which: suffixe du fichier
3184
+ :type which: str -- extension with point (e.g. '.hbinb')
3185
+ :return: WolfArrayMB
3181
3186
  """
3182
3187
 
3188
+ which = str(which)
3189
+ if not which.startswith('.'):
3190
+ which = '.' + which
3191
+
3183
3192
  if Path(self.filenamegen + which).exists():
3184
3193
  myarray =WolfArrayMB()
3185
3194
  myarray.set_header(self.get_header_MB())
wolfhece/wolf_array.py CHANGED
@@ -5248,6 +5248,11 @@ class WolfArray(Element_To_Draw, header_wolf):
5248
5248
  self.wolftype = WOLF_ARRAY_FULL_INTEGER16
5249
5249
  elif locarray.dtype == np.int8:
5250
5250
  self.wolftype = WOLF_ARRAY_FULL_INTEGER8
5251
+ else:
5252
+ logging.error(_('Unsupported type in numpy file -- Abort loading'))
5253
+ return
5254
+
5255
+ tmp_wolftype = self.wolftype
5251
5256
 
5252
5257
  # Il y de fortes chances que cette matrice numpy provienne d'une modélisation GPU
5253
5258
  # et donc que les coordonnées et la résolution soient disponibles dans un fichier parameters.json
@@ -5270,6 +5275,13 @@ class WolfArray(Element_To_Draw, header_wolf):
5270
5275
  elif (locpath.parent / (locpath.name + '.txt')).exists():
5271
5276
  self.read_txt_header()
5272
5277
 
5278
+ # Le header contient également un type
5279
+ # Vérification de la cohérence
5280
+ if self.wolftype != tmp_wolftype:
5281
+ logging.warning(_('Inconsistent type in header and numpy file'))
5282
+ logging.warning(_('Forcing type from Numpy file'))
5283
+ self.wolftype = tmp_wolftype
5284
+
5273
5285
  self.mask_data(self.nullvalue)
5274
5286
  self.loaded = True
5275
5287
 
@@ -5296,8 +5308,34 @@ class WolfArray(Element_To_Draw, header_wolf):
5296
5308
  if self.filename.endswith('.tif'):
5297
5309
  self.export_geotif()
5298
5310
  elif self.filename.endswith('.npy'):
5311
+
5312
+ writing_header = True
5313
+ if self.dtype != self.array.data.dtype:
5314
+ logging.warning(_('Data type changed -- Force conversion to internal numpy array'))
5315
+ locarray = self.array.data
5316
+ if locarray.dtype == np.float32:
5317
+ self.wolftype = WOLF_ARRAY_FULL_SINGLE
5318
+ logging.warning(_('Data type changed to float32'))
5319
+ elif locarray.dtype == np.float64:
5320
+ self.wolftype = WOLF_ARRAY_FULL_DOUBLE
5321
+ logging.warning(_('Data type changed to float64'))
5322
+ elif locarray.dtype == np.int32:
5323
+ self.wolftype = WOLF_ARRAY_FULL_INTEGER
5324
+ logging.warning(_('Data type changed to int32'))
5325
+ elif locarray.dtype == np.int16:
5326
+ self.wolftype = WOLF_ARRAY_FULL_INTEGER16
5327
+ logging.warning(_('Data type changed to int16'))
5328
+ elif locarray.dtype == np.int8:
5329
+ self.wolftype = WOLF_ARRAY_FULL_INTEGER8
5330
+ logging.warning(_('Data type changed to int8'))
5331
+ else:
5332
+ logging.error(_('Unsupported type in numpy file -- Abort wrting header file'))
5333
+ writing_header = False
5334
+
5299
5335
  np.save(self.filename, self.array.data)
5300
- self.write_txt_header()
5336
+
5337
+ if writing_header:
5338
+ self.write_txt_header()
5301
5339
  else:
5302
5340
  self.write_txt_header()
5303
5341
  self.write_array()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.0.53
3
+ Version: 2.0.55
4
4
  Author-email: Pierre Archambeau <pierre.archambeau@uliege.be>
5
5
  License: AGPL-v3 License
6
6
  Project-URL: Homepage, https://uee.uliege.be/hece
@@ -48,7 +48,7 @@ wolfhece/rain_SPWMI.py,sha256=YqsF-yFro3y_a6MfVRFfr-Rxi7NR1gl_i8VX7scmzes,13548
48
48
  wolfhece/test_Results2DGPU.py,sha256=NOJ_hFXrcLSQXS1dtsqXRQltqIZtDSHMz_EgAJ2_FHU,307
49
49
  wolfhece/textpillow.py,sha256=zEfLrKhfCDyMaVuQOUjHqz6MGKeQ4aewMxOsWi5-wKI,13832
50
50
  wolfhece/tools_mpl.py,sha256=q8Yc4aukPPiUcEzREvZRM_em67XqXaahdoaNt0DETfE,266
51
- wolfhece/wolf_array.py,sha256=GW5XxM-oHgyP-4jRvWEBM4Lw3-_V5jQv7SeLlZ_2rM4,294309
51
+ wolfhece/wolf_array.py,sha256=WMiA4VvBsh_Dcabubs8tpi5hxvhZ9V_0vU1v2JjRmX0,296214
52
52
  wolfhece/wolf_hist.py,sha256=JpRXvzJLUP-RkSkvth3DQWglgTMFI2ZEUDb4RYOfeeI,3284
53
53
  wolfhece/wolf_texture.py,sha256=llQ7aV8scWXIkhpri9XjaPejzoBJsGfsln2ZnlRbFkU,16270
54
54
  wolfhece/wolf_tiles.py,sha256=F2JsJHdAP8fIffNJdG_J26bonCIRtIwMmxKFqdSCRDA,10088
@@ -66,7 +66,7 @@ wolfhece/apps/check_install.py,sha256=jrKR-njqnpIh6ZJqvP6KbDUPVCfwTNQj4glQhcyzs9
66
66
  wolfhece/apps/curvedigitizer.py,sha256=avWERHuVxPnJBOD_ibczwW_XG4vAenqWS8W1zjhBox8,4898
67
67
  wolfhece/apps/isocurrent.py,sha256=4XnNWPa8mYUK7V4zdDRFrHFIXNG2AN2og3TqWKKcqjY,3811
68
68
  wolfhece/apps/splashscreen.py,sha256=m9hMTqzhSUcTudApyNNjoAK9e2u5vgEkJVV79xmfM1s,2118
69
- wolfhece/apps/version.py,sha256=tMaJUj2jbKD0yIe4bYrNyC4HSMxcSkmAJChhWsP4nSQ,388
69
+ wolfhece/apps/version.py,sha256=nzym95IBzW11oeKKAZVu2oVnByXAzpA7CWw8xvcfM5Q,388
70
70
  wolfhece/apps/wolf.py,sha256=gqfm-ZaUJqNsfCzmdtemSeqLw-GVdSVix-evg5WArJI,293
71
71
  wolfhece/apps/wolf2D.py,sha256=gWD9ee2-1pw_nUxjgRaJMuSe4kUT-RWhOeoTt_Lh1mM,267
72
72
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -211,7 +211,7 @@ wolfhece/mesh2d/bc_manager.py,sha256=vSVogXy1x3A6fZKWA6mPZSGX2e3EAUVmEjD9Bgww_hU
211
211
  wolfhece/mesh2d/cell_tracker.py,sha256=AR-Bty-QnrY1ni8Lwak2kU2UWMAJSBCF2ugl2YpfsB4,8660
212
212
  wolfhece/mesh2d/config_manager.py,sha256=vrxLku4isZJTxbHOACEEIEEjQB9pkLpaVPteJz9GhnE,14417
213
213
  wolfhece/mesh2d/cst_2D_boundary_conditions.py,sha256=BaJeKHyJiKEFWBkTQeYsDBW86703ooj65MFVpPMgjLg,2810
214
- wolfhece/mesh2d/wolf2dprev.py,sha256=_MnOSYn0OHZav7ikkp-40oIe7LglhKLvwwTBZK0pqow,145333
214
+ wolfhece/mesh2d/wolf2dprev.py,sha256=sLv6Qx__kGGFvV9DecRjkBY-lILR0qJcFK_XrXycptQ,145622
215
215
  wolfhece/models/HECE_169.pptx,sha256=OWJtsWz504A-REFaaxw8lwStHyQU2l7KEeiE7IZvtbk,3396930
216
216
  wolfhece/models/blue.pal,sha256=NnjJnjnYVdQkG54RyPXvo4Tl9ytB0cN7zpiHtj1N6bw,33
217
217
  wolfhece/models/diff16.pal,sha256=Pkp9kQ1GvmAKz3lgwohsw8eQySjVVKHbjhoWw-gZ6Nc,303
@@ -256,8 +256,8 @@ wolfhece/sounds/sonsw2.wav,sha256=pFLVt6By0_EPQNt_3KfEZ9a1uSuYTgQSX1I_Zurv9Rc,11
256
256
  wolfhece/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
257
257
  wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=yGbU_JsF56jsmms0gh7mxa7tbNQ_SxqhpAZxhm-mTy4,14860
258
258
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=wCxGRnE3kzEkWlWA6-3X8ADOFux_B0a5QWJ2GnXTgJw,4709
259
- wolfhece-2.0.53.dist-info/METADATA,sha256=CQcXOZCu0QZgwPzlep15lih8X1EL970VHL1ur80ouZM,2233
260
- wolfhece-2.0.53.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
261
- wolfhece-2.0.53.dist-info/entry_points.txt,sha256=AIu1KMswrdsqNq_2jPtrRIU4tLjuTnj2dCY-pxIlshw,276
262
- wolfhece-2.0.53.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
263
- wolfhece-2.0.53.dist-info/RECORD,,
259
+ wolfhece-2.0.55.dist-info/METADATA,sha256=l5v7KykbqyDpev8-EywylP8wtb0UiymoC77zNlfvlx8,2233
260
+ wolfhece-2.0.55.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
261
+ wolfhece-2.0.55.dist-info/entry_points.txt,sha256=AIu1KMswrdsqNq_2jPtrRIU4tLjuTnj2dCY-pxIlshw,276
262
+ wolfhece-2.0.55.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
263
+ wolfhece-2.0.55.dist-info/RECORD,,