h5yaml 0.2.0__tar.gz → 0.3.0__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.
- {h5yaml-0.2.0 → h5yaml-0.3.0}/.coverage +0 -0
- {h5yaml-0.2.0 → h5yaml-0.3.0}/.github/workflows/python-package.yml +2 -1
- {h5yaml-0.2.0 → h5yaml-0.3.0}/PKG-INFO +35 -19
- {h5yaml-0.2.0 → h5yaml-0.3.0}/README.md +34 -18
- {h5yaml-0.2.0 → h5yaml-0.3.0}/coverage.xml +188 -211
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/Data/h5_compound.yaml +16 -15
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/Data/h5_testing.yaml +23 -1
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/Data/h5_unsupported.yaml +0 -6
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/Data/nc_testing.yaml +13 -1
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/conf_from_yaml.py +3 -3
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/yaml_h5.py +99 -80
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/yaml_nc.py +115 -89
- {h5yaml-0.2.0 → h5yaml-0.3.0}/tests/test_from_yaml.py +16 -1
- {h5yaml-0.2.0 → h5yaml-0.3.0}/tests/test_yaml_h5.py +10 -10
- {h5yaml-0.2.0 → h5yaml-0.3.0}/tests/test_yaml_nc.py +16 -12
- h5yaml-0.2.0/klad.h5 +0 -0
- h5yaml-0.2.0/src/h5yaml/lib/chunksizes.py +0 -73
- {h5yaml-0.2.0 → h5yaml-0.3.0}/.gitignore +0 -0
- {h5yaml-0.2.0 → h5yaml-0.3.0}/.pre-commit-config.yaml +0 -0
- {h5yaml-0.2.0 → h5yaml-0.3.0}/LICENSE +0 -0
- {h5yaml-0.2.0 → h5yaml-0.3.0}/MANIFEST.in +0 -0
- {h5yaml-0.2.0 → h5yaml-0.3.0}/pyproject.toml +0 -0
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/__init__.py +0 -0
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/lib/__init__.py +0 -0
- {h5yaml-0.2.0 → h5yaml-0.3.0}/src/h5yaml/lib/adjust_attr.py +0 -0
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: h5yaml
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -61,23 +61,39 @@ However, package `netCDF4` has some limitations, which `h5py` has not, for examp
|
|
|
61
61
|
not allow variable-length variables to have a compound data-type.
|
|
62
62
|
|
|
63
63
|
## Installation
|
|
64
|
-
|
|
64
|
+
The package `h5yaml` is available from PyPI. To install it use `pip`:
|
|
65
|
+
|
|
66
|
+
> $ pip install [--user] h5yaml
|
|
67
|
+
|
|
68
|
+
The module `h5yaml` requires Python3.10+ and Python modules: h5py (v3.14+), netCDF4 (v1.7+) and numpy (v2.0+).
|
|
69
|
+
|
|
70
|
+
**Note**: the packages `h5py` and `netCDF4` come with their own HDF5 libraries. If these are different then they may
|
|
71
|
+
collide and result in a *''HDF5 error''*.
|
|
72
|
+
If this is the case then you have to install the development packages of HDF5 and netCDF4 (or compile them from source).
|
|
73
|
+
And reinstall `h5py` and `netCDF4` using the commands:
|
|
74
|
+
|
|
75
|
+
> $ pip uninstall h5py; pip install --no-binary=h5py h5py
|
|
76
|
+
> $ pip uninstall netCDF4; pip install --no-binary=netCDF4 netCDF4
|
|
65
77
|
|
|
66
78
|
## Usage
|
|
67
79
|
|
|
68
80
|
The YAML file should be structured as follows:
|
|
69
81
|
|
|
70
|
-
* The top level are: 'groups', 'dimensions', 'compounds' and '
|
|
82
|
+
* The top level are: 'groups', 'dimensions', 'compounds', 'variables', 'attrs\_global' and 'attrs\_groups'.
|
|
83
|
+
* > 'attrs\_global' and 'attrs\_groups' are added in version 0.3.0
|
|
84
|
+
* The names of the attributes, groups, dimensions, compounds and viariable should be specified as PosixPaths, however:
|
|
85
|
+
* The names of groups should never start with a slash (always erlative to root);
|
|
86
|
+
* All other elements which are stored in root should also not start with a slash;
|
|
87
|
+
* But these elements require a starting slash (absolute paths) when they are stored not the root.
|
|
71
88
|
* The section 'groups' are optional, but you should provide each group you want to use
|
|
72
89
|
in your file. The 'groups' section in the YAML file may look like this:
|
|
73
|
-
|
|
74
90
|
```
|
|
75
91
|
groups:
|
|
76
92
|
- engineering_data
|
|
77
93
|
- image_attributes
|
|
78
94
|
- navigation_data
|
|
79
|
-
- processing_control
|
|
80
95
|
- science_data
|
|
96
|
+
- processing_control/input_data
|
|
81
97
|
```
|
|
82
98
|
|
|
83
99
|
* The section 'dimensions' is obligatory, you should define the dimensions for each
|
|
@@ -133,14 +149,6 @@ The YAML file should be structured as follows:
|
|
|
133
149
|
dark_offs: [f4, '1', dark-offset]
|
|
134
150
|
```
|
|
135
151
|
|
|
136
|
-
Alternatively, provide a list with names of YAML files which contain the definitions
|
|
137
|
-
of the compounds.
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
compounds:
|
|
141
|
-
- h5_nomhk_tm.yaml
|
|
142
|
-
- h5_science_hk.yaml
|
|
143
|
-
```
|
|
144
152
|
* The 'variables' are defined by their data-type ('_dtype') and dimensions ('_dims'),
|
|
145
153
|
and optionally chunk sizes ('_chunks'), compression ('_compression'), variable length
|
|
146
154
|
('_vlen'). In addition, each variable can have as many attributes as you like,
|
|
@@ -148,6 +156,16 @@ The YAML file should be structured as follows:
|
|
|
148
156
|
|
|
149
157
|
```
|
|
150
158
|
variables:
|
|
159
|
+
/science_data/detector_images:
|
|
160
|
+
_dtype: u2
|
|
161
|
+
_dims: [number_of_images, samples_per_image]
|
|
162
|
+
_compression: 3
|
|
163
|
+
_FillValue: 65535
|
|
164
|
+
long_name: Detector pixel values
|
|
165
|
+
coverage_content_type: image
|
|
166
|
+
units: '1'
|
|
167
|
+
valid_min: 0
|
|
168
|
+
valid_max: 65534
|
|
151
169
|
/image_attributes/nr_coadditions:
|
|
152
170
|
_dtype: u2
|
|
153
171
|
_dims: [number_of_images]
|
|
@@ -163,20 +181,18 @@ The YAML file should be structured as follows:
|
|
|
163
181
|
units: seconds
|
|
164
182
|
stats_163:
|
|
165
183
|
_dtype: stats_dtype
|
|
166
|
-
_vlen: True
|
|
167
184
|
_dims: [days]
|
|
185
|
+
_vlen: True
|
|
168
186
|
comment: detector map statistics (MPS=163)
|
|
169
187
|
```
|
|
170
188
|
|
|
171
|
-
### Notes and ToDo
|
|
189
|
+
### Notes and ToDo
|
|
172
190
|
|
|
173
|
-
|
|
174
|
-
* Explain usage of parameter '_chunks', which is currently not correctly implemented.
|
|
175
|
-
* Explain that the usage of variable length data-sets may break netCDF4 compatibility
|
|
191
|
+
* The layout of a HDF5 or netCDF4 file can be complex. From version 0.3.0, you can split the file definition over several YAML files and provide a list with the names of YAML files as input to H5Yaml and NcYaml.
|
|
176
192
|
|
|
177
193
|
## Support [TBW]
|
|
178
194
|
|
|
179
|
-
##
|
|
195
|
+
## Road map
|
|
180
196
|
|
|
181
197
|
* Release v0.1 : stable API to read your YAML files and generate the HDF5/netCDF4 file
|
|
182
198
|
|
|
@@ -29,23 +29,39 @@ However, package `netCDF4` has some limitations, which `h5py` has not, for examp
|
|
|
29
29
|
not allow variable-length variables to have a compound data-type.
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
|
-
|
|
32
|
+
The package `h5yaml` is available from PyPI. To install it use `pip`:
|
|
33
|
+
|
|
34
|
+
> $ pip install [--user] h5yaml
|
|
35
|
+
|
|
36
|
+
The module `h5yaml` requires Python3.10+ and Python modules: h5py (v3.14+), netCDF4 (v1.7+) and numpy (v2.0+).
|
|
37
|
+
|
|
38
|
+
**Note**: the packages `h5py` and `netCDF4` come with their own HDF5 libraries. If these are different then they may
|
|
39
|
+
collide and result in a *''HDF5 error''*.
|
|
40
|
+
If this is the case then you have to install the development packages of HDF5 and netCDF4 (or compile them from source).
|
|
41
|
+
And reinstall `h5py` and `netCDF4` using the commands:
|
|
42
|
+
|
|
43
|
+
> $ pip uninstall h5py; pip install --no-binary=h5py h5py
|
|
44
|
+
> $ pip uninstall netCDF4; pip install --no-binary=netCDF4 netCDF4
|
|
33
45
|
|
|
34
46
|
## Usage
|
|
35
47
|
|
|
36
48
|
The YAML file should be structured as follows:
|
|
37
49
|
|
|
38
|
-
* The top level are: 'groups', 'dimensions', 'compounds' and '
|
|
50
|
+
* The top level are: 'groups', 'dimensions', 'compounds', 'variables', 'attrs\_global' and 'attrs\_groups'.
|
|
51
|
+
* > 'attrs\_global' and 'attrs\_groups' are added in version 0.3.0
|
|
52
|
+
* The names of the attributes, groups, dimensions, compounds and viariable should be specified as PosixPaths, however:
|
|
53
|
+
* The names of groups should never start with a slash (always erlative to root);
|
|
54
|
+
* All other elements which are stored in root should also not start with a slash;
|
|
55
|
+
* But these elements require a starting slash (absolute paths) when they are stored not the root.
|
|
39
56
|
* The section 'groups' are optional, but you should provide each group you want to use
|
|
40
57
|
in your file. The 'groups' section in the YAML file may look like this:
|
|
41
|
-
|
|
42
58
|
```
|
|
43
59
|
groups:
|
|
44
60
|
- engineering_data
|
|
45
61
|
- image_attributes
|
|
46
62
|
- navigation_data
|
|
47
|
-
- processing_control
|
|
48
63
|
- science_data
|
|
64
|
+
- processing_control/input_data
|
|
49
65
|
```
|
|
50
66
|
|
|
51
67
|
* The section 'dimensions' is obligatory, you should define the dimensions for each
|
|
@@ -101,14 +117,6 @@ The YAML file should be structured as follows:
|
|
|
101
117
|
dark_offs: [f4, '1', dark-offset]
|
|
102
118
|
```
|
|
103
119
|
|
|
104
|
-
Alternatively, provide a list with names of YAML files which contain the definitions
|
|
105
|
-
of the compounds.
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
compounds:
|
|
109
|
-
- h5_nomhk_tm.yaml
|
|
110
|
-
- h5_science_hk.yaml
|
|
111
|
-
```
|
|
112
120
|
* The 'variables' are defined by their data-type ('_dtype') and dimensions ('_dims'),
|
|
113
121
|
and optionally chunk sizes ('_chunks'), compression ('_compression'), variable length
|
|
114
122
|
('_vlen'). In addition, each variable can have as many attributes as you like,
|
|
@@ -116,6 +124,16 @@ The YAML file should be structured as follows:
|
|
|
116
124
|
|
|
117
125
|
```
|
|
118
126
|
variables:
|
|
127
|
+
/science_data/detector_images:
|
|
128
|
+
_dtype: u2
|
|
129
|
+
_dims: [number_of_images, samples_per_image]
|
|
130
|
+
_compression: 3
|
|
131
|
+
_FillValue: 65535
|
|
132
|
+
long_name: Detector pixel values
|
|
133
|
+
coverage_content_type: image
|
|
134
|
+
units: '1'
|
|
135
|
+
valid_min: 0
|
|
136
|
+
valid_max: 65534
|
|
119
137
|
/image_attributes/nr_coadditions:
|
|
120
138
|
_dtype: u2
|
|
121
139
|
_dims: [number_of_images]
|
|
@@ -131,20 +149,18 @@ The YAML file should be structured as follows:
|
|
|
131
149
|
units: seconds
|
|
132
150
|
stats_163:
|
|
133
151
|
_dtype: stats_dtype
|
|
134
|
-
_vlen: True
|
|
135
152
|
_dims: [days]
|
|
153
|
+
_vlen: True
|
|
136
154
|
comment: detector map statistics (MPS=163)
|
|
137
155
|
```
|
|
138
156
|
|
|
139
|
-
### Notes and ToDo
|
|
157
|
+
### Notes and ToDo
|
|
140
158
|
|
|
141
|
-
|
|
142
|
-
* Explain usage of parameter '_chunks', which is currently not correctly implemented.
|
|
143
|
-
* Explain that the usage of variable length data-sets may break netCDF4 compatibility
|
|
159
|
+
* The layout of a HDF5 or netCDF4 file can be complex. From version 0.3.0, you can split the file definition over several YAML files and provide a list with the names of YAML files as input to H5Yaml and NcYaml.
|
|
144
160
|
|
|
145
161
|
## Support [TBW]
|
|
146
162
|
|
|
147
|
-
##
|
|
163
|
+
## Road map
|
|
148
164
|
|
|
149
165
|
* Release v0.1 : stable API to read your YAML files and generate the HDF5/netCDF4 file
|
|
150
166
|
|