h5yaml 0.1.1__py3-none-any.whl → 0.2.0__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.
- h5yaml/Data/h5_compound.yaml +36 -0
- h5yaml/Data/h5_testing.yaml +131 -6
- h5yaml/Data/h5_unsupported.yaml +56 -0
- h5yaml/Data/nc_testing.yaml +131 -6
- h5yaml/__init__.py +21 -0
- h5yaml/conf_from_yaml.py +22 -11
- h5yaml/lib/__init__.py +21 -0
- h5yaml/lib/adjust_attr.py +79 -0
- h5yaml/lib/chunksizes.py +16 -5
- h5yaml/yaml_h5.py +35 -66
- h5yaml/yaml_nc.py +85 -41
- {h5yaml-0.1.1.dist-info → h5yaml-0.2.0.dist-info}/METADATA +11 -8
- h5yaml-0.2.0.dist-info/RECORD +15 -0
- h5yaml-0.2.0.dist-info/licenses/LICENSE +201 -0
- h5yaml-0.1.1.dist-info/RECORD +0 -10
- h5yaml-0.1.1.dist-info/licenses/LICENSE +0 -29
- {h5yaml-0.1.1.dist-info → h5yaml-0.2.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# YAML
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Python package: `h5yaml`
|
|
4
|
+
#
|
|
5
|
+
# https://github.com/rmvanhees/pyxarr.git
|
|
6
|
+
#
|
|
7
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
8
|
+
# All rights reserved.
|
|
9
|
+
#
|
|
10
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
# you may not use this file except in compliance with the License.
|
|
12
|
+
# You may obtain a copy of the License at
|
|
13
|
+
#
|
|
14
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
#
|
|
16
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
# See the License for the specific language governing permissions and
|
|
20
|
+
# limitations under the License.
|
|
21
|
+
#
|
|
22
|
+
stats_dtype:
|
|
23
|
+
time:
|
|
24
|
+
- u8
|
|
25
|
+
- seconds since 1970-01-01T00:00:00
|
|
26
|
+
- timestamp
|
|
27
|
+
index: [u2, '1', index]
|
|
28
|
+
tbl_id: [u1, '1', binning id]
|
|
29
|
+
saa: [u1, '1', saa-flag]
|
|
30
|
+
coad: [u1, '1', co-addings]
|
|
31
|
+
texp: [f4, ms, exposure time]
|
|
32
|
+
lat: [f4, degree, latitude]
|
|
33
|
+
lon: [f4, degree, longitude]
|
|
34
|
+
avg: [f4, '1', '$S - S_{ref}$']
|
|
35
|
+
unc: [f4, '1', '\u03c3($S - S_{ref}$)']
|
|
36
|
+
dark_offs: [f4, '1', dark-offset]
|
h5yaml/Data/h5_testing.yaml
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
# YAML
|
|
2
2
|
#
|
|
3
|
-
#
|
|
3
|
+
# This file is part of Python package: `h5yaml`
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
# https://github.com/rmvanhees/h5_yaml.git
|
|
5
|
+
# https://github.com/rmvanhees/pyxarr.git
|
|
7
6
|
#
|
|
8
|
-
# Copyright (c) 2025 SRON
|
|
9
|
-
# All
|
|
7
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
8
|
+
# All rights reserved.
|
|
10
9
|
#
|
|
11
|
-
# License
|
|
10
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
# you may not use this file except in compliance with the License.
|
|
12
|
+
# You may obtain a copy of the License at
|
|
13
|
+
#
|
|
14
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
#
|
|
16
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
# See the License for the specific language governing permissions and
|
|
20
|
+
# limitations under the License.
|
|
12
21
|
#
|
|
13
22
|
# Define groups
|
|
14
23
|
groups:
|
|
15
24
|
- group_00
|
|
16
25
|
- group_01
|
|
17
26
|
- group_02
|
|
27
|
+
- group_03
|
|
18
28
|
|
|
19
29
|
# Define dimensions
|
|
20
30
|
# Note dimensions with an attribute 'long_name' will also be generated as variable
|
|
@@ -28,9 +38,14 @@ dimensions:
|
|
|
28
38
|
column:
|
|
29
39
|
_dtype: u2
|
|
30
40
|
_size: 640
|
|
41
|
+
_range: [0, 640, 1]
|
|
31
42
|
row:
|
|
32
43
|
_dtype: u2
|
|
33
44
|
_size: 512
|
|
45
|
+
/group_03/viewport:
|
|
46
|
+
_dtype: str
|
|
47
|
+
_size: 5
|
|
48
|
+
_values: ['-50', '-20', '+0', '+20', '+50']
|
|
34
49
|
time:
|
|
35
50
|
_dtype: f8
|
|
36
51
|
_size: 0
|
|
@@ -66,6 +81,7 @@ compounds:
|
|
|
66
81
|
|
|
67
82
|
# Define variables
|
|
68
83
|
variables:
|
|
84
|
+
# ---------- GROUP 00 ----------
|
|
69
85
|
/group_00/detector_images:
|
|
70
86
|
_dtype: u2
|
|
71
87
|
_dims: [number_of_images, column, row]
|
|
@@ -75,6 +91,7 @@ variables:
|
|
|
75
91
|
units: '1'
|
|
76
92
|
valid_min: 0
|
|
77
93
|
valid_max: 65534
|
|
94
|
+
# ---------- GROUP 01 ----------
|
|
78
95
|
/group_01/detector_images:
|
|
79
96
|
_dtype: u2
|
|
80
97
|
_dims: [number_of_images, samples_per_image]
|
|
@@ -85,10 +102,21 @@ variables:
|
|
|
85
102
|
units: '1'
|
|
86
103
|
valid_min: 0
|
|
87
104
|
valid_max: 65534
|
|
105
|
+
/group_01/contiguous_image:
|
|
106
|
+
_dtype: u2
|
|
107
|
+
_dims: [row, column]
|
|
108
|
+
_chunks: "contiguous"
|
|
109
|
+
_FillValue: 65535
|
|
110
|
+
long_name: Detector pixel values
|
|
111
|
+
comment: contiguous dataset
|
|
112
|
+
units: '1'
|
|
113
|
+
valid_min: 0
|
|
114
|
+
valid_max: 65534
|
|
88
115
|
/group_01/stats:
|
|
89
116
|
_dtype: stats_dtype
|
|
90
117
|
_dims: [time]
|
|
91
118
|
comment: detector map statistics
|
|
119
|
+
# ---------- GROUP 02 ----------
|
|
92
120
|
/group_02/detector_images:
|
|
93
121
|
_dtype: u2
|
|
94
122
|
_dims: [number_of_images]
|
|
@@ -104,3 +132,100 @@ variables:
|
|
|
104
132
|
_vlen: True
|
|
105
133
|
_dims: [time]
|
|
106
134
|
comment: detector map statistics (vlen)
|
|
135
|
+
# ---------- GROUP 03 ----------
|
|
136
|
+
/group_03/ds_01:
|
|
137
|
+
_dtype: u1
|
|
138
|
+
_dims: [number_of_images]
|
|
139
|
+
long_name: unsigned byte dataset
|
|
140
|
+
units: '1'
|
|
141
|
+
valid_min: 0
|
|
142
|
+
valid_max: 255
|
|
143
|
+
flag_values: [1, 2, 4, 8, 16]
|
|
144
|
+
/group_03/ds_02:
|
|
145
|
+
_dtype: i1
|
|
146
|
+
_dims: [number_of_images]
|
|
147
|
+
long_name: signed byte dataset
|
|
148
|
+
units: '1'
|
|
149
|
+
valid_min: -128
|
|
150
|
+
valid_max: 127
|
|
151
|
+
/group_03/ds_03:
|
|
152
|
+
_dtype: u2
|
|
153
|
+
_dims: [number_of_images]
|
|
154
|
+
long_name: unsigned short dataset
|
|
155
|
+
units: '1'
|
|
156
|
+
valid_min: 0
|
|
157
|
+
valid_max: 1024
|
|
158
|
+
/group_03/ds_04:
|
|
159
|
+
_dtype: i2
|
|
160
|
+
_dims: [number_of_images]
|
|
161
|
+
long_name: signed short dataset
|
|
162
|
+
units: '1'
|
|
163
|
+
valid_min: -1024
|
|
164
|
+
valid_max: 1024
|
|
165
|
+
/group_03/ds_05:
|
|
166
|
+
_dtype: u4
|
|
167
|
+
_dims: [number_of_images]
|
|
168
|
+
long_name: unsigned int dataset
|
|
169
|
+
units: '1'
|
|
170
|
+
valid_min: 0
|
|
171
|
+
valid_max: 1000000
|
|
172
|
+
/group_03/ds_06:
|
|
173
|
+
_dtype: i4
|
|
174
|
+
_dims: [number_of_images]
|
|
175
|
+
long_name: signed int dataset
|
|
176
|
+
units: '1'
|
|
177
|
+
valid_min: -1000000
|
|
178
|
+
valid_max: 1000000
|
|
179
|
+
/group_03/ds_07:
|
|
180
|
+
_dtype: u8
|
|
181
|
+
_dims: [number_of_images]
|
|
182
|
+
long_name: unsigned long dataset
|
|
183
|
+
units: '1'
|
|
184
|
+
valid_min: 0
|
|
185
|
+
valid_max: 999999
|
|
186
|
+
/group_03/ds_08:
|
|
187
|
+
_dtype: i8
|
|
188
|
+
_dims: [number_of_images]
|
|
189
|
+
long_name: signed long dataset
|
|
190
|
+
units: '1'
|
|
191
|
+
valid_min: -999999
|
|
192
|
+
valid_max: 999999
|
|
193
|
+
/group_03/ds_09:
|
|
194
|
+
_dtype: f2
|
|
195
|
+
_dims: [number_of_images]
|
|
196
|
+
long_name: half float dataset
|
|
197
|
+
units: '1'
|
|
198
|
+
valid_min: -999.9
|
|
199
|
+
valid_max: 999.9
|
|
200
|
+
/group_03/ds_10:
|
|
201
|
+
_dtype: f4
|
|
202
|
+
_dims: [number_of_images]
|
|
203
|
+
long_name: float dataset
|
|
204
|
+
units: '1'
|
|
205
|
+
valid_min: -999.9
|
|
206
|
+
valid_max: 999.9
|
|
207
|
+
/group_03/ds_11:
|
|
208
|
+
_dtype: f8
|
|
209
|
+
_dims: [number_of_images]
|
|
210
|
+
long_name: double dataset
|
|
211
|
+
units: '1'
|
|
212
|
+
valid_min: -999999.9
|
|
213
|
+
valid_max: 999999.9
|
|
214
|
+
/group_03/ds_12:
|
|
215
|
+
_dtype: complex64
|
|
216
|
+
_dims: [number_of_images]
|
|
217
|
+
long_name: complex64 dataset
|
|
218
|
+
valid_min: 0j
|
|
219
|
+
valid_max: 999999.9j
|
|
220
|
+
/group_03/ds_13:
|
|
221
|
+
_dtype: str
|
|
222
|
+
_dims: [number_of_images]
|
|
223
|
+
long_name: string dataset
|
|
224
|
+
/group_03/ds_14:
|
|
225
|
+
_dtype: str
|
|
226
|
+
_dims: [scalar]
|
|
227
|
+
long_name: scalar(str)
|
|
228
|
+
/group_03/ds_15:
|
|
229
|
+
_dtype: int
|
|
230
|
+
_dims: [scalar]
|
|
231
|
+
long_name: scalar(int)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# YAML
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Python package: `h5yaml`
|
|
4
|
+
#
|
|
5
|
+
# https://github.com/rmvanhees/pyxarr.git
|
|
6
|
+
#
|
|
7
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
8
|
+
# All rights reserved.
|
|
9
|
+
#
|
|
10
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
# you may not use this file except in compliance with the License.
|
|
12
|
+
# You may obtain a copy of the License at
|
|
13
|
+
#
|
|
14
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
#
|
|
16
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
# See the License for the specific language governing permissions and
|
|
20
|
+
# limitations under the License.
|
|
21
|
+
#
|
|
22
|
+
# Define dimensions
|
|
23
|
+
# Note dimensions with an attribute 'long_name' will also be generated as variable
|
|
24
|
+
# Define groups
|
|
25
|
+
groups:
|
|
26
|
+
- group_00
|
|
27
|
+
|
|
28
|
+
dimensions:
|
|
29
|
+
number_of_images:
|
|
30
|
+
_dtype: u2
|
|
31
|
+
_size: 0
|
|
32
|
+
time:
|
|
33
|
+
_dtype: f8
|
|
34
|
+
_size: 0
|
|
35
|
+
_FillValue: -32767
|
|
36
|
+
long_name: Attitude sample time (seconds of day)
|
|
37
|
+
calendar: proleptic_gregorian
|
|
38
|
+
units: seconds since %Y-%m-%d %H:%M:%S
|
|
39
|
+
valid_min: 0
|
|
40
|
+
valid_max: 92400
|
|
41
|
+
|
|
42
|
+
# Define compound types
|
|
43
|
+
# - compound elements must have a data-type, and can have a unit and long_name
|
|
44
|
+
compounds:
|
|
45
|
+
- h5_compound.yaml
|
|
46
|
+
- h5_nocompound.yaml
|
|
47
|
+
|
|
48
|
+
# Define variables
|
|
49
|
+
variables:
|
|
50
|
+
ds_01:
|
|
51
|
+
_dtype: f8
|
|
52
|
+
_dims: [time, number_of_images]
|
|
53
|
+
long_name: double dataset
|
|
54
|
+
units: '1'
|
|
55
|
+
valid_min: -999999.9
|
|
56
|
+
valid_max: 999999.9
|
h5yaml/Data/nc_testing.yaml
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
# YAML
|
|
2
2
|
#
|
|
3
|
-
#
|
|
3
|
+
# This file is part of Python package: `h5yaml`
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
# https://github.com/rmvanhees/h5_yaml.git
|
|
5
|
+
# https://github.com/rmvanhees/pyxarr.git
|
|
7
6
|
#
|
|
8
|
-
# Copyright (c) 2025 SRON
|
|
9
|
-
# All
|
|
7
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
8
|
+
# All rights reserved.
|
|
10
9
|
#
|
|
11
|
-
# License
|
|
10
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
# you may not use this file except in compliance with the License.
|
|
12
|
+
# You may obtain a copy of the License at
|
|
13
|
+
#
|
|
14
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
#
|
|
16
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
# See the License for the specific language governing permissions and
|
|
20
|
+
# limitations under the License.
|
|
12
21
|
#
|
|
13
22
|
# Define groups
|
|
14
23
|
groups:
|
|
15
24
|
- group_00
|
|
16
25
|
- group_01
|
|
17
26
|
- group_02
|
|
27
|
+
- group_03
|
|
18
28
|
|
|
19
29
|
# Define dimensions
|
|
20
30
|
# Note dimensions with an attribute 'long_name' will also be generated as variable
|
|
@@ -28,9 +38,14 @@ dimensions:
|
|
|
28
38
|
column:
|
|
29
39
|
_dtype: u2
|
|
30
40
|
_size: 640
|
|
41
|
+
_range: [0, 640, 1]
|
|
31
42
|
row:
|
|
32
43
|
_dtype: u2
|
|
33
44
|
_size: 512
|
|
45
|
+
/group_03/viewport:
|
|
46
|
+
_dtype: str
|
|
47
|
+
_size: 5
|
|
48
|
+
_values: ['-50', '-20', '+0', '+20', '+50']
|
|
34
49
|
time:
|
|
35
50
|
_dtype: f8
|
|
36
51
|
_size: 0
|
|
@@ -62,6 +77,7 @@ compounds:
|
|
|
62
77
|
|
|
63
78
|
# Define variables
|
|
64
79
|
variables:
|
|
80
|
+
# ---------- GROUP 00 ----------
|
|
65
81
|
/group_00/detector_images:
|
|
66
82
|
_dtype: u2
|
|
67
83
|
_dims: [number_of_images, column, row]
|
|
@@ -71,6 +87,7 @@ variables:
|
|
|
71
87
|
units: '1'
|
|
72
88
|
valid_min: 0
|
|
73
89
|
valid_max: 65534
|
|
90
|
+
# ---------- GROUP 01 ----------
|
|
74
91
|
/group_01/detector_images:
|
|
75
92
|
_dtype: u2
|
|
76
93
|
_dims: [number_of_images, samples_per_image]
|
|
@@ -81,10 +98,21 @@ variables:
|
|
|
81
98
|
units: '1'
|
|
82
99
|
valid_min: 0
|
|
83
100
|
valid_max: 65534
|
|
101
|
+
/group_01/contiguous_image:
|
|
102
|
+
_dtype: u2
|
|
103
|
+
_dims: [row, column]
|
|
104
|
+
_chunks: "contiguous"
|
|
105
|
+
_FillValue: 65535
|
|
106
|
+
long_name: Detector pixel values
|
|
107
|
+
comment: contiguous dataset
|
|
108
|
+
units: '1'
|
|
109
|
+
valid_min: 0
|
|
110
|
+
valid_max: 65534
|
|
84
111
|
/group_01/stats:
|
|
85
112
|
_dtype: stats_dtype
|
|
86
113
|
_dims: [time]
|
|
87
114
|
comment: detector map statistics
|
|
115
|
+
# ---------- GROUP 02 ----------
|
|
88
116
|
/group_02/detector_images:
|
|
89
117
|
_dtype: u2
|
|
90
118
|
_dims: [number_of_images]
|
|
@@ -95,3 +123,100 @@ variables:
|
|
|
95
123
|
units: '1'
|
|
96
124
|
valid_min: 0
|
|
97
125
|
valid_max: 65534
|
|
126
|
+
# ---------- GROUP 03 ----------
|
|
127
|
+
/group_03/ds_01:
|
|
128
|
+
_dtype: u1
|
|
129
|
+
_dims: [number_of_images]
|
|
130
|
+
long_name: unsigned byte dataset
|
|
131
|
+
units: '1'
|
|
132
|
+
valid_min: 0
|
|
133
|
+
valid_max: 255
|
|
134
|
+
flag_values: [1, 2, 4, 8, 16]
|
|
135
|
+
/group_03/ds_02:
|
|
136
|
+
_dtype: i1
|
|
137
|
+
_dims: [number_of_images]
|
|
138
|
+
long_name: signed byte dataset
|
|
139
|
+
units: '1'
|
|
140
|
+
valid_min: -128
|
|
141
|
+
valid_max: 127
|
|
142
|
+
/group_03/ds_03:
|
|
143
|
+
_dtype: u2
|
|
144
|
+
_dims: [number_of_images]
|
|
145
|
+
long_name: unsigned short dataset
|
|
146
|
+
units: '1'
|
|
147
|
+
valid_min: 0
|
|
148
|
+
valid_max: 1024
|
|
149
|
+
/group_03/ds_04:
|
|
150
|
+
_dtype: i2
|
|
151
|
+
_dims: [number_of_images]
|
|
152
|
+
long_name: signed short dataset
|
|
153
|
+
units: '1'
|
|
154
|
+
valid_min: -1024
|
|
155
|
+
valid_max: 1024
|
|
156
|
+
/group_03/ds_05:
|
|
157
|
+
_dtype: u4
|
|
158
|
+
_dims: [number_of_images]
|
|
159
|
+
long_name: unsigned int dataset
|
|
160
|
+
units: '1'
|
|
161
|
+
valid_min: 0
|
|
162
|
+
valid_max: 1000000
|
|
163
|
+
/group_03/ds_06:
|
|
164
|
+
_dtype: i4
|
|
165
|
+
_dims: [number_of_images]
|
|
166
|
+
long_name: signed int dataset
|
|
167
|
+
units: '1'
|
|
168
|
+
valid_min: -1000000
|
|
169
|
+
valid_max: 1000000
|
|
170
|
+
/group_03/ds_07:
|
|
171
|
+
_dtype: u8
|
|
172
|
+
_dims: [number_of_images]
|
|
173
|
+
long_name: unsigned long dataset
|
|
174
|
+
units: '1'
|
|
175
|
+
valid_min: 0
|
|
176
|
+
valid_max: 999999
|
|
177
|
+
/group_03/ds_08:
|
|
178
|
+
_dtype: i8
|
|
179
|
+
_dims: [number_of_images]
|
|
180
|
+
long_name: signed long dataset
|
|
181
|
+
units: '1'
|
|
182
|
+
valid_min: -999999
|
|
183
|
+
valid_max: 999999
|
|
184
|
+
#/group_03/ds_09:
|
|
185
|
+
# _dtype: f2
|
|
186
|
+
# _dims: [number_of_images]
|
|
187
|
+
# long_name: half float dataset
|
|
188
|
+
# units: '1'
|
|
189
|
+
# valid_min: -999.9
|
|
190
|
+
# valid_max: 999.9
|
|
191
|
+
/group_03/ds_10:
|
|
192
|
+
_dtype: f4
|
|
193
|
+
_dims: [number_of_images]
|
|
194
|
+
long_name: float dataset
|
|
195
|
+
units: '1'
|
|
196
|
+
valid_min: -999.9
|
|
197
|
+
valid_max: 999.9
|
|
198
|
+
/group_03/ds_11:
|
|
199
|
+
_dtype: f8
|
|
200
|
+
_dims: [number_of_images]
|
|
201
|
+
long_name: double dataset
|
|
202
|
+
units: '1'
|
|
203
|
+
valid_min: -999999.9
|
|
204
|
+
valid_max: 999999.9
|
|
205
|
+
#/group_03/ds_12:
|
|
206
|
+
# _dtype: complex64
|
|
207
|
+
# _dims: [number_of_images]
|
|
208
|
+
# long_name: complex64 dataset
|
|
209
|
+
# valid_min: 0j
|
|
210
|
+
# valid_max: 999999.9j
|
|
211
|
+
/group_03/ds_13:
|
|
212
|
+
_dtype: str
|
|
213
|
+
_dims: [number_of_images]
|
|
214
|
+
long_name: string dataset
|
|
215
|
+
/group_03/ds_14:
|
|
216
|
+
_dtype: str
|
|
217
|
+
_dims: [scalar]
|
|
218
|
+
long_name: scalar(str)
|
|
219
|
+
/group_03/ds_15:
|
|
220
|
+
_dtype: int
|
|
221
|
+
_dims: [scalar]
|
|
222
|
+
long_name: scalar(int)
|
h5yaml/__init__.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of Python package: `h5yaml`
|
|
3
|
+
#
|
|
4
|
+
# https://github.com/rmvanhees/h5_yaml.git
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
7
|
+
# All rights reserved.
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
#
|
|
21
|
+
"""Necessary but empty file."""
|
h5yaml/conf_from_yaml.py
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
#
|
|
2
|
-
# This file is part of
|
|
3
|
-
# https://github.com/rmvanhees/h5_yaml.git
|
|
2
|
+
# This file is part of Python package: `h5yaml`
|
|
4
3
|
#
|
|
5
|
-
#
|
|
6
|
-
# All Rights Reserved
|
|
4
|
+
# https://github.com/rmvanhees/pyxarr.git
|
|
7
5
|
#
|
|
8
|
-
#
|
|
6
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
7
|
+
# All rights reserved.
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
9
20
|
#
|
|
10
21
|
"""Read settings from a YAML file."""
|
|
11
22
|
|
|
@@ -13,21 +24,18 @@ from __future__ import annotations
|
|
|
13
24
|
|
|
14
25
|
__all__ = ["conf_from_yaml"]
|
|
15
26
|
|
|
16
|
-
from
|
|
27
|
+
from pathlib import Path
|
|
17
28
|
|
|
18
29
|
import yaml
|
|
19
30
|
|
|
20
|
-
if TYPE_CHECKING:
|
|
21
|
-
from pathlib import Path
|
|
22
|
-
|
|
23
31
|
|
|
24
32
|
# - main function -----------------------------------
|
|
25
|
-
def conf_from_yaml(file_path: Path) -> dict:
|
|
33
|
+
def conf_from_yaml(file_path: Path | str) -> dict:
|
|
26
34
|
"""Read settings from a YAML file: `file_path`.
|
|
27
35
|
|
|
28
36
|
Parameters
|
|
29
37
|
----------
|
|
30
|
-
file_path : Path
|
|
38
|
+
file_path : Path | str
|
|
31
39
|
full path of YAML file
|
|
32
40
|
|
|
33
41
|
Returns
|
|
@@ -36,6 +44,9 @@ def conf_from_yaml(file_path: Path) -> dict:
|
|
|
36
44
|
content of the configuration file
|
|
37
45
|
|
|
38
46
|
"""
|
|
47
|
+
if isinstance(file_path, str):
|
|
48
|
+
file_path = Path(str)
|
|
49
|
+
|
|
39
50
|
if not file_path.is_file():
|
|
40
51
|
raise FileNotFoundError(f"{file_path} not found")
|
|
41
52
|
|
h5yaml/lib/__init__.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of Python package: `h5yaml`
|
|
3
|
+
#
|
|
4
|
+
# https://github.com/rmvanhees/h5_yaml.git
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
7
|
+
# All rights reserved.
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
#
|
|
21
|
+
"""Necessary but empty file."""
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of Python package: `h5yaml`
|
|
3
|
+
#
|
|
4
|
+
# https://github.com/rmvanhees/pyxarr.git
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
7
|
+
# All rights reserved.
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
#
|
|
21
|
+
"""Convert values HDF5/netCDF4 attribute."""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
__all__ = ["adjust_attr"]
|
|
26
|
+
|
|
27
|
+
import numpy as np
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# - main function ------------------------------------
|
|
31
|
+
def adjust_attr(dtype: str, attr_key: str, attr_val: np.generic) -> np.generic:
|
|
32
|
+
"""Return attribute converted to the same data type as its variable.
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
dtype : str
|
|
37
|
+
numpy data-type of variable
|
|
38
|
+
attr_key : str
|
|
39
|
+
name of the attribute
|
|
40
|
+
attr_val : np.generic
|
|
41
|
+
original value of the attribute
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
attr_val converted to dtype
|
|
46
|
+
"""
|
|
47
|
+
if attr_key in ("valid_min", "valid_max", "valid_range"):
|
|
48
|
+
match dtype:
|
|
49
|
+
case "i1":
|
|
50
|
+
res = np.int8(attr_val)
|
|
51
|
+
case "i2":
|
|
52
|
+
res = np.int16(attr_val)
|
|
53
|
+
case "i4":
|
|
54
|
+
res = np.int32(attr_val)
|
|
55
|
+
case "i8":
|
|
56
|
+
res = np.int64(attr_val)
|
|
57
|
+
case "u1":
|
|
58
|
+
res = np.uint8(attr_val)
|
|
59
|
+
case "u2":
|
|
60
|
+
res = np.uint16(attr_val)
|
|
61
|
+
case "u4":
|
|
62
|
+
res = np.uint32(attr_val)
|
|
63
|
+
case "u8":
|
|
64
|
+
res = np.uint64(attr_val)
|
|
65
|
+
case "f2":
|
|
66
|
+
res = np.float16(attr_val)
|
|
67
|
+
case "f4":
|
|
68
|
+
res = np.float32(attr_val)
|
|
69
|
+
case "f8":
|
|
70
|
+
res = np.float64(attr_val)
|
|
71
|
+
case _:
|
|
72
|
+
res = attr_val
|
|
73
|
+
|
|
74
|
+
return res
|
|
75
|
+
|
|
76
|
+
if attr_key == "flag_values":
|
|
77
|
+
return np.array(attr_val, dtype="u1")
|
|
78
|
+
|
|
79
|
+
return attr_val
|
h5yaml/lib/chunksizes.py
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
#
|
|
2
|
-
# This file is part of
|
|
3
|
-
# https://github.com/rmvanhees/h5_yaml.git
|
|
2
|
+
# This file is part of Python package: `h5yaml`
|
|
4
3
|
#
|
|
5
|
-
#
|
|
6
|
-
# All Rights Reserved
|
|
4
|
+
# https://github.com/rmvanhees/pyxarr.git
|
|
7
5
|
#
|
|
8
|
-
#
|
|
6
|
+
# Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
7
|
+
# All rights reserved.
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
9
20
|
#
|
|
10
21
|
"""Obtain chunksizes for HDF5 datasets."""
|
|
11
22
|
|