h5yaml 0.0.4__tar.gz → 0.0.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: h5yaml
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Use YAML configuration file to generate HDF5/netCDF4 formated files.
5
5
  Project-URL: Homepage, https://github.com/rmvanhees/h5_yaml
6
6
  Project-URL: Source, https://github.com/rmvanhees/h5_yaml
@@ -0,0 +1,103 @@
1
+ # YAML
2
+ #
3
+ # Configuration file to test the implementation of classes H5Yaml and NcYaml
4
+ #
5
+ # This file is part of h5_yaml:
6
+ # https://github.com/rmvanhees/h5_yaml.git
7
+ #
8
+ # Copyright (c) 2025 SRON
9
+ # All Rights Reserved
10
+ #
11
+ # License: BSD-3-Clause
12
+ #
13
+ # Define groups
14
+ groups:
15
+ - group_00
16
+ - group_01
17
+ - group_02
18
+
19
+ # Define dimensions
20
+ # Note dimensions with an attribute 'long_name' will also be generated as variable
21
+ dimensions:
22
+ number_of_images:
23
+ _dtype: u2
24
+ _size: 0
25
+ samples_per_image:
26
+ _dtype: u4
27
+ _size: 203500
28
+ column:
29
+ _dtype: u2
30
+ _size: 640
31
+ row:
32
+ _dtype: u2
33
+ _size: 512
34
+ time:
35
+ _dtype: f8
36
+ _size: 0
37
+ _FillValue: -32767
38
+ long_name: Attitude sample time (seconds of day)
39
+ calendar: proleptic_gregorian
40
+ units: seconds since %Y-%m-%d %H:%M:%S
41
+ valid_min: 0
42
+ valid_max: 92400
43
+
44
+ # Define compound types
45
+ # - compound elements must have a data-type, and can have a unit and long_name
46
+ compounds:
47
+ stats_dtype:
48
+ time: [u8, seconds since 1970-01-01T00:00:00, timestamp]
49
+ index: [u2, '1', index]
50
+ tbl_id: [u1, '1', binning id]
51
+ saa: [u1, '1', saa-flag]
52
+ coad: [u1, '1', co-addings]
53
+ texp: [f4, ms, exposure time]
54
+ lat: [f4, degree, latitude]
55
+ lon: [f4, degree, longitude]
56
+ avg: [f4, '1', '$S - S_{ref}$']
57
+ unc: [f4, '1', '\u03c3($S - S_{ref}$)']
58
+ dark_offs: [f4, '1', dark-offset]
59
+
60
+ geo_dtype:
61
+ lat: [f4, latitude]
62
+ lon: [f4, longitude]
63
+
64
+ # Define variables
65
+ variables:
66
+ /group_00/detector_images:
67
+ _dtype: u2
68
+ _dims: [number_of_images, column, row]
69
+ _FillValue: 65535
70
+ long_name: Detector pixel values
71
+ comment: unbinned full-frame data
72
+ units: '1'
73
+ valid_min: 0
74
+ valid_max: 65534
75
+ /group_01/detector_images:
76
+ _dtype: u2
77
+ _dims: [number_of_images, samples_per_image]
78
+ _FillValue: 65535
79
+ _compression: 1
80
+ long_name: Detector pixel values
81
+ comment: variable binned data (filled to the largest samples_per_image)
82
+ units: '1'
83
+ valid_min: 0
84
+ valid_max: 65534
85
+ /group_01/stats:
86
+ _dtype: stats_dtype
87
+ _dims: [time]
88
+ comment: detector map statistics
89
+ /group_02/detector_images:
90
+ _dtype: u2
91
+ _dims: [number_of_images]
92
+ _vlen: True
93
+ _FillValue: 65535
94
+ long_name: Detector pixel values
95
+ comment: variable binned (vlen) data
96
+ units: '1'
97
+ valid_min: 0
98
+ valid_max: 65534
99
+ /group_02/stats:
100
+ _dtype: stats_dtype
101
+ _vlen: True
102
+ _dims: [time]
103
+ comment: detector map statistics (vlen)
@@ -57,10 +57,6 @@ compounds:
57
57
  unc: [f4, '1', '\u03c3($S - S_{ref}$)']
58
58
  dark_offs: [f4, '1', dark-offset]
59
59
 
60
- geo_dtype:
61
- lat: [f4, latitude]
62
- lon: [f4, longitude]
63
-
64
60
  # Define variables
65
61
  variables:
66
62
  /group_00/detector_images:
@@ -84,7 +80,6 @@ variables:
84
80
  valid_max: 65534
85
81
  /group_01/stats:
86
82
  _dtype: stats_dtype
87
- _vlen: True
88
83
  _dims: [time]
89
84
  comment: detector map statistics
90
85
  /group_02/detector_images:
@@ -236,7 +236,14 @@ class H5Yaml:
236
236
  shuffle = True
237
237
 
238
238
  if val.get("_vlen"):
239
- ds_dtype = h5py.vlen_dtype(ds_dtype)
239
+ ds_name = (
240
+ val["_dtype"].split("_")[0]
241
+ if "_" in val["_dtype"]
242
+ else val["_dtype"]
243
+ ) + "_vlen"
244
+ if ds_name not in fid:
245
+ fid[ds_name] = h5py.vlen_dtype(ds_dtype)
246
+ ds_dtype = fid[ds_name]
240
247
  fillvalue = None
241
248
  if ds_maxshape == (None,):
242
249
  ds_chunk = (16,)
@@ -258,7 +258,7 @@ class NcYaml:
258
258
  def tests() -> None:
259
259
  """..."""
260
260
  print("Calling NcYaml")
261
- NcYaml(files("h5yaml.Data") / "h5_testing.yaml").create("test_yaml.nc")
261
+ NcYaml(files("h5yaml.Data") / "nc_testing.yaml").create("test_yaml.nc")
262
262
 
263
263
 
264
264
  if __name__ == "__main__":
File without changes
File without changes
File without changes
File without changes
File without changes