h5yaml 0.1.0__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.0.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.0.dist-info/RECORD +0 -10
- h5yaml-0.1.0.dist-info/licenses/LICENSE +0 -29
- {h5yaml-0.1.0.dist-info → h5yaml-0.2.0.dist-info}/WHEEL +0 -0
h5yaml/yaml_h5.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
|
"""Create HDF5/netCDF4 formatted file from a YAML configuration file using h5py."""
|
|
11
22
|
|
|
@@ -14,52 +25,14 @@ from __future__ import annotations
|
|
|
14
25
|
__all__ = ["H5Yaml"]
|
|
15
26
|
|
|
16
27
|
import logging
|
|
17
|
-
from importlib.resources import files
|
|
18
28
|
from pathlib import Path
|
|
19
29
|
|
|
20
30
|
import h5py
|
|
21
31
|
import numpy as np
|
|
22
32
|
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# - helper function ------------------------------------
|
|
28
|
-
def adjust_attr(attr_key: str, attr_val: np.ndarray, attr_dtype: str) -> np.ndarray:
|
|
29
|
-
"""..."""
|
|
30
|
-
if attr_key in ("valid_min", "valid_max", "valid_range"):
|
|
31
|
-
match attr_dtype:
|
|
32
|
-
case "i1":
|
|
33
|
-
res = np.int8(attr_val)
|
|
34
|
-
case "i2":
|
|
35
|
-
res = np.int16(attr_val)
|
|
36
|
-
case "i4":
|
|
37
|
-
res = np.int32(attr_val)
|
|
38
|
-
case "i8":
|
|
39
|
-
res = np.int64(attr_val)
|
|
40
|
-
case "u1":
|
|
41
|
-
res = np.uint8(attr_val)
|
|
42
|
-
case "u2":
|
|
43
|
-
res = np.uint16(attr_val)
|
|
44
|
-
case "u4":
|
|
45
|
-
res = np.uint32(attr_val)
|
|
46
|
-
case "u8":
|
|
47
|
-
res = np.uint64(attr_val)
|
|
48
|
-
case "f2":
|
|
49
|
-
res = np.float16(attr_val)
|
|
50
|
-
case "f4":
|
|
51
|
-
res = np.float32(attr_val)
|
|
52
|
-
case "f8":
|
|
53
|
-
res = np.float64(attr_val)
|
|
54
|
-
case _:
|
|
55
|
-
res = attr_val
|
|
56
|
-
|
|
57
|
-
return res
|
|
58
|
-
|
|
59
|
-
if attr_key == "flag_values":
|
|
60
|
-
return np.array(attr_val, dtype="u1")
|
|
61
|
-
|
|
62
|
-
return attr_val
|
|
33
|
+
from .conf_from_yaml import conf_from_yaml
|
|
34
|
+
from .lib.adjust_attr import adjust_attr
|
|
35
|
+
from .lib.chunksizes import guess_chunks
|
|
63
36
|
|
|
64
37
|
|
|
65
38
|
# - class definition -----------------------------------
|
|
@@ -103,9 +76,7 @@ class H5Yaml:
|
|
|
103
76
|
dset = fid.create_dataset(
|
|
104
77
|
key,
|
|
105
78
|
shape=(0,),
|
|
106
|
-
dtype=
|
|
107
|
-
h5py.string_dtype() if val["_dtype"] == "str" else val["_dtype"]
|
|
108
|
-
),
|
|
79
|
+
dtype="T" if val["_dtype"] == "str" else val["_dtype"],
|
|
109
80
|
chunks=ds_chunk if isinstance(ds_chunk, tuple) else tuple(ds_chunk),
|
|
110
81
|
maxshape=(None,),
|
|
111
82
|
fillvalue=fillvalue,
|
|
@@ -114,7 +85,7 @@ class H5Yaml:
|
|
|
114
85
|
dset = fid.create_dataset(
|
|
115
86
|
key,
|
|
116
87
|
shape=(val["_size"],),
|
|
117
|
-
dtype=val["_dtype"],
|
|
88
|
+
dtype="T" if val["_dtype"] == "str" else val["_dtype"],
|
|
118
89
|
)
|
|
119
90
|
if "_values" in val:
|
|
120
91
|
dset[:] = val["_values"]
|
|
@@ -128,7 +99,7 @@ class H5Yaml:
|
|
|
128
99
|
)
|
|
129
100
|
for attr, attr_val in val.items():
|
|
130
101
|
if not attr.startswith("_"):
|
|
131
|
-
dset.attrs[attr] = adjust_attr(
|
|
102
|
+
dset.attrs[attr] = adjust_attr(val["_dtype"], attr, attr_val)
|
|
132
103
|
|
|
133
104
|
def __compounds(self: H5Yaml, fid: h5py.File) -> dict[str, str | int | float]:
|
|
134
105
|
"""Add compound datatypes to HDF5 product."""
|
|
@@ -184,7 +155,7 @@ class H5Yaml:
|
|
|
184
155
|
ds_dtype = fid[val["_dtype"]]
|
|
185
156
|
dtype_size = fid[val["_dtype"]].dtype.itemsize
|
|
186
157
|
else:
|
|
187
|
-
ds_dtype = val["_dtype"]
|
|
158
|
+
ds_dtype = "T" if val["_dtype"] == "str" else val["_dtype"]
|
|
188
159
|
dtype_size = np.dtype(val["_dtype"]).itemsize
|
|
189
160
|
|
|
190
161
|
fillvalue = None
|
|
@@ -203,7 +174,7 @@ class H5Yaml:
|
|
|
203
174
|
)
|
|
204
175
|
for attr, attr_val in val.items():
|
|
205
176
|
if not attr.startswith("_"):
|
|
206
|
-
dset.attrs[attr] = adjust_attr(
|
|
177
|
+
dset.attrs[attr] = adjust_attr(val["_dtype"], attr, attr_val)
|
|
207
178
|
continue
|
|
208
179
|
|
|
209
180
|
n_udim = 0
|
|
@@ -217,7 +188,7 @@ class H5Yaml:
|
|
|
217
188
|
|
|
218
189
|
# currently, we can not handle more than one unlimited dimension
|
|
219
190
|
if n_udim > 1:
|
|
220
|
-
raise ValueError("more than one unlimited dimension")
|
|
191
|
+
raise ValueError(f"{key} has more than one unlimited dimension")
|
|
221
192
|
|
|
222
193
|
# obtain chunk-size settings
|
|
223
194
|
ds_chunk = (
|
|
@@ -273,7 +244,7 @@ class H5Yaml:
|
|
|
273
244
|
|
|
274
245
|
for attr, attr_val in val.items():
|
|
275
246
|
if not attr.startswith("_"):
|
|
276
|
-
dset.attrs[attr] = adjust_attr(
|
|
247
|
+
dset.attrs[attr] = adjust_attr(val["_dtype"], attr, attr_val)
|
|
277
248
|
|
|
278
249
|
if compounds is not None and val["_dtype"] in compounds:
|
|
279
250
|
if compounds[val["_dtype"]]["units"]:
|
|
@@ -286,6 +257,15 @@ class H5Yaml:
|
|
|
286
257
|
"""Return definition of the HDF5/netCDF4 product."""
|
|
287
258
|
return self._h5_def
|
|
288
259
|
|
|
260
|
+
def diskless(self: H5Yaml) -> h5py.File:
|
|
261
|
+
"""Create a HDF5/netCDF4 file in memory."""
|
|
262
|
+
fid = h5py.File.in_memory()
|
|
263
|
+
if "groups" in self.h5_def:
|
|
264
|
+
self.__groups(fid)
|
|
265
|
+
self.__dimensions(fid)
|
|
266
|
+
self.__variables(fid, self.__compounds(fid))
|
|
267
|
+
return fid
|
|
268
|
+
|
|
289
269
|
def create(self: H5Yaml, l1a_name: Path | str) -> None:
|
|
290
270
|
"""Create a HDF5/netCDF4 file (overwrite if exist).
|
|
291
271
|
|
|
@@ -303,14 +283,3 @@ class H5Yaml:
|
|
|
303
283
|
self.__variables(fid, self.__compounds(fid))
|
|
304
284
|
except PermissionError as exc:
|
|
305
285
|
raise RuntimeError(f"failed create {l1a_name}") from exc
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
# - test module -------------------------
|
|
309
|
-
def tests() -> None:
|
|
310
|
-
"""..."""
|
|
311
|
-
print("Calling H5Yaml")
|
|
312
|
-
H5Yaml(files("h5yaml.Data") / "h5_testing.yaml").create("test_yaml.h5")
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if __name__ == "__main__":
|
|
316
|
-
tests()
|
h5yaml/yaml_nc.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
|
"""Create HDF5/netCDF4 formatted file from a YAML configuration file using netCDF4."""
|
|
11
22
|
|
|
@@ -14,7 +25,6 @@ from __future__ import annotations
|
|
|
14
25
|
__all__ = ["NcYaml"]
|
|
15
26
|
|
|
16
27
|
import logging
|
|
17
|
-
from importlib.resources import files
|
|
18
28
|
from pathlib import PurePosixPath
|
|
19
29
|
from typing import TYPE_CHECKING
|
|
20
30
|
|
|
@@ -23,8 +33,9 @@ import numpy as np
|
|
|
23
33
|
# pylint: disable=no-name-in-module
|
|
24
34
|
from netCDF4 import Dataset
|
|
25
35
|
|
|
26
|
-
from
|
|
27
|
-
from
|
|
36
|
+
from .conf_from_yaml import conf_from_yaml
|
|
37
|
+
from .lib.adjust_attr import adjust_attr
|
|
38
|
+
from .lib.chunksizes import guess_chunks
|
|
28
39
|
|
|
29
40
|
if TYPE_CHECKING:
|
|
30
41
|
from pathlib import Path
|
|
@@ -34,20 +45,20 @@ if TYPE_CHECKING:
|
|
|
34
45
|
class NcYaml:
|
|
35
46
|
"""Class to create a HDF5/netCDF4 formated file from a YAML configuration file."""
|
|
36
47
|
|
|
37
|
-
def __init__(self: NcYaml,
|
|
48
|
+
def __init__(self: NcYaml, nc_yaml_fl: Path) -> None:
|
|
38
49
|
"""Construct a NcYaml instance."""
|
|
39
50
|
self.logger = logging.getLogger("h5yaml.NcYaml")
|
|
40
51
|
|
|
41
52
|
try:
|
|
42
|
-
self.
|
|
53
|
+
self._nc_def = conf_from_yaml(nc_yaml_fl)
|
|
43
54
|
except RuntimeError as exc:
|
|
44
55
|
raise RuntimeError from exc
|
|
45
56
|
|
|
46
|
-
self.yaml_dir =
|
|
57
|
+
self.yaml_dir = nc_yaml_fl.parent
|
|
47
58
|
|
|
48
59
|
def __groups(self: NcYaml, fid: Dataset) -> None:
|
|
49
60
|
"""Create groups in HDF5 product."""
|
|
50
|
-
for key in self.
|
|
61
|
+
for key in self.nc_def["groups"]:
|
|
51
62
|
pkey = PurePosixPath(key)
|
|
52
63
|
if pkey.is_absolute():
|
|
53
64
|
_ = fid[pkey.parent].createGroup(pkey.name)
|
|
@@ -56,14 +67,14 @@ class NcYaml:
|
|
|
56
67
|
|
|
57
68
|
def __dimensions(self: NcYaml, fid: Dataset) -> None:
|
|
58
69
|
"""Add dimensions to HDF5 product."""
|
|
59
|
-
for key, value in self.
|
|
70
|
+
for key, value in self.nc_def["dimensions"].items():
|
|
60
71
|
pkey = PurePosixPath(key)
|
|
61
72
|
if pkey.is_absolute():
|
|
62
73
|
_ = fid[pkey.parent].createDimension(pkey.name, value["_size"])
|
|
63
74
|
else:
|
|
64
75
|
_ = fid.createDimension(key, value["_size"])
|
|
65
76
|
|
|
66
|
-
if
|
|
77
|
+
if len(value) <= 2:
|
|
67
78
|
continue
|
|
68
79
|
|
|
69
80
|
fillvalue = None
|
|
@@ -88,17 +99,29 @@ class NcYaml:
|
|
|
88
99
|
fill_value=fillvalue,
|
|
89
100
|
contiguous=value["_size"] != 0,
|
|
90
101
|
)
|
|
91
|
-
|
|
102
|
+
if value["_size"] > 0:
|
|
103
|
+
if "_values" in value:
|
|
104
|
+
dset[:] = np.array(value["_values"])
|
|
105
|
+
elif "_range" in value:
|
|
106
|
+
dset[:] = np.arange(*value["_range"], dtype=value["_dtype"])
|
|
107
|
+
|
|
108
|
+
dset.setncatts(
|
|
109
|
+
{
|
|
110
|
+
k: adjust_attr(value["_dtype"], k, v)
|
|
111
|
+
for k, v in value.items()
|
|
112
|
+
if not k.startswith("_")
|
|
113
|
+
}
|
|
114
|
+
)
|
|
92
115
|
|
|
93
116
|
def __compounds(self: NcYaml, fid: Dataset) -> dict[str, str | int | float]:
|
|
94
117
|
"""Add compound datatypes to HDF5 product."""
|
|
95
|
-
if "compounds" not in self.
|
|
118
|
+
if "compounds" not in self.nc_def:
|
|
96
119
|
return {}
|
|
97
120
|
|
|
98
121
|
compounds = {}
|
|
99
|
-
if isinstance(self.
|
|
100
|
-
file_list = self.
|
|
101
|
-
self.
|
|
122
|
+
if isinstance(self.nc_def["compounds"], list):
|
|
123
|
+
file_list = self.nc_def["compounds"].copy()
|
|
124
|
+
self.nc_def["compounds"] = {}
|
|
102
125
|
for name in file_list:
|
|
103
126
|
if not (yaml_fl := self.yaml_dir / name).is_file():
|
|
104
127
|
continue
|
|
@@ -107,9 +130,9 @@ class NcYaml:
|
|
|
107
130
|
except RuntimeError as exc:
|
|
108
131
|
raise RuntimeError from exc
|
|
109
132
|
for key, value in res.items():
|
|
110
|
-
self.
|
|
133
|
+
self.nc_def["compounds"][key] = value
|
|
111
134
|
|
|
112
|
-
for key, value in self.
|
|
135
|
+
for key, value in self.nc_def["compounds"].items():
|
|
113
136
|
compounds[key] = {
|
|
114
137
|
"dtype": [],
|
|
115
138
|
"units": [],
|
|
@@ -142,7 +165,11 @@ class NcYaml:
|
|
|
142
165
|
Definition of the compound(s) in the product
|
|
143
166
|
|
|
144
167
|
"""
|
|
145
|
-
for key, val in self.
|
|
168
|
+
for key, val in self.nc_def["variables"].items():
|
|
169
|
+
pkey = PurePosixPath(key)
|
|
170
|
+
var_grp = fid[pkey.parent] if pkey.is_absolute() else fid
|
|
171
|
+
var_name = pkey.name if pkey.is_absolute() else key
|
|
172
|
+
|
|
146
173
|
if val["_dtype"] in fid.cmptypes:
|
|
147
174
|
ds_dtype = fid.cmptypes[val["_dtype"]].dtype
|
|
148
175
|
sz_dtype = ds_dtype.itemsize
|
|
@@ -156,6 +183,23 @@ class NcYaml:
|
|
|
156
183
|
np.nan if val["_FillValue"] == "NaN" else int(val["_FillValue"])
|
|
157
184
|
)
|
|
158
185
|
|
|
186
|
+
# check for scalar dataset
|
|
187
|
+
if val["_dims"][0] == "scalar":
|
|
188
|
+
dset = var_grp.createVariable(
|
|
189
|
+
var_name,
|
|
190
|
+
val["_dtype"],
|
|
191
|
+
fill_value=fillvalue,
|
|
192
|
+
contiguous=True,
|
|
193
|
+
)
|
|
194
|
+
dset.setncatts(
|
|
195
|
+
{
|
|
196
|
+
k: adjust_attr(val["_dtype"], k, v)
|
|
197
|
+
for k, v in val.items()
|
|
198
|
+
if not k.startswith("_")
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
continue
|
|
202
|
+
|
|
159
203
|
compression = None
|
|
160
204
|
complevel = 0
|
|
161
205
|
# currently only gzip compression is supported
|
|
@@ -187,9 +231,6 @@ class NcYaml:
|
|
|
187
231
|
val["_chunks"] if "_chunks" in val else guess_chunks(ds_shape, sz_dtype)
|
|
188
232
|
)
|
|
189
233
|
|
|
190
|
-
pkey = PurePosixPath(key)
|
|
191
|
-
var_grp = fid[pkey.parent] if pkey.is_absolute() else fid
|
|
192
|
-
var_name = pkey.name if pkey.is_absolute() else key
|
|
193
234
|
if val["_dtype"] in fid.cmptypes:
|
|
194
235
|
val["_dtype"] = fid.cmptypes[val["_dtype"]]
|
|
195
236
|
|
|
@@ -213,7 +254,7 @@ class NcYaml:
|
|
|
213
254
|
|
|
214
255
|
dset = var_grp.createVariable(
|
|
215
256
|
var_name,
|
|
216
|
-
val["_dtype"],
|
|
257
|
+
str if val["_dtype"] == "str" else val["_dtype"],
|
|
217
258
|
dimensions=var_dims,
|
|
218
259
|
fill_value=fillvalue,
|
|
219
260
|
contiguous=False,
|
|
@@ -223,7 +264,13 @@ class NcYaml:
|
|
|
223
264
|
ds_chunk if isinstance(ds_chunk, tuple) else tuple(ds_chunk)
|
|
224
265
|
),
|
|
225
266
|
)
|
|
226
|
-
dset.setncatts(
|
|
267
|
+
dset.setncatts(
|
|
268
|
+
{
|
|
269
|
+
k: adjust_attr(val["_dtype"], k, v)
|
|
270
|
+
for k, v in val.items()
|
|
271
|
+
if not k.startswith("_")
|
|
272
|
+
}
|
|
273
|
+
)
|
|
227
274
|
|
|
228
275
|
if compounds is not None and val["_dtype"] in compounds:
|
|
229
276
|
if compounds[val["_dtype"]]["units"]:
|
|
@@ -232,9 +279,17 @@ class NcYaml:
|
|
|
232
279
|
dset.attrs["long_name"] = compounds[val["_dtype"]]["names"]
|
|
233
280
|
|
|
234
281
|
@property
|
|
235
|
-
def
|
|
282
|
+
def nc_def(self: NcYaml) -> dict:
|
|
236
283
|
"""Return definition of the HDF5/netCDF4 product."""
|
|
237
|
-
return self.
|
|
284
|
+
return self._nc_def
|
|
285
|
+
|
|
286
|
+
def diskless(self: NcYaml) -> Dataset:
|
|
287
|
+
"""Create a HDF5/netCDF4 file in memory."""
|
|
288
|
+
fid = Dataset("diskless_test.nc", "w", diskless=True, persistent=False)
|
|
289
|
+
self.__groups(fid)
|
|
290
|
+
self.__dimensions(fid)
|
|
291
|
+
self.__variables(fid, self.__compounds(fid))
|
|
292
|
+
return fid
|
|
238
293
|
|
|
239
294
|
def create(self: NcYaml, l1a_name: Path | str) -> None:
|
|
240
295
|
"""Create a HDF5/netCDF4 file (overwrite if exist).
|
|
@@ -251,15 +306,4 @@ class NcYaml:
|
|
|
251
306
|
self.__dimensions(fid)
|
|
252
307
|
self.__variables(fid, self.__compounds(fid))
|
|
253
308
|
except PermissionError as exc:
|
|
254
|
-
raise RuntimeError(f"failed create {l1a_name}") from exc
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
# - test module -------------------------
|
|
258
|
-
def tests() -> None:
|
|
259
|
-
"""..."""
|
|
260
|
-
print("Calling NcYaml")
|
|
261
|
-
NcYaml(files("h5yaml.Data") / "nc_testing.yaml").create("test_yaml.nc")
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if __name__ == "__main__":
|
|
265
|
-
tests()
|
|
309
|
+
raise RuntimeError(f"failed to create {l1a_name}") from exc
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: h5yaml
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
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
|
|
7
7
|
Project-URL: Issues, https://github.com/rmvanhees/h5_yaml/issues
|
|
8
8
|
Author-email: Richard van Hees <r.m.van.hees@sron.nl>
|
|
9
|
-
License-Expression:
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Keywords: HDF5,YAML,netCDF4
|
|
11
|
+
Keywords: CF metadata,HDF5,YAML,netCDF4
|
|
12
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -19,12 +19,15 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
-
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
23
22
|
Requires-Python: >=3.10
|
|
24
|
-
Requires-Dist: h5py>=3.
|
|
23
|
+
Requires-Dist: h5py>=3.14
|
|
25
24
|
Requires-Dist: netcdf4>=1.7
|
|
26
|
-
Requires-Dist: numpy>=2.
|
|
25
|
+
Requires-Dist: numpy>=2.0
|
|
27
26
|
Requires-Dist: pyyaml>=6.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=9.0; extra == 'dev'
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest-cov>=7.0; extra == 'test'
|
|
28
31
|
Description-Content-Type: text/markdown
|
|
29
32
|
|
|
30
33
|
# H5YAML
|
|
@@ -183,5 +186,5 @@ The code is developed by R.M. van Hees (SRON)
|
|
|
183
186
|
|
|
184
187
|
## License
|
|
185
188
|
|
|
186
|
-
* Copyright: SRON (https://www.sron.nl).
|
|
187
|
-
* License:
|
|
189
|
+
* Copyright: Richard van Hees (SRON) (https://www.sron.nl).
|
|
190
|
+
* License: Apache-2.0
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
h5yaml/__init__.py,sha256=NdNciPgYnbq-aVM6QqNGNZtdL72rTGLAMrDy0Yw7ckk,751
|
|
2
|
+
h5yaml/conf_from_yaml.py,sha256=-2ar_gUmc5qvD1KlcctnpPY8G5c4TTXOF2tfrgcT9m4,1560
|
|
3
|
+
h5yaml/yaml_h5.py,sha256=jVZAL5Cu6dqgdn25cgVBP3g7yx2wdE-cmCbkaOmQKZ4,10153
|
|
4
|
+
h5yaml/yaml_nc.py,sha256=M6g4ZTPMlPmGZjyn3mLFnoQpmynGwgA0HtlUXSGNvvw,10963
|
|
5
|
+
h5yaml/Data/h5_compound.yaml,sha256=z3dMCJDRAw14boRp0zT74bz_oFi21yu8coUoKOW-d2Q,1131
|
|
6
|
+
h5yaml/Data/h5_testing.yaml,sha256=NhXeXjdblh3bv1hPjCl5DvIhEXo3EpD4mlgaZDElsJc,5626
|
|
7
|
+
h5yaml/Data/h5_unsupported.yaml,sha256=v4HYhiTikFt6UoEUJBnmSse_WeHbmBgqF2e1bCJEfLw,1502
|
|
8
|
+
h5yaml/Data/nc_testing.yaml,sha256=zuXcYrcuCankndt5e4nRPj2-xed97IA9yvfpn89XQgw,5451
|
|
9
|
+
h5yaml/lib/__init__.py,sha256=NdNciPgYnbq-aVM6QqNGNZtdL72rTGLAMrDy0Yw7ckk,751
|
|
10
|
+
h5yaml/lib/adjust_attr.py,sha256=4dHEGwwIa3a3hihyuSX8jCsC08fYcz_9XWA1pBwiwfc,2284
|
|
11
|
+
h5yaml/lib/chunksizes.py,sha256=R1kdaKWF0Hol_maZ0tPDoUyWIH5RatP7d2J1yBA8bkk,1949
|
|
12
|
+
h5yaml-0.2.0.dist-info/METADATA,sha256=IZxpXl9fI3Z7pa1DoRumjxPZXn8N_ykkJEdaUNnFJlw,7280
|
|
13
|
+
h5yaml-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
h5yaml-0.2.0.dist-info/licenses/LICENSE,sha256=rLarIZOYK5jHuUjMnFbgdI_Tb_4_HAAKSOOIhwiWlE4,11356
|
|
15
|
+
h5yaml-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright (c) 2025 - R.M. van Hees (SRON)
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|