sdfr 1.4.3__py3-none-win_amd64.whl → 1.4.4__py3-none-win_amd64.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.
sdfr/SDF.py CHANGED
@@ -340,6 +340,7 @@ class BlockList:
340
340
  """Contains all the blocks"""
341
341
 
342
342
  def __init__(self, filename, convert=False, derived=True):
343
+ self._handle = None
343
344
  clib = sdf_lib
344
345
  self._clib = clib
345
346
  clib.sdf_open.restype = ct.POINTER(SdfFile)
@@ -417,6 +418,7 @@ class BlockList:
417
418
  if block.datatype_out != 0:
418
419
  newblock = BlockLagrangianMesh(block)
419
420
  newblock_mid = block
421
+ newblock_mid._grid_block = newblock
420
422
  mesh_id_map[newblock.id] = newblock
421
423
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_NAMEVALUE:
422
424
  newblock = BlockNameValue(block)
@@ -430,6 +432,7 @@ class BlockList:
430
432
  if block.datatype_out != 0:
431
433
  newblock = BlockPlainMesh(block)
432
434
  newblock_mid = block
435
+ newblock_mid._grid_block = newblock
433
436
  mesh_id_map[newblock.id] = newblock
434
437
  elif (
435
438
  blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_DERIVED
@@ -474,6 +477,7 @@ class BlockList:
474
477
  self._block_ids.update({nm: newblock})
475
478
  nm = block_mid.name.decode() + "_mid"
476
479
  self._block_names.update({nm: newblock})
480
+ newblock_mid._grid_block._grid_mid = newblock
477
481
 
478
482
  for var in mesh_vars:
479
483
  gid = var.grid_id
@@ -481,10 +485,12 @@ class BlockList:
481
485
  var._grid = mesh_id_map[gid]
482
486
 
483
487
  def __del__(self):
484
- self._clib.sdf_stack_destroy.argtypes = [ct.c_void_p]
485
- self._clib.sdf_close.argtypes = [ct.c_void_p]
486
- self._clib.sdf_stack_destroy(self._handle)
487
- self._clib.sdf_close(self._handle)
488
+ if self._handle:
489
+ self._clib.sdf_stack_destroy.argtypes = [ct.c_void_p]
490
+ self._clib.sdf_close.argtypes = [ct.c_void_p]
491
+ self._clib.sdf_stack_destroy(self._handle)
492
+ self._clib.sdf_close(self._handle)
493
+ self._handle = None
488
494
 
489
495
  @property
490
496
  def name_dict(self):
@@ -600,6 +606,11 @@ class BlockPlainVariable(Block):
600
606
  """Associated mesh"""
601
607
  return self._grid
602
608
 
609
+ @property
610
+ def grid_mid(self):
611
+ """Associated median mesh"""
612
+ return self._grid._grid_mid
613
+
603
614
  @property
604
615
  def grid_id(self):
605
616
  """Associated mesh id"""
@@ -901,7 +912,8 @@ def get_header(h):
901
912
 
902
913
 
903
914
  def get_run_info(block):
904
- from datetime import datetime
915
+ from datetime import datetime as dtm
916
+ from datetime import UTC
905
917
 
906
918
  h = ct.cast(block.data, ct.POINTER(RunInfo)).contents
907
919
  d = {}
@@ -910,9 +922,9 @@ def get_run_info(block):
910
922
  d["sha1sum"] = h.sha1sum.decode()
911
923
  d["compile_machine"] = h.compile_machine.decode()
912
924
  d["compile_flags"] = h.compile_flags.decode()
913
- d["compile_date"] = datetime.utcfromtimestamp(h.compile_date).strftime("%c")
914
- d["run_date"] = datetime.utcfromtimestamp(h.run_date).strftime("%c")
915
- d["io_data"] = datetime.utcfromtimestamp(h.io_date).strftime("%c")
925
+ d["compile_date"] = dtm.fromtimestamp(h.compile_date, UTC).strftime("%c")
926
+ d["run_date"] = dtm.fromtimestamp(h.run_date, UTC).strftime("%c")
927
+ d["io_data"] = dtm.fromtimestamp(h.io_date, UTC).strftime("%c")
916
928
  return d
917
929
 
918
930
 
sdfr/_commit_info.py CHANGED
@@ -1,2 +1,2 @@
1
- __commit_date__ = "Tue Jun 10 10:08:15 2025 +0100"
2
- __commit_id__ = "78518bb920d66415e43857a26b0e7f914bd05da1"
1
+ __commit_date__ = "Thu Jun 19 14:32:34 2025 +0100"
2
+ __commit_id__ = "1b49a56a9b844067b2d9900ef3cb45824821cefb"
sdfr/sdf_helper.py CHANGED
@@ -888,7 +888,7 @@ def plot1d(
888
888
  if title:
889
889
  subplot.set_title(get_title(var), fontsize="large", y=1.03)
890
890
 
891
- figure.set_tight_layout(True)
891
+ figure.set_layout_engine("tight")
892
892
  figure.canvas.draw()
893
893
 
894
894
 
@@ -997,7 +997,7 @@ def plot_path(
997
997
  elif figure is None:
998
998
  figure = subplot.figure
999
999
  subplot.axis(plot_path.axis)
1000
- figure.set_tight_layout(True)
1000
+ figure.set_layout_engine("tight")
1001
1001
  figure.canvas.draw()
1002
1002
  return
1003
1003
 
@@ -1251,7 +1251,7 @@ def plot_path(
1251
1251
  subplot.axis(lim)
1252
1252
 
1253
1253
  if update:
1254
- figure.set_tight_layout(True)
1254
+ figure.set_layout_engine("tight")
1255
1255
  figure.canvas.draw()
1256
1256
 
1257
1257
 
@@ -1300,6 +1300,11 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1300
1300
  kwargs["hold"] = True
1301
1301
  return
1302
1302
 
1303
+ if rays:
1304
+ ray_list = [var.data[i] for i in rays]
1305
+ else:
1306
+ ray_list = var.data[ray_slice]
1307
+
1303
1308
  if not isinstance(v, sdf.BlockLagrangianMesh):
1304
1309
  k = "cbar_label"
1305
1310
  if k not in kwargs or (
@@ -1311,30 +1316,23 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1311
1316
  k0 = "vmin"
1312
1317
  k1 = "vmax"
1313
1318
  k = "vrange"
1314
- if k not in kwargs and not (k0 in kwargs and k1 in kwargs):
1315
- v = var.data[0]
1316
- vmin = v.data.min()
1317
- vmax = v.data.max()
1318
- if rays:
1319
- ray_list = [var.data[i] for i in rays]
1320
- else:
1321
- ray_list = var.data[ray_slice]
1319
+ vmin, vmax = 1e99, -1e99
1320
+ if k not in kwargs and not (k0 in kwargs and k1 in kwargs) \
1321
+ and len(ray_list) > 0:
1322
1322
  for v in ray_list:
1323
- vmin = min(vmin, v.data.min())
1324
- vmax = max(vmax, v.data.max())
1325
- if k0 not in kwargs:
1326
- kwargs[k0] = vmin
1327
- if k1 not in kwargs:
1328
- kwargs[k1] = vmax
1323
+ if len(v.data) > 0:
1324
+ vmin = min(vmin, v.data.min())
1325
+ vmax = max(vmax, v.data.max())
1329
1326
 
1330
- if rays:
1331
- ray_list = [var.data[i] for i in rays]
1332
- else:
1333
- ray_list = var.data[ray_slice]
1327
+ if k0 not in kwargs:
1328
+ kwargs[k0] = vmin
1329
+ if k1 not in kwargs:
1330
+ kwargs[k1] = vmax
1334
1331
 
1335
1332
  for v in ray_list:
1336
- plot_auto(v, update=False, **kwargs)
1337
- kwargs["hold"] = True
1333
+ if len(v.data) > 0:
1334
+ plot_auto(v, update=False, **kwargs)
1335
+ kwargs["hold"] = True
1338
1336
 
1339
1337
  plot_auto(var.data[0], axis_only=True, **kwargs)
1340
1338
  kwargs["hold"] = True
@@ -1635,7 +1633,7 @@ def plot2d_array(
1635
1633
  cbar.set_label(var_label, fontsize="large", x=1.2)
1636
1634
  figure.canvas.draw()
1637
1635
 
1638
- figure.set_tight_layout(True)
1636
+ figure.set_layout_engine("tight")
1639
1637
  figure.canvas.draw()
1640
1638
 
1641
1639
 
@@ -1959,7 +1957,7 @@ def plot_levels(
1959
1957
  # gs.update(right=1-tw/fw)
1960
1958
  # ax.set_position([box.x0, box.y0, box.width + bw, box.height])
1961
1959
  else:
1962
- fig.set_tight_layout(True)
1960
+ fig.set_layout_engine("tight")
1963
1961
  plt.draw()
1964
1962
 
1965
1963
 
@@ -2225,7 +2223,7 @@ def plotgrid(fname=None, iso=None, title=True):
2225
2223
  plt.draw()
2226
2224
 
2227
2225
  fig = plt.gcf()
2228
- fig.set_tight_layout(True)
2226
+ fig.set_layout_engine("tight")
2229
2227
  plt.draw()
2230
2228
 
2231
2229
 
sdfr/sdfc_shared.dll CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sdfr
3
- Version: 1.4.3
3
+ Version: 1.4.4
4
4
  Summary: Python module for processing SDF files
5
5
  Author-Email: Keith Bennett <k.bennett@warwick.ac.uk>
6
6
  Requires-Dist: numpy
@@ -0,0 +1,12 @@
1
+ sdfr/__init__.py,sha256=OxcJAJ0ADoE54vgqMQqxhoFWyU2ldb3fb-_LFyeZZfQ,1209
2
+ sdfr/_commit_info.py,sha256=hqXwlOqYzU29y9NaKyuTotIZ84sBacjNh7bvhYqVsaE,112
3
+ sdfr/loadlib.py,sha256=xxp5MX-u7ZHIc12mcvN-y8L5UEjY-aEgINj2r-1swWk,2358
4
+ sdfr/SDF.py,sha256=fawFbkOiSIzeKOtc6Vic0OQ96q2on213IP4jSxLTbRo,31570
5
+ sdfr/sdf_helper.py,sha256=n-2h-MrqQM-5p-lsmLhIealtSnsOeQTd-nNezYp0EgA,63670
6
+ sdfr/sdfc_shared.dll,sha256=w22kJKHIxaFeAhdbm1EoElDhIUZoZLlZ8_bL2QwhXbs,121344
7
+ sdfr/sdfc_shared.lib,sha256=S1N_78t9KbdIMK70zF5doUSQTPKnINn_MaOo_f1F_9k,3616
8
+ sdfr-1.4.4.dist-info/METADATA,sha256=_2w8TOMMbZPmHFAhTMZOQ67AsYJEk7hCQioGlhVOItk,370
9
+ sdfr-1.4.4.dist-info/WHEEL,sha256=M0M8yQSkdzjr-Re7BLxGdurZIJei1aSjIm-hgxnt5-w,103
10
+ sdfr-1.4.4.dist-info/licenses/LICENSE,sha256=gpLeavs1KxgJFrpL_uVDh0MoDvPfJoZ89A5dSCl4P5U,1652
11
+ sdfr-1.4.4.dist-info/licenses/LICENSE_README.txt,sha256=KlBSoHArwoXbiygx3IJTjtgM7hLNO9o8ZMlZV77nrXs,235
12
+ sdfr-1.4.4.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- sdfr/__init__.py,sha256=OxcJAJ0ADoE54vgqMQqxhoFWyU2ldb3fb-_LFyeZZfQ,1209
2
- sdfr/_commit_info.py,sha256=m_JZRhDwnK9FYuMipiiKsSYgntEAJH7hyVCQZetAD-c,112
3
- sdfr/loadlib.py,sha256=xxp5MX-u7ZHIc12mcvN-y8L5UEjY-aEgINj2r-1swWk,2358
4
- sdfr/SDF.py,sha256=bt4DOuOTmbc_lvtTBz7khVtbaFStiO6RKN2FAq3DjrI,31144
5
- sdfr/sdf_helper.py,sha256=cI6F9531e7hbp6oe_hnjPi9pdl6QddsTbohqlNdyg6c,63755
6
- sdfr/sdfc_shared.dll,sha256=7_kZczqfoCb2RLimVkO31xgl_wWOXoZmdrQ2Rlzf5oo,121344
7
- sdfr/sdfc_shared.lib,sha256=S1N_78t9KbdIMK70zF5doUSQTPKnINn_MaOo_f1F_9k,3616
8
- sdfr-1.4.3.dist-info/METADATA,sha256=GTu3uSmFPTzK-K8j6cSPzDZHP7XzslpP6v1KnVi6cZU,370
9
- sdfr-1.4.3.dist-info/WHEEL,sha256=M0M8yQSkdzjr-Re7BLxGdurZIJei1aSjIm-hgxnt5-w,103
10
- sdfr-1.4.3.dist-info/licenses/LICENSE,sha256=gpLeavs1KxgJFrpL_uVDh0MoDvPfJoZ89A5dSCl4P5U,1652
11
- sdfr-1.4.3.dist-info/licenses/LICENSE_README.txt,sha256=KlBSoHArwoXbiygx3IJTjtgM7hLNO9o8ZMlZV77nrXs,235
12
- sdfr-1.4.3.dist-info/RECORD,,
File without changes