sdfr 1.2.0__py3-none-win_amd64.whl → 1.3.0__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
@@ -20,11 +20,11 @@ import numpy as np
20
20
  from enum import IntEnum
21
21
  from .loadlib import sdf_lib
22
22
 
23
- #try:
23
+ # try:
24
24
  # import xarray as xr
25
25
  #
26
26
  # got_xarray = True
27
- #except ImportError:
27
+ # except ImportError:
28
28
  # print("WARNING: xarray not installed. Generating plain numpy arrays.")
29
29
  # got_xarray = False
30
30
 
@@ -63,12 +63,14 @@ class SdfBlockType(IntEnum):
63
63
  SDF_BLOCKTYPE_DATABLOCK = 28
64
64
  SDF_BLOCKTYPE_NAMEVALUE = 29
65
65
 
66
+
66
67
  class SdfGeometry(IntEnum):
67
68
  SDF_GEOMETRY_NULL = 0
68
69
  SDF_GEOMETRY_CARTESIAN = 1
69
70
  SDF_GEOMETRY_CYLINDRICAL = 2
70
71
  SDF_GEOMETRY_SPHERICAL = 3
71
72
 
73
+
72
74
  class SdfStagger(IntEnum):
73
75
  SDF_STAGGER_CELL_CENTRE = 0
74
76
  SDF_STAGGER_FACE_X = 1
@@ -79,6 +81,7 @@ class SdfStagger(IntEnum):
79
81
  SDF_STAGGER_EDGE_Z = 6
80
82
  SDF_STAGGER_VERTEX = 7
81
83
 
84
+
82
85
  class SdfDataType(IntEnum):
83
86
  SDF_DATATYPE_NULL = 0
84
87
  SDF_DATATYPE_INTEGER4 = 1
@@ -90,22 +93,45 @@ class SdfDataType(IntEnum):
90
93
  SDF_DATATYPE_LOGICAL = 7
91
94
  SDF_DATATYPE_OTHER = 8
92
95
 
93
- _np_datatypes = [0, np.int32, np.int64, np.float32, np.float64, \
94
- np.longdouble, np.byte, np.int32, bool, 0]
95
- _ct_datatypes = [0, ct.c_int32, ct.c_int64, ct.c_float, ct.c_double, \
96
- ct.c_longdouble, ct.c_char, ct.c_bool, 0]
96
+
97
+ _np_datatypes = [
98
+ 0,
99
+ np.int32,
100
+ np.int64,
101
+ np.float32,
102
+ np.float64,
103
+ np.longdouble,
104
+ np.byte,
105
+ np.int32,
106
+ bool,
107
+ 0,
108
+ ]
109
+ _ct_datatypes = [
110
+ 0,
111
+ ct.c_int32,
112
+ ct.c_int64,
113
+ ct.c_float,
114
+ ct.c_double,
115
+ ct.c_longdouble,
116
+ ct.c_char,
117
+ ct.c_bool,
118
+ 0,
119
+ ]
97
120
 
98
121
  # Constants
99
122
  SDF_READ = 1
100
123
  SDF_WRITE = 2
101
124
  SDF_MAXDIMS = 4
102
125
 
126
+
103
127
  class SdfBlock(ct.Structure):
104
128
  pass # Forward declaration for self-referencing structure
105
129
 
130
+
106
131
  class SdfFile(ct.Structure):
107
132
  pass # Forward declaration for function pointer compatibility
108
133
 
134
+
109
135
  SdfBlock._fields_ = [
110
136
  ("extents", ct.POINTER(ct.c_double)),
111
137
  ("dim_mults", ct.POINTER(ct.c_double)),
@@ -198,7 +224,12 @@ SdfBlock._fields_ = [
198
224
  ("prev", ct.POINTER(SdfBlock)),
199
225
  ("subblock", ct.POINTER(SdfBlock)),
200
226
  ("subblock2", ct.POINTER(SdfBlock)),
201
- ("populate_data", ct.CFUNCTYPE(ct.POINTER(SdfBlock), ct.POINTER(SdfFile), ct.POINTER(SdfBlock))),
227
+ (
228
+ "populate_data",
229
+ ct.CFUNCTYPE(
230
+ ct.POINTER(SdfBlock), ct.POINTER(SdfFile), ct.POINTER(SdfBlock)
231
+ ),
232
+ ),
202
233
  ("cpu_split", ct.c_int * SDF_MAXDIMS),
203
234
  ("starts", ct.c_int * SDF_MAXDIMS),
204
235
  ("proc_min", ct.c_int * 3),
@@ -285,9 +316,10 @@ SdfFile._fields_ = [
285
316
  ("fd", ct.c_int),
286
317
  ("purge_duplicated_ids", ct.c_int),
287
318
  ("internal_ghost_cells", ct.c_int),
288
- ("ignore_nblocks", ct.c_int)
319
+ ("ignore_nblocks", ct.c_int),
289
320
  ]
290
321
 
322
+
291
323
  class RunInfo(ct.Structure):
292
324
  _fields_ = [
293
325
  ("defines", ct.c_int64),
@@ -306,6 +338,7 @@ class RunInfo(ct.Structure):
306
338
 
307
339
  class BlockList:
308
340
  """Contains all the blocks"""
341
+
309
342
  def __init__(self, filename, convert=False, derived=True):
310
343
  clib = sdf_lib
311
344
  self._clib = clib
@@ -332,7 +365,6 @@ class BlockList:
332
365
  else:
333
366
  clib.sdf_read_blocklist(h)
334
367
 
335
-
336
368
  block = h.contents.blocklist
337
369
  self.Header = get_header(h.contents)
338
370
  meshes = []
@@ -345,45 +377,64 @@ class BlockList:
345
377
  block._blocklist = self
346
378
  blocktype = block.blocktype
347
379
  newblock = None
380
+ newblock_mid = None
348
381
  name = get_member_name(block.name)
349
382
  if blocktype == SdfBlockType.SDF_BLOCKTYPE_ARRAY:
350
383
  newblock = BlockArray(block)
351
384
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_CONSTANT:
352
385
  newblock = BlockConstant(block)
353
- elif blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS \
354
- or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED:
386
+ elif (
387
+ blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS
388
+ or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED
389
+ ):
355
390
  if block.stagger == 10 or block.stagger == 12:
356
391
  newblock = BlockStitchedPath(block)
357
392
  else:
358
393
  newblock = BlockStitched(block)
359
- elif blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS_MATERIAL \
360
- or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED_MATERIAL:
394
+ elif (
395
+ blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS_MATERIAL
396
+ or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED_MATERIAL
397
+ ):
361
398
  newblock = BlockStitchedMaterial(block)
362
- elif blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS_MATVAR \
363
- or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED_MATVAR:
399
+ elif (
400
+ blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS_MATVAR
401
+ or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED_MATVAR
402
+ ):
364
403
  newblock = BlockStitchedMatvar(block)
365
- elif blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS_SPECIES \
366
- or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED_SPECIES:
404
+ elif (
405
+ blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS_SPECIES
406
+ or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED_SPECIES
407
+ ):
367
408
  newblock = BlockStitchedSpecies(block)
368
- elif blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS_TENSOR \
369
- or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED_TENSOR:
409
+ elif (
410
+ blocktype == SdfBlockType.SDF_BLOCKTYPE_CONTIGUOUS_TENSOR
411
+ or blocktype == SdfBlockType.SDF_BLOCKTYPE_STITCHED_TENSOR
412
+ ):
370
413
  newblock = BlockStitchedTensor(block)
371
414
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_DATABLOCK:
372
415
  newblock = BlockData(block)
373
416
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_LAGRANGIAN_MESH:
374
- newblock = BlockLagrangianMesh(block)
375
- meshes.append(newblock)
417
+ if block.datatype_out != 0:
418
+ newblock = BlockLagrangianMesh(block)
419
+ newblock_mid = block
420
+ meshes.append(newblock)
376
421
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_NAMEVALUE:
377
422
  newblock = BlockNameValue(block)
378
- elif blocktype == SdfBlockType.SDF_BLOCKTYPE_PLAIN_DERIVED \
379
- or blocktype == SdfBlockType.SDF_BLOCKTYPE_PLAIN_VARIABLE:
423
+ elif (
424
+ blocktype == SdfBlockType.SDF_BLOCKTYPE_PLAIN_DERIVED
425
+ or blocktype == SdfBlockType.SDF_BLOCKTYPE_PLAIN_VARIABLE
426
+ ):
380
427
  newblock = BlockPlainVariable(block)
381
428
  mesh_vars.append(newblock)
382
429
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_PLAIN_MESH:
383
- newblock = BlockPlainMesh(block)
384
- meshes.append(newblock)
385
- elif blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_DERIVED \
386
- or blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_VARIABLE:
430
+ if block.datatype_out != 0:
431
+ newblock = BlockPlainMesh(block)
432
+ newblock_mid = block
433
+ meshes.append(newblock)
434
+ elif (
435
+ blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_DERIVED
436
+ or blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_VARIABLE
437
+ ):
387
438
  newblock = BlockPointVariable(block)
388
439
  mesh_vars.append(newblock)
389
440
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_MESH:
@@ -397,10 +448,26 @@ class BlockList:
397
448
  pass
398
449
  if newblock is not None:
399
450
  self.__dict__[name] = newblock
400
- self._block_ids.update({block.id.decode() : newblock})
401
- self._block_names.update({block.name.decode() : newblock})
451
+ self._block_ids.update({block.id.decode(): newblock})
452
+ self._block_names.update({block.name.decode(): newblock})
402
453
  block = block.next
403
454
 
455
+ if newblock_mid is not None:
456
+ block_mid = newblock_mid
457
+ block_mid._handle = h
458
+ block_mid._blocklist = self
459
+ blocktype = block_mid.blocktype
460
+ name = get_member_name(block_mid.name) + "_mid"
461
+ if blocktype == SdfBlockType.SDF_BLOCKTYPE_LAGRANGIAN_MESH:
462
+ newblock = BlockLagrangianMesh(block_mid, mid=True)
463
+ elif blocktype == SdfBlockType.SDF_BLOCKTYPE_PLAIN_MESH:
464
+ newblock = BlockPlainMesh(block_mid, mid=True)
465
+ self.__dict__[name] = newblock
466
+ nm = block_mid.id.decode() + "_mid"
467
+ self._block_ids.update({nm: newblock})
468
+ nm = block_mid.name.decode() + "_mid"
469
+ self._block_names.update({nm: newblock})
470
+
404
471
  for var in mesh_vars:
405
472
  gid = var.grid_id
406
473
  for mesh in meshes:
@@ -430,13 +497,14 @@ class Block:
430
497
  Contains the data and metadata for a single
431
498
  block from an SDF file.
432
499
  """
500
+
433
501
  def __init__(self, block):
434
502
  self._handle = block._handle
435
503
  self._id = block.id.decode()
436
504
  self._name = block.name.decode()
437
505
  self._datatype = _np_datatypes[block.datatype_out]
438
506
  self._data_length = block.data_length
439
- self._dims = tuple(block.dims[:block.ndims])
507
+ self._dims = tuple(block.dims[: block.ndims])
440
508
  self._contents = block
441
509
  self._owndata = True
442
510
  self._blocklist = block._blocklist
@@ -452,8 +520,8 @@ class Block:
452
520
  buffer_from_memory.restype = ct.py_object
453
521
  dtype = self._datatype
454
522
  if dtype == np.byte:
455
- dtype = np.dtype('|S1')
456
- totype = _ct_datatypes[self._contents.datatype]
523
+ dtype = np.dtype("|S1")
524
+ totype = _ct_datatypes[self._contents.datatype_out]
457
525
  cast = ct.cast(data, ct.POINTER(totype))
458
526
  buf = buffer_from_memory(cast, blen)
459
527
  self._owndata = False
@@ -495,12 +563,12 @@ class Block:
495
563
  return self._name
496
564
 
497
565
 
498
-
499
566
  class BlockConstant(Block):
500
567
  """Constant block"""
568
+
501
569
  def __init__(self, block):
502
570
  super().__init__(block)
503
- offset = getattr(SdfBlock, 'const_value').offset
571
+ offset = getattr(SdfBlock, "const_value").offset
504
572
  self._datatype = _np_datatypes[block.datatype]
505
573
  totype = _ct_datatypes[block.datatype]
506
574
  self._data = totype.from_buffer(block, offset).value
@@ -508,6 +576,7 @@ class BlockConstant(Block):
508
576
 
509
577
  class BlockPlainVariable(Block):
510
578
  """Plain variable block"""
579
+
511
580
  @property
512
581
  def data(self):
513
582
  """Block data contents"""
@@ -518,7 +587,7 @@ class BlockPlainVariable(Block):
518
587
  for d in self.dims:
519
588
  blen *= d
520
589
  array = self._numpy_from_buffer(self._contents.data, blen)
521
- self._data = array.reshape(self.dims, order='F')
590
+ self._data = array.reshape(self.dims, order="F")
522
591
  return self._data
523
592
 
524
593
  @property
@@ -549,16 +618,27 @@ class BlockPlainVariable(Block):
549
618
 
550
619
  class BlockPlainMesh(Block):
551
620
  """Plain mesh block"""
552
- def __init__(self, block):
621
+
622
+ def __init__(self, block, mid=False):
553
623
  super().__init__(block)
624
+ self._mid = mid
554
625
  self._data = None
555
- self._units = tuple([block.dim_units[i].decode() for i in range(block.ndims)])
556
- self._labels = tuple([block.dim_labels[i].decode() for i in range(block.ndims)])
626
+ self._units = tuple(
627
+ [block.dim_units[i].decode() for i in range(block.ndims)]
628
+ )
629
+ self._labels = tuple(
630
+ [block.dim_labels[i].decode() for i in range(block.ndims)]
631
+ )
557
632
  self._mult = None
633
+ self._bdims = self._dims
634
+ if mid:
635
+ self._id += "_mid"
636
+ self._name += "_mid"
637
+ self._dims = tuple([i - 1 for i in self._dims])
558
638
  if bool(block.dim_mults):
559
- self._mult = tuple(block.dim_mults[:block.ndims])
639
+ self._mult = tuple(block.dim_mults[: block.ndims])
560
640
  if bool(block.extents):
561
- self._extents = tuple(block.extents[:2*block.ndims])
641
+ self._extents = tuple(block.extents[: 2 * block.ndims])
562
642
 
563
643
  @property
564
644
  def data(self):
@@ -567,9 +647,11 @@ class BlockPlainMesh(Block):
567
647
  clib = self._handle._clib
568
648
  clib.sdf_helper_read_data(self._handle, self._contents)
569
649
  grids = []
570
- for i, d in enumerate(self.dims):
650
+ for i, d in enumerate(self._bdims):
571
651
  blen = np.dtype(self._datatype).itemsize * d
572
652
  array = self._numpy_from_buffer(self._contents.grids[i], blen)
653
+ if self._mid:
654
+ array = 0.5 * (array[1:] + array[:-1])
573
655
  grids.append(array)
574
656
  self._data = tuple(grids)
575
657
  return self._data
@@ -602,6 +684,7 @@ class BlockPlainMesh(Block):
602
684
 
603
685
  class BlockLagrangianMesh(BlockPlainMesh):
604
686
  """Lagrangian mesh block"""
687
+
605
688
  @property
606
689
  def data(self):
607
690
  """Block data contents"""
@@ -609,12 +692,20 @@ class BlockLagrangianMesh(BlockPlainMesh):
609
692
  clib = self._handle._clib
610
693
  clib.sdf_helper_read_data(self._handle, self._contents)
611
694
  blen = np.dtype(self._datatype).itemsize
612
- for d in self.dims:
695
+ for d in self._bdims:
613
696
  blen *= d
614
697
  grids = []
615
- for i, d in enumerate(self.dims):
698
+ for i, d in enumerate(self._bdims):
616
699
  array = self._numpy_from_buffer(self._contents.grids[i], blen)
617
- array = array.reshape(self.dims, order='F')
700
+ array = array.reshape(self._bdims, order="F")
701
+ if self._mid:
702
+ nn = len(self._bdims)
703
+ for j in range(nn):
704
+ s1 = nn * [slice(None)]
705
+ s2 = nn * [slice(None)]
706
+ s1[j] = slice(1, None)
707
+ s2[j] = slice(None, -1)
708
+ array = 0.5 * (array[tuple(s1)] + array[tuple(s2)])
618
709
  grids.append(array)
619
710
  self._data = tuple(grids)
620
711
  return self._data
@@ -622,6 +713,7 @@ class BlockLagrangianMesh(BlockPlainMesh):
622
713
 
623
714
  class BlockPointMesh(BlockPlainMesh):
624
715
  """Point mesh block"""
716
+
625
717
  @property
626
718
  def species_id(self):
627
719
  """Species ID"""
@@ -630,6 +722,7 @@ class BlockPointMesh(BlockPlainMesh):
630
722
 
631
723
  class BlockPointVariable(BlockPlainVariable):
632
724
  """Point variable block"""
725
+
633
726
  @property
634
727
  def species_id(self):
635
728
  """Species ID"""
@@ -638,6 +731,7 @@ class BlockPointVariable(BlockPlainVariable):
638
731
 
639
732
  class BlockNameValue(Block):
640
733
  """Name/value block"""
734
+
641
735
  def __init__(self, block):
642
736
  super().__init__(block)
643
737
  self._dims = (block.ndims,)
@@ -658,6 +752,7 @@ class BlockNameValue(Block):
658
752
 
659
753
  class BlockArray(Block):
660
754
  """Array block"""
755
+
661
756
  @property
662
757
  def data(self):
663
758
  """Block data contents"""
@@ -668,12 +763,13 @@ class BlockArray(Block):
668
763
  for d in self.dims:
669
764
  blen *= d
670
765
  array = self._numpy_from_buffer(self._contents.data, blen)
671
- self._data = array.reshape(self.dims, order='F')
766
+ self._data = array.reshape(self.dims, order="F")
672
767
  return self._data
673
768
 
674
769
 
675
770
  class BlockData(Block):
676
771
  """Data block"""
772
+
677
773
  def __init__(self, block):
678
774
  super().__init__(block)
679
775
  self._checksum = block.checksum.decode()
@@ -709,6 +805,7 @@ class BlockData(Block):
709
805
 
710
806
  class BlockStitched(Block):
711
807
  """Stitched block"""
808
+
712
809
  @property
713
810
  def data(self):
714
811
  """Block data contents"""
@@ -724,73 +821,91 @@ class BlockStitched(Block):
724
821
 
725
822
  class BlockStitchedPath(BlockStitched):
726
823
  """Stitched path block"""
824
+
727
825
  pass
728
826
 
729
827
 
730
828
  class BlockStitchedMaterial(BlockStitched):
731
829
  """Stitched material block"""
830
+
732
831
  pass
733
832
 
734
833
 
735
834
  class BlockStitchedMatvar(BlockStitched):
736
835
  """Stitched material variable block"""
836
+
737
837
  pass
738
838
 
739
839
 
740
840
  class BlockStitchedSpecies(BlockStitched):
741
841
  """Stitched species block"""
842
+
742
843
  pass
743
844
 
744
845
 
745
846
  class BlockStitchedTensor(BlockStitched):
746
847
  """Stitched tensor block"""
848
+
747
849
  pass
748
850
 
749
851
 
750
852
  def get_header(h):
751
853
  d = {}
752
- d['filename'] = h.filename.decode()
753
- d['file_version'] = h.file_version
754
- d['file_revision'] = h.file_revision
755
- d['code_name'] = h.code_name.decode()
756
- d['step'] = h.step
757
- d['time'] = h.time
758
- d['jobid1'] = h.jobid1
759
- d['jobid2'] = h.jobid2
760
- d['code_io_version'] = h.code_io_version
761
- d['restart_flag'] = h.restart_flag
762
- d['other_domains'] = h.other_domains
763
- d['station_file'] = h.station_file
854
+ d["filename"] = h.filename.decode()
855
+ d["file_version"] = h.file_version
856
+ d["file_revision"] = h.file_revision
857
+ d["code_name"] = h.code_name.decode()
858
+ d["step"] = h.step
859
+ d["time"] = h.time
860
+ d["jobid1"] = h.jobid1
861
+ d["jobid2"] = h.jobid2
862
+ d["code_io_version"] = h.code_io_version
863
+ d["restart_flag"] = h.restart_flag
864
+ d["other_domains"] = h.other_domains
865
+ d["station_file"] = h.station_file
764
866
  return d
765
867
 
766
868
 
767
869
  def get_run_info(block):
768
870
  from datetime import datetime
871
+
769
872
  h = ct.cast(block.data, ct.POINTER(RunInfo)).contents
770
873
  d = {}
771
- d['version'] = f"{h.version}.{h.revision}.{h.minor_rev}"
772
- d['commit_id'] = h.commit_id.decode()
773
- d['sha1sum'] = h.sha1sum.decode()
774
- d['compile_machine'] = h.compile_machine.decode()
775
- d['compile_flags'] = h.compile_flags.decode()
776
- d['compile_date'] = datetime.utcfromtimestamp(h.compile_date).strftime('%c')
777
- d['run_date'] = datetime.utcfromtimestamp(h.run_date).strftime('%c')
778
- d['io_data'] = datetime.utcfromtimestamp(h.io_date).strftime('%c')
874
+ d["version"] = f"{h.version}.{h.revision}.{h.minor_rev}"
875
+ d["commit_id"] = h.commit_id.decode()
876
+ d["sha1sum"] = h.sha1sum.decode()
877
+ d["compile_machine"] = h.compile_machine.decode()
878
+ d["compile_flags"] = h.compile_flags.decode()
879
+ d["compile_date"] = datetime.utcfromtimestamp(h.compile_date).strftime("%c")
880
+ d["run_date"] = datetime.utcfromtimestamp(h.run_date).strftime("%c")
881
+ d["io_data"] = datetime.utcfromtimestamp(h.io_date).strftime("%c")
779
882
  return d
780
883
 
781
884
 
782
885
  def get_member_name(name):
783
886
  sname = name.decode()
784
- return ''.join([i if ((i >= "a" and i <= "z") or (i >= "A" and i <= "Z") \
785
- or (i >= "0" and i <= "9")) else "_" \
786
- for i in sname])
787
-
788
- def read(filename, convert=False, mmap=0, dict=False, derived=True):
887
+ return "".join(
888
+ [
889
+ (
890
+ i
891
+ if (
892
+ (i >= "a" and i <= "z")
893
+ or (i >= "A" and i <= "Z")
894
+ or (i >= "0" and i <= "9")
895
+ )
896
+ else "_"
897
+ )
898
+ for i in sname
899
+ ]
900
+ )
901
+
902
+
903
+ def read(file=None, convert=False, mmap=0, dict=False, derived=True):
789
904
  """Reads the SDF data and returns a dictionary of NumPy arrays.
790
905
 
791
906
  Parameters
792
907
  ----------
793
- filename : string
908
+ file : string
794
909
  The name of the SDF file to open.
795
910
  convert : bool, optional
796
911
  Convert double precision data to single when reading file.
@@ -802,10 +917,13 @@ def read(filename, convert=False, mmap=0, dict=False, derived=True):
802
917
 
803
918
  import warnings
804
919
 
920
+ if file == None:
921
+ raise TypeError("Missing file parameter")
922
+
805
923
  if mmap != 0:
806
924
  warnings.warn("mmap flag ignored")
807
925
 
808
- blocklist = BlockList(filename, convert, derived)
926
+ blocklist = BlockList(file, convert, derived)
809
927
 
810
928
  if isinstance(dict, str):
811
929
  if dict == "id" or dict == "ids":
sdfr/_commit_info.py CHANGED
@@ -1,2 +1,2 @@
1
- __commit_date__ = "Thu Mar 6 21:34:01 2025 +0000"
2
- __commit_id__ = "658f397aca1fa9cfcef3a31d2ea4ba9291c4aa96"
1
+ __commit_date__ = "Wed May 7 13:32:07 2025 +0100"
2
+ __commit_id__ = "c22be2665c4bcbc9925fa702205ace2f99585439"
sdfr/sdfc_shared.dll CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sdfr
3
- Version: 1.2.0
3
+ Version: 1.3.0
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,11 @@
1
+ sdfr/__init__.py,sha256=vSTzC03qtlxqcn-7dewmUa59NvhaZ-QqBi1svDCDzIo,1153
2
+ sdfr/_commit_info.py,sha256=TmprDWbFKQKXQpJ-hWS2ELdZ46OBHS0lMKb2QHUqiyo,111
3
+ sdfr/loadlib.py,sha256=EMcnZhh68fS72Bjv8QtfDzPbowx1FfaqX4TPhDl-o94,2328
4
+ sdfr/SDF.py,sha256=D4M4qiaK-rYgYKNOi19cWt07M0Dqb6kYgId0uFZtYo4,29770
5
+ sdfr/sdf_helper.py,sha256=jS4fxmq1y7PeryrPFuB_Lgu5n88-cNggaWMvQy4XqSA,63682
6
+ sdfr/sdfc_shared.dll,sha256=JYkR3mF1Ikr4xFZf7NdUN6WNx7CeTdJZVB8k5cCeXRg,13312
7
+ sdfr-1.3.0.dist-info/METADATA,sha256=qhi1HXCNjSgmcm0qLSwEETcCJnsec_45pXXf_41noyo,370
8
+ sdfr-1.3.0.dist-info/WHEEL,sha256=n3HxvvUxRudexxUBRcXuzD3-t2g3c6dOWZQFWqwqrFk,103
9
+ sdfr-1.3.0.dist-info/licenses/LICENSE,sha256=gpLeavs1KxgJFrpL_uVDh0MoDvPfJoZ89A5dSCl4P5U,1652
10
+ sdfr-1.3.0.dist-info/licenses/LICENSE_README.txt,sha256=KlBSoHArwoXbiygx3IJTjtgM7hLNO9o8ZMlZV77nrXs,235
11
+ sdfr-1.3.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: scikit-build-core 0.11.0
2
+ Generator: scikit-build-core 0.11.2
3
3
  Root-Is-Purelib: false
4
4
  Tag: py3-none-win_amd64
5
5
 
@@ -1,11 +0,0 @@
1
- sdfr/__init__.py,sha256=vSTzC03qtlxqcn-7dewmUa59NvhaZ-QqBi1svDCDzIo,1153
2
- sdfr/_commit_info.py,sha256=lMdNiHt3-u650F4MkvWgSPFaSiRD5pBPkn1VFMpjYQQ,111
3
- sdfr/loadlib.py,sha256=EMcnZhh68fS72Bjv8QtfDzPbowx1FfaqX4TPhDl-o94,2328
4
- sdfr/SDF.py,sha256=ISfOQsaK61ahp-2aCui9RmDw8K3vF7pnIiLwoMjX5uM,27317
5
- sdfr/sdf_helper.py,sha256=jS4fxmq1y7PeryrPFuB_Lgu5n88-cNggaWMvQy4XqSA,63682
6
- sdfr/sdfc_shared.dll,sha256=7iv4hcKikWqeV5JOSmXaMlGrm_TXKbFOopsLfEdDYOQ,13312
7
- sdfr-1.2.0.dist-info/METADATA,sha256=VviDTlVggoJ9MqQy-s5IMRRYMJPpKTuUjp_tpYuRlDo,370
8
- sdfr-1.2.0.dist-info/WHEEL,sha256=QVvQyceONrQFRxko1Jifw1vmo8podRpkc8zfhwmIIMM,103
9
- sdfr-1.2.0.dist-info/licenses/LICENSE,sha256=gpLeavs1KxgJFrpL_uVDh0MoDvPfJoZ89A5dSCl4P5U,1652
10
- sdfr-1.2.0.dist-info/licenses/LICENSE_README.txt,sha256=KlBSoHArwoXbiygx3IJTjtgM7hLNO9o8ZMlZV77nrXs,235
11
- sdfr-1.2.0.dist-info/RECORD,,