h5rdmtoolbox 2.3.0__tar.gz → 2.4.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.
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/PKG-INFO +28 -22
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/README.md +8 -5
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/__init__.py +89 -35
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/_cfg.py +2 -2
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/core.py +14 -17
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/utils.py +2 -2
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/tutorial_convention.yaml +1 -1
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml +3 -3
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/extensions/units.py +4 -1
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/__init__.py +57 -4
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/hdf/attributes.py +6 -5
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/hdf/datasets.py +2 -3
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/hdf/file.py +3 -3
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/hdf/groups.py +2 -3
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/rdf.py +90 -36
- h5rdmtoolbox-2.4.0/h5rdmtoolbox/ld/shacl.py +204 -0
- h5rdmtoolbox-2.4.0/h5rdmtoolbox/ld/user/attributes.py +195 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/user/datasets.py +7 -1
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/user/groups.py +14 -4
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/utils.py +7 -3
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/protocols.py +26 -2
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/repository/__init__.py +1 -2
- h5rdmtoolbox-2.4.0/h5rdmtoolbox/repository/default_metamapper.py +55 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/repository/interface.py +17 -15
- h5rdmtoolbox-2.4.0/h5rdmtoolbox/repository/utils.py +132 -0
- h5rdmtoolbox-2.4.0/h5rdmtoolbox/repository/zenodo/__init__.py +5 -0
- h5rdmtoolbox-2.4.0/h5rdmtoolbox/repository/zenodo/core.py +451 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/repository/zenodo/metadata.py +2 -2
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/utils.py +33 -51
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/core.py +34 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/h5attr.py +8 -2
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/jsonld.py +2 -2
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox.egg-info/PKG-INFO +28 -22
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox.egg-info/SOURCES.txt +4 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox.egg-info/requires.txt +15 -15
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/setup.cfg +12 -9
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/conventions/test_conventions.py +17 -7
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/ld/test_ld.py +31 -9
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/ld/test_rdf.py +1 -3
- h5rdmtoolbox-2.4.0/tests/ld/test_shacl.py +223 -0
- h5rdmtoolbox-2.4.0/tests/ld/test_user_graph.py +275 -0
- h5rdmtoolbox-2.4.0/tests/ld/test_utils.py +13 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/repository/test_zenodo.py +70 -24
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_cli.py +1 -3
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_config.py +10 -3
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_utils.py +4 -5
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_version.py +11 -6
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_xarray_export.py +6 -3
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/wrapper/test_core.py +2 -2
- h5rdmtoolbox-2.3.0/h5rdmtoolbox/ld/user/attributes.py +0 -117
- h5rdmtoolbox-2.3.0/h5rdmtoolbox/repository/utils.py +0 -64
- h5rdmtoolbox-2.3.0/h5rdmtoolbox/repository/zenodo/__init__.py +0 -5
- h5rdmtoolbox-2.3.0/h5rdmtoolbox/repository/zenodo/core.py +0 -825
- h5rdmtoolbox-2.3.0/tests/ld/test_user_graph.py +0 -74
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/LICENSE +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/_repr.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/_version.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/cli.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/consts.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/cfg.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/consts.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/errors.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/generate.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/ontology/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/ontology/h5ontocls.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/references.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/standard_attributes.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/convention/toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/def_icon.png +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/fluid-v1.yml +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/h5tbx.yaml +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/id_icon.png +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/iri_icon.png +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/ld_icon.png +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/piv-v1.yml +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/style.css +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/type_icon.png +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/hdfdb/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/hdfdb/filedb.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/hdfdb/objdb.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/hdfdb/query.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/hdfdb/utils.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/interface.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/lazy.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/database/mongo.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/errors.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/extensions/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/extensions/magnitude.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/extensions/normalize.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/extensions/onto.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/extensions/vector.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/gui/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/gui/fairify.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/gui/src/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/gui/src/main.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/identifiers.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/layout/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/layout/core.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/globals.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/hdf/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/user/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/ld/user/file.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/plotting.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/protected_attributes.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/repository/zenodo/tokens.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/repository/zenodo/utils.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/tutorial.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/user.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/accessor.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/accessors/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/accessors/provenance.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/ds_decoder.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/h5ext.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/h5utils.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/h5yaml.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/wrapper/xr2hdf.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox.egg-info/dependency_links.txt +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox.egg-info/entry_points.txt +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox.egg-info/top_level.txt +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/pyproject.toml +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/setup.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/clean_zenodo_sandbox.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/conventions/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/conventions/test_convention_vfuncs.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/conventions/test_engmeta.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/conventions/test_references.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/conventions/test_toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/conventions/test_utils.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/database/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/database/test_find_rdf.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/database/test_hdfDB.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/database/test_mongo.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/layouts/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/layouts/test_core.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/layouts/test_docs.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/ld/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_extensions.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_identifiers.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_plotting.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_repr.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/test_user.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/wrapper/test_dump.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/wrapper/test_file.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/wrapper/test_h5ext.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/wrapper/test_lazy.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/wrapper/test_namespaces.py +0 -0
- {h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/tests/wrapper/test_xr2df.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: h5rdmtoolbox
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Supporting a FAIR Research Data lifecycle using Python and HDF5.
|
|
5
5
|
Home-page: https://h5rdmtoolbox.readthedocs.io/en/latest/
|
|
6
6
|
Author: Matthias Probst
|
|
@@ -9,31 +9,34 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
14
|
Classifier: Operating System :: OS Independent
|
|
14
15
|
Classifier: Development Status :: 4 - Beta
|
|
15
16
|
Classifier: Topic :: Scientific/Engineering
|
|
16
|
-
Requires-Python: <3.
|
|
17
|
+
Requires-Python: <3.14,>=3.9
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
18
19
|
License-File: LICENSE
|
|
19
20
|
Requires-Dist: appdirs~=1.4
|
|
20
21
|
Requires-Dist: importlib_resources<7.0.0,>=6.5.2
|
|
21
|
-
Requires-Dist: numpy<
|
|
22
|
+
Requires-Dist: numpy<3.0.0,>=1.20
|
|
22
23
|
Requires-Dist: h5py~=3.8
|
|
23
24
|
Requires-Dist: matplotlib>=3.5.2
|
|
24
25
|
Requires-Dist: IPython>=7.34.0
|
|
25
26
|
Requires-Dist: pyyaml>=6.0
|
|
26
27
|
Requires-Dist: xarray>=2022.3.0
|
|
27
|
-
Requires-Dist: pint
|
|
28
|
-
Requires-Dist: pint_xarray<=0.
|
|
28
|
+
Requires-Dist: pint>=0.24.4
|
|
29
|
+
Requires-Dist: pint_xarray<=0.6.0,>=0.2.1
|
|
29
30
|
Requires-Dist: regex>=2020.7.9
|
|
30
31
|
Requires-Dist: packaging>=24.1
|
|
31
|
-
Requires-Dist: ontolutils<0.
|
|
32
|
+
Requires-Dist: ontolutils<1.0.0,>=0.21.1
|
|
32
33
|
Requires-Dist: python-forge==18.6.0
|
|
33
34
|
Requires-Dist: requests>=2.32.4
|
|
34
35
|
Requires-Dist: pydantic~=2.8
|
|
35
36
|
Requires-Dist: rdflib~=7.1
|
|
36
|
-
Requires-Dist: click
|
|
37
|
+
Requires-Dist: click>=8.1.7
|
|
38
|
+
Requires-Dist: cftime>=1.6.4
|
|
39
|
+
Requires-Dist: pyshacl<1.0.0,>=0.30.1
|
|
37
40
|
Provides-Extra: database
|
|
38
41
|
Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "database"
|
|
39
42
|
Provides-Extra: layout-validation
|
|
@@ -51,12 +54,12 @@ Provides-Extra: test
|
|
|
51
54
|
Requires-Dist: pytest>=8.3.3; extra == "test"
|
|
52
55
|
Requires-Dist: pytest-cov>=5.0.0; extra == "test"
|
|
53
56
|
Requires-Dist: pylint; extra == "test"
|
|
54
|
-
Requires-Dist:
|
|
55
|
-
Requires-Dist: ssnolib>=1.5.1.2; extra == "test"
|
|
57
|
+
Requires-Dist: ssnolib>=1.5.1.4; extra == "test"
|
|
56
58
|
Requires-Dist: mongomock==4.1.2; extra == "test"
|
|
57
59
|
Requires-Dist: xmltodict<=0.13.0; extra == "test"
|
|
58
60
|
Requires-Dist: scipy>=1.10.1; extra == "test"
|
|
59
61
|
Requires-Dist: scikit-image>=0.21.0; extra == "test"
|
|
62
|
+
Requires-Dist: scikit-learn; extra == "test"
|
|
60
63
|
Requires-Dist: pandas>=1.4.3; extra == "test"
|
|
61
64
|
Requires-Dist: xmltodict<=0.13.0; extra == "test"
|
|
62
65
|
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "test"
|
|
@@ -73,12 +76,12 @@ Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "docs"
|
|
|
73
76
|
Requires-Dist: pytest>=8.3.3; extra == "docs"
|
|
74
77
|
Requires-Dist: pytest-cov>=5.0.0; extra == "docs"
|
|
75
78
|
Requires-Dist: pylint; extra == "docs"
|
|
76
|
-
Requires-Dist:
|
|
77
|
-
Requires-Dist: ssnolib>=1.5.1.2; extra == "docs"
|
|
79
|
+
Requires-Dist: ssnolib>=1.5.1.4; extra == "docs"
|
|
78
80
|
Requires-Dist: mongomock==4.1.2; extra == "docs"
|
|
79
81
|
Requires-Dist: xmltodict<=0.13.0; extra == "docs"
|
|
80
82
|
Requires-Dist: scipy>=1.10.1; extra == "docs"
|
|
81
83
|
Requires-Dist: scikit-image>=0.21.0; extra == "docs"
|
|
84
|
+
Requires-Dist: scikit-learn; extra == "docs"
|
|
82
85
|
Requires-Dist: pandas>=1.4.3; extra == "docs"
|
|
83
86
|
Requires-Dist: xmltodict<=0.13.0; extra == "docs"
|
|
84
87
|
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "docs"
|
|
@@ -99,12 +102,12 @@ Requires-Dist: PyQt5==5.15.10; extra == "complete"
|
|
|
99
102
|
Requires-Dist: pytest>=8.3.3; extra == "complete"
|
|
100
103
|
Requires-Dist: pytest-cov>=5.0.0; extra == "complete"
|
|
101
104
|
Requires-Dist: pylint; extra == "complete"
|
|
102
|
-
Requires-Dist:
|
|
103
|
-
Requires-Dist: ssnolib>=1.5.1.2; extra == "complete"
|
|
105
|
+
Requires-Dist: ssnolib>=1.5.1.4; extra == "complete"
|
|
104
106
|
Requires-Dist: mongomock==4.1.2; extra == "complete"
|
|
105
107
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete"
|
|
106
108
|
Requires-Dist: scipy>=1.10.1; extra == "complete"
|
|
107
109
|
Requires-Dist: scikit-image>=0.21.0; extra == "complete"
|
|
110
|
+
Requires-Dist: scikit-learn; extra == "complete"
|
|
108
111
|
Requires-Dist: pandas>=1.4.3; extra == "complete"
|
|
109
112
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete"
|
|
110
113
|
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete"
|
|
@@ -117,12 +120,12 @@ Requires-Dist: PyQt5==5.15.10; extra == "complete-with-docs"
|
|
|
117
120
|
Requires-Dist: pytest>=8.3.3; extra == "complete-with-docs"
|
|
118
121
|
Requires-Dist: pytest-cov>=5.0.0; extra == "complete-with-docs"
|
|
119
122
|
Requires-Dist: pylint; extra == "complete-with-docs"
|
|
120
|
-
Requires-Dist:
|
|
121
|
-
Requires-Dist: ssnolib>=1.5.1.2; extra == "complete-with-docs"
|
|
123
|
+
Requires-Dist: ssnolib>=1.5.1.4; extra == "complete-with-docs"
|
|
122
124
|
Requires-Dist: mongomock==4.1.2; extra == "complete-with-docs"
|
|
123
125
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
124
126
|
Requires-Dist: scipy>=1.10.1; extra == "complete-with-docs"
|
|
125
127
|
Requires-Dist: scikit-image>=0.21.0; extra == "complete-with-docs"
|
|
128
|
+
Requires-Dist: scikit-learn; extra == "complete-with-docs"
|
|
126
129
|
Requires-Dist: pandas>=1.4.3; extra == "complete-with-docs"
|
|
127
130
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
128
131
|
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
|
|
@@ -138,12 +141,12 @@ Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete-with-docs"
|
|
|
138
141
|
Requires-Dist: pytest>=8.3.3; extra == "complete-with-docs"
|
|
139
142
|
Requires-Dist: pytest-cov>=5.0.0; extra == "complete-with-docs"
|
|
140
143
|
Requires-Dist: pylint; extra == "complete-with-docs"
|
|
141
|
-
Requires-Dist:
|
|
142
|
-
Requires-Dist: ssnolib>=1.5.1.2; extra == "complete-with-docs"
|
|
144
|
+
Requires-Dist: ssnolib>=1.5.1.4; extra == "complete-with-docs"
|
|
143
145
|
Requires-Dist: mongomock==4.1.2; extra == "complete-with-docs"
|
|
144
146
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
145
147
|
Requires-Dist: scipy>=1.10.1; extra == "complete-with-docs"
|
|
146
148
|
Requires-Dist: scikit-image>=0.21.0; extra == "complete-with-docs"
|
|
149
|
+
Requires-Dist: scikit-learn; extra == "complete-with-docs"
|
|
147
150
|
Requires-Dist: pandas>=1.4.3; extra == "complete-with-docs"
|
|
148
151
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
149
152
|
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
|
|
@@ -165,7 +168,7 @@ Dynamic: license-file
|
|
|
165
168
|

|
|
166
169
|
[](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox)
|
|
167
170
|
[](https://h5rdmtoolbox.readthedocs.io/en/latest/?badge=latest)
|
|
168
|
-

|
|
171
|
+

|
|
169
172
|
|
|
170
173
|
*Note, that the project is still under development!*
|
|
171
174
|
|
|
@@ -256,11 +259,12 @@ A paper is published in the journal [inggrid](https://preprints.inggrid.org/repo
|
|
|
256
259
|
|
|
257
260
|
## Installation
|
|
258
261
|
|
|
259
|
-
Use python 3.
|
|
262
|
+
Use python 3.9 or higher (automatic testing is performed until 3.13). If you are a regular user, you can install the
|
|
260
263
|
package via pip:
|
|
261
264
|
|
|
262
265
|
pip install h5RDMtoolbox
|
|
263
266
|
|
|
267
|
+
|
|
264
268
|
### Install from source:
|
|
265
269
|
|
|
266
270
|
Developers may clone the repository and install the package from source. Clone the repository first:
|
|
@@ -293,7 +297,7 @@ specific to the features of the package:
|
|
|
293
297
|
|
|
294
298
|
**Specific to the package are ...**
|
|
295
299
|
|
|
296
|
-
- `h5py
|
|
300
|
+
- `h5py~=3.8`: HDF5 file interface
|
|
297
301
|
- `xarray>=2022.3.0`: Working with scientific arrays in combination with attributes. Allows carrying metadata from HDF5
|
|
298
302
|
to user
|
|
299
303
|
- `pint>=0.19.2`: Allows working with units
|
|
@@ -334,10 +338,12 @@ Install optional dependencies by specifying them in square brackets after the pa
|
|
|
334
338
|
## Citing the package
|
|
335
339
|
|
|
336
340
|
If you intend to use the package in your work, you may cite the software itself as published on paper in the
|
|
337
|
-
[Zenodo](https://zenodo.org/records/
|
|
341
|
+
[Zenodo (latest version)](https://zenodo.org/records/13309253) repository. A related paper is published in the
|
|
338
342
|
journal [inggrid](https://www.inggrid.org/article/id/4028/). Thank you!
|
|
339
343
|
|
|
340
|
-
|
|
344
|
+
Alternatively or additionally, you can consult the `CITATION.cff` file.
|
|
345
|
+
|
|
346
|
+
Here is the BibTeX entry:
|
|
341
347
|
|
|
342
348
|
```
|
|
343
349
|
@article{probst2024h5rdmtoolbox,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|

|
|
4
4
|
[](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox)
|
|
5
5
|
[](https://h5rdmtoolbox.readthedocs.io/en/latest/?badge=latest)
|
|
6
|
-

|
|
6
|
+

|
|
7
7
|
|
|
8
8
|
*Note, that the project is still under development!*
|
|
9
9
|
|
|
@@ -94,11 +94,12 @@ A paper is published in the journal [inggrid](https://preprints.inggrid.org/repo
|
|
|
94
94
|
|
|
95
95
|
## Installation
|
|
96
96
|
|
|
97
|
-
Use python 3.
|
|
97
|
+
Use python 3.9 or higher (automatic testing is performed until 3.13). If you are a regular user, you can install the
|
|
98
98
|
package via pip:
|
|
99
99
|
|
|
100
100
|
pip install h5RDMtoolbox
|
|
101
101
|
|
|
102
|
+
|
|
102
103
|
### Install from source:
|
|
103
104
|
|
|
104
105
|
Developers may clone the repository and install the package from source. Clone the repository first:
|
|
@@ -131,7 +132,7 @@ specific to the features of the package:
|
|
|
131
132
|
|
|
132
133
|
**Specific to the package are ...**
|
|
133
134
|
|
|
134
|
-
- `h5py
|
|
135
|
+
- `h5py~=3.8`: HDF5 file interface
|
|
135
136
|
- `xarray>=2022.3.0`: Working with scientific arrays in combination with attributes. Allows carrying metadata from HDF5
|
|
136
137
|
to user
|
|
137
138
|
- `pint>=0.19.2`: Allows working with units
|
|
@@ -172,10 +173,12 @@ Install optional dependencies by specifying them in square brackets after the pa
|
|
|
172
173
|
## Citing the package
|
|
173
174
|
|
|
174
175
|
If you intend to use the package in your work, you may cite the software itself as published on paper in the
|
|
175
|
-
[Zenodo](https://zenodo.org/records/
|
|
176
|
+
[Zenodo (latest version)](https://zenodo.org/records/13309253) repository. A related paper is published in the
|
|
176
177
|
journal [inggrid](https://www.inggrid.org/article/id/4028/). Thank you!
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
Alternatively or additionally, you can consult the `CITATION.cff` file.
|
|
180
|
+
|
|
181
|
+
Here is the BibTeX entry:
|
|
179
182
|
|
|
180
183
|
```
|
|
181
184
|
@article{probst2024h5rdmtoolbox,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import pathlib
|
|
5
|
+
import warnings
|
|
5
6
|
from logging.handlers import RotatingFileHandler
|
|
6
7
|
from typing import Optional, Dict
|
|
7
8
|
|
|
@@ -53,6 +54,7 @@ from .wrapper.h5attr import Attribute
|
|
|
53
54
|
import json
|
|
54
55
|
from .wrapper.accessor import register_accessor
|
|
55
56
|
|
|
57
|
+
from .ld.shacl import validate_hdf, ValidationResult
|
|
56
58
|
# noinspection PyUnresolvedReferences
|
|
57
59
|
from .utils import DownloadFileManager
|
|
58
60
|
|
|
@@ -62,7 +64,7 @@ __author__ = 'Matthias Probst'
|
|
|
62
64
|
__author_orcid__ = 'https://orcid.org/0000-0001-8729-0482'
|
|
63
65
|
|
|
64
66
|
|
|
65
|
-
def get_package_meta():
|
|
67
|
+
def get_package_meta() -> Dict:
|
|
66
68
|
"""Reads codemeta.json and returns it as dict"""
|
|
67
69
|
with open(__this_dir__ / '../codemeta.json', 'r') as f:
|
|
68
70
|
codemeta = json.loads(f.read())
|
|
@@ -168,11 +170,66 @@ def dump_jsonld(
|
|
|
168
170
|
)
|
|
169
171
|
|
|
170
172
|
|
|
173
|
+
# def shacl_validate(
|
|
174
|
+
# *,
|
|
175
|
+
# hdf_data: Union[str, rdflib.Graph] = None,
|
|
176
|
+
# hdf_source: Union[h5py.File, pathlib.Path] = None,
|
|
177
|
+
# shacl_data: Union[str, rdflib.Graph] = None,
|
|
178
|
+
# shacl_source: Union[str, pathlib.Path] = None,
|
|
179
|
+
# hdf_file_uri="https://example.org/hdf5file#",
|
|
180
|
+
# shacl_format: str = 'turtle',
|
|
181
|
+
# hdf_data_format: str = 'turtle',
|
|
182
|
+
# **pyshacl_kwargs
|
|
183
|
+
# ) -> ValidationResult:
|
|
184
|
+
# """Validate HDF5 file content against SHACL shapes.
|
|
185
|
+
#
|
|
186
|
+
# Parameters
|
|
187
|
+
# ----------
|
|
188
|
+
# hdf_data : Union[str, rdflib.Graph], optional
|
|
189
|
+
# RDF data of the HDF5 file as string or rdflib.Graph. If not
|
|
190
|
+
# provided, `hdf_source` must be provided.
|
|
191
|
+
# hdf_source : Union[h5py.File, pathlib.Path], optional
|
|
192
|
+
# HDF5 file or h5py.File object to extract RDF data from. If not
|
|
193
|
+
# provided, `hdf_data` must be provided.
|
|
194
|
+
# shacl_data : Union[str, rdflib.Graph], optional
|
|
195
|
+
# SHACL shapes as string or rdflib.Graph. If not provided,
|
|
196
|
+
# `shacl_source` must be provided.
|
|
197
|
+
# shacl_source : Union[str, pathlib.Path], optional
|
|
198
|
+
# File path to SHACL shapes. If not provided, `shacl_data`
|
|
199
|
+
# must be provided.
|
|
200
|
+
# hdf_file_uri : str, optional
|
|
201
|
+
# The file URI to use for the HDF5 file when extracting RDF data.
|
|
202
|
+
# Default is "https://example.org/hdf5file#".
|
|
203
|
+
# shacl_format : str, optional
|
|
204
|
+
# The format of the SHACL shapes if `shacl_data` is provided as
|
|
205
|
+
# string. Default is 'turtle'.
|
|
206
|
+
# hdf_data_format : str, optional
|
|
207
|
+
# The format of the HDF5 RDF data if `hdf_data` is provided as
|
|
208
|
+
# string. Default is 'turtle'.
|
|
209
|
+
# **pyshacl_kwargs
|
|
210
|
+
# Additional keyword arguments passed to pyshacl.validate().
|
|
211
|
+
#
|
|
212
|
+
# Returns
|
|
213
|
+
# -------
|
|
214
|
+
# ValidationResult
|
|
215
|
+
# The result of the SHACL validation.
|
|
216
|
+
# """
|
|
217
|
+
# return validate_hdf(
|
|
218
|
+
# hdf_data=hdf_data,
|
|
219
|
+
# hdf_source=hdf_source,
|
|
220
|
+
# shacl_data=shacl_data,
|
|
221
|
+
# shacl_source=shacl_source,
|
|
222
|
+
# hdf_file_uri=hdf_file_uri,
|
|
223
|
+
# shacl_format=shacl_format,
|
|
224
|
+
# hdf_data_format=hdf_data_format,
|
|
225
|
+
# **pyshacl_kwargs
|
|
226
|
+
# )
|
|
227
|
+
|
|
228
|
+
|
|
171
229
|
def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
|
|
172
230
|
skipND: int = 1,
|
|
173
231
|
structural: bool = True,
|
|
174
232
|
contextual: bool = True,
|
|
175
|
-
resolve_keys: bool = True,
|
|
176
233
|
context: Optional[Dict] = None,
|
|
177
234
|
blank_node_iri_base: Optional[str] = None
|
|
178
235
|
) -> str:
|
|
@@ -189,19 +246,12 @@ def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
|
|
|
189
246
|
considered if structural=True.
|
|
190
247
|
structural : bool=True
|
|
191
248
|
Include structural information in the JSON-LD output.
|
|
192
|
-
|
|
193
|
-
Include
|
|
194
|
-
resolve_keys : bool=True
|
|
195
|
-
Resolve keys in the JSON-LD output. This is used when semantic=True.
|
|
196
|
-
If resolve_keys is False and an attribute name in the HDF5 file, which has
|
|
197
|
-
a predicate is different in its name from the predicate, the attribute name is used.
|
|
198
|
-
Example: an attribute "name" is associated with "foaf:lastName", then "name" is used
|
|
199
|
-
and "name": "http://xmlns.com/foaf/0.1/lastName" is added to the context.
|
|
249
|
+
contextual : bool=True
|
|
250
|
+
Include contextual information in the JSON-LD output.
|
|
200
251
|
context: Optional[Dict]
|
|
201
252
|
context in form of {prefix: IRI}, e.g. "ssno": "https://matthiasprobst.github.io/ssno#"
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
253
|
+
blank_node_iri_base: Optional[str]
|
|
254
|
+
IRI base used for blank nodes
|
|
205
255
|
"""
|
|
206
256
|
if blank_node_iri_base is not None:
|
|
207
257
|
if not isinstance(blank_node_iri_base, (str, HttpUrl)):
|
|
@@ -212,20 +262,18 @@ def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
|
|
|
212
262
|
|
|
213
263
|
from h5rdmtoolbox.ld.hdf.file import get_serialized_ld
|
|
214
264
|
if structural and not contextual:
|
|
215
|
-
return get_serialized_ld(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
# **kwargs
|
|
228
|
-
# )
|
|
265
|
+
return get_serialized_ld(
|
|
266
|
+
hdf_filename,
|
|
267
|
+
blank_node_iri_base,
|
|
268
|
+
format="json-ld",
|
|
269
|
+
context=context,
|
|
270
|
+
skipND=skipND)
|
|
271
|
+
return get_serialized_ld(
|
|
272
|
+
hdf_filename,
|
|
273
|
+
blank_node_iri_base,
|
|
274
|
+
format="json-ld",
|
|
275
|
+
context=context,
|
|
276
|
+
skipND=skipND)
|
|
229
277
|
|
|
230
278
|
|
|
231
279
|
def serialize(hdf_filename,
|
|
@@ -237,6 +285,11 @@ def serialize(hdf_filename,
|
|
|
237
285
|
**kwargs):
|
|
238
286
|
"""Alternative to json-ld but allows multiple serialization options"""
|
|
239
287
|
fmt = kwargs.pop("format", fmt)
|
|
288
|
+
if file_uri is None:
|
|
289
|
+
warnings.warn(
|
|
290
|
+
"Not providing a file-uri is not good practice because it will generate blank nodes. Consider providing an URI such as the DOI URL for example.",
|
|
291
|
+
category=UserWarning
|
|
292
|
+
)
|
|
240
293
|
with File(hdf_filename) as h5:
|
|
241
294
|
return h5.serialize(fmt=fmt,
|
|
242
295
|
skipND=skipND,
|
|
@@ -257,7 +310,7 @@ def build_pyvis_graph(hdf_filename, output_filename="kg-graph.html", notebook=Fa
|
|
|
257
310
|
kg = kglab.KnowledgeGraph().load_rdf_text(
|
|
258
311
|
serialize(hdf_filename, fmt="ttl", structural=structural, contextual=contextual)
|
|
259
312
|
)
|
|
260
|
-
|
|
313
|
+
vis_style = style or {
|
|
261
314
|
"hdf": {
|
|
262
315
|
"color": "orange",
|
|
263
316
|
"size": 40,
|
|
@@ -268,7 +321,7 @@ def build_pyvis_graph(hdf_filename, output_filename="kg-graph.html", notebook=Fa
|
|
|
268
321
|
},
|
|
269
322
|
}
|
|
270
323
|
subgraph = kglab.SubgraphTensor(kg)
|
|
271
|
-
pyvis_graph = subgraph.build_pyvis_graph(notebook=notebook, style=
|
|
324
|
+
pyvis_graph = subgraph.build_pyvis_graph(notebook=notebook, style=vis_style)
|
|
272
325
|
pyvis_graph.force_atlas_2based()
|
|
273
326
|
pyvis_graph.show(output_filename)
|
|
274
327
|
return pyvis_graph
|
|
@@ -300,7 +353,7 @@ def register_dataset_decoder(decoder: Callable, decoder_name: str = None, overwr
|
|
|
300
353
|
ds_decoder.registered_dataset_decoders[decoder_name] = decoder
|
|
301
354
|
|
|
302
355
|
|
|
303
|
-
|
|
356
|
+
_ATEXIT_VERBOSE = False
|
|
304
357
|
|
|
305
358
|
|
|
306
359
|
def set_loglevel(level: Union[int, str]):
|
|
@@ -329,18 +382,18 @@ def clean_temp_data(full: bool = False):
|
|
|
329
382
|
return
|
|
330
383
|
|
|
331
384
|
for _tmp_session_dir in [UserDir['tmp'], ]:
|
|
332
|
-
if
|
|
385
|
+
if _ATEXIT_VERBOSE:
|
|
333
386
|
print(f'cleaning up tmp directory "{_tmp_session_dir}"')
|
|
334
387
|
if _tmp_session_dir.exists():
|
|
335
388
|
try:
|
|
336
|
-
if
|
|
389
|
+
if _ATEXIT_VERBOSE:
|
|
337
390
|
print(f'try deleting tmp in session dir: {_tmp_session_dir}')
|
|
338
391
|
shutil.rmtree(_tmp_session_dir)
|
|
339
392
|
except PermissionError as e:
|
|
340
|
-
if
|
|
393
|
+
if _ATEXIT_VERBOSE:
|
|
341
394
|
print(f'[!] failed deleting tmp session dir: {_tmp_session_dir}')
|
|
342
395
|
failed_dirs.append(UserDir['tmp'])
|
|
343
|
-
if
|
|
396
|
+
if _ATEXIT_VERBOSE:
|
|
344
397
|
print(f'removing tmp folder "{_tmp_session_dir}" failed due to "{e}". Best is you '
|
|
345
398
|
f'manually delete the directory.')
|
|
346
399
|
finally:
|
|
@@ -372,4 +425,5 @@ __all__ = ('__version__', '__author__', '__author_orcid__',
|
|
|
372
425
|
'File', 'Group', 'Dataset', 'Attribute',
|
|
373
426
|
'dump', 'dumps', 'cv_h5py', 'lower', 'Lower',
|
|
374
427
|
'set_config', 'get_config', 'get_ureg',
|
|
375
|
-
'Convention', 'jsonld', 'lazy', 'DownloadFileManager'
|
|
428
|
+
'Convention', 'jsonld', 'lazy', 'DownloadFileManager',
|
|
429
|
+
'clean_temp_data')
|
|
@@ -28,7 +28,7 @@ CONFIG = {
|
|
|
28
28
|
'require_unit': True, # datasets require units
|
|
29
29
|
'ureg_format': 'C~',
|
|
30
30
|
'init_logger_level': 'ERROR',
|
|
31
|
-
'dtime_fmt': '%Y
|
|
31
|
+
'dtime_fmt': '%Y-%m-%dT%H:%M:%S%f',
|
|
32
32
|
'expose_user_prop_to_attrs': True,
|
|
33
33
|
'add_provenance': False,
|
|
34
34
|
'ignore_set_std_attr_err': False,
|
|
@@ -73,7 +73,7 @@ class set_config:
|
|
|
73
73
|
raise KeyError(f'Not a configuration key: "{k}"')
|
|
74
74
|
self.old[k] = CONFIG[k]
|
|
75
75
|
if k == 'ureg_format':
|
|
76
|
-
get_ureg().default_format = str(v)
|
|
76
|
+
get_ureg().formatter.default_format = str(v)
|
|
77
77
|
self._update(kwargs)
|
|
78
78
|
|
|
79
79
|
def __enter__(self):
|
|
@@ -13,6 +13,8 @@ import yaml
|
|
|
13
13
|
from pydoc import locate
|
|
14
14
|
from typing import Union, List, Dict, Tuple, Any
|
|
15
15
|
|
|
16
|
+
from forge import kwargs
|
|
17
|
+
|
|
16
18
|
from h5rdmtoolbox import errors
|
|
17
19
|
from h5rdmtoolbox.repository import RepositoryInterface
|
|
18
20
|
from h5rdmtoolbox.wrapper import ds_decoder
|
|
@@ -696,24 +698,19 @@ def from_json(filename: Union[str, pathlib.Path], overwrite: bool = False) -> Co
|
|
|
696
698
|
|
|
697
699
|
|
|
698
700
|
def from_repo(repo_interface: RepositoryInterface,
|
|
699
|
-
name: str
|
|
700
|
-
|
|
701
|
-
force_download: bool = False):
|
|
702
|
-
"""Download a YAML file from a repository"""
|
|
703
|
-
# check if file exists:
|
|
704
|
-
# path_compatible_doi = repo_interface.get_doi().replace('/', '_')
|
|
705
|
-
# estimated_filename = UserDir['cache'] / f'{path_compatible_doi}' / name
|
|
706
|
-
# estimated_filename.parent.mkdir(parents=True, exist_ok=True)
|
|
707
|
-
# if estimated_filename.exists():
|
|
708
|
-
# if not take_existing:
|
|
709
|
-
# raise FileExistsError(f'File {name} exists in cache but take_existing is set to False.')
|
|
710
|
-
# if take_existing and not force_download:
|
|
711
|
-
# return from_file(estimated_filename)
|
|
701
|
+
name: str):
|
|
702
|
+
"""Download a YAML file from a repository
|
|
712
703
|
|
|
704
|
+
Parameters
|
|
705
|
+
----------
|
|
706
|
+
repo_interface: RepositoryInterface
|
|
707
|
+
The repository interface to use for downloading the file
|
|
708
|
+
name: str
|
|
709
|
+
Name of the file to download
|
|
710
|
+
"""
|
|
711
|
+
logger.debug(f"Downloading file {name} from repository {repo_interface}")
|
|
713
712
|
filename = repo_interface.download_file(name)
|
|
714
|
-
|
|
715
|
-
# estimated_filename.unlink()
|
|
716
|
-
# filename.rename(estimated_filename)
|
|
713
|
+
logger.debug(f"File downloaded to {filename}. Now loading convention from file.")
|
|
717
714
|
return from_file(filename)
|
|
718
715
|
|
|
719
716
|
|
|
@@ -723,7 +720,7 @@ def from_zenodo(doi_or_recid: str,
|
|
|
723
720
|
force_download: bool = False) -> Convention:
|
|
724
721
|
"""Download a YAML file from a zenodo repository
|
|
725
722
|
|
|
726
|
-
Depreciated. Use `from_repo` in future.
|
|
723
|
+
Depreciated. Use `from_repo` in the future.
|
|
727
724
|
|
|
728
725
|
Parameters
|
|
729
726
|
----------
|
|
@@ -97,8 +97,8 @@ def get_similar_names_ratio(a, b):
|
|
|
97
97
|
# def equal_base_units(unit1, unit2):
|
|
98
98
|
# """Return if two units are equivalent"""
|
|
99
99
|
#
|
|
100
|
-
# base_unit1 = get_ureg()(unit1).to_base_units().units.__format__(get_ureg().default_format)
|
|
101
|
-
# base_unit2 = get_ureg()(unit2).to_base_units().units.__format__(get_ureg().default_format)
|
|
100
|
+
# base_unit1 = get_ureg()(unit1).to_base_units().units.__format__(get_ureg().formatter.default_format)
|
|
101
|
+
# base_unit2 = get_ureg()(unit2).to_base_units().units.__format__(get_ureg().formatter.default_format)
|
|
102
102
|
# return base_unit1 == base_unit2
|
|
103
103
|
|
|
104
104
|
|
|
@@ -36,7 +36,7 @@ standard_name:
|
|
|
36
36
|
standard_name_table:
|
|
37
37
|
target_method: __init__
|
|
38
38
|
validator: $standardNameTableType
|
|
39
|
-
default_value: https://zenodo.org/records/
|
|
39
|
+
default_value: https://zenodo.org/records/17331305/files/fan_standard_name_table.jsonld
|
|
40
40
|
requirements:
|
|
41
41
|
- standard_name
|
|
42
42
|
- units
|
{h5rdmtoolbox-2.3.0 → h5rdmtoolbox-2.4.0}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml
RENAMED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"@type": "ssno:StandardNameTable",
|
|
12
12
|
"dcterms:title": "fan_standard_name_shorttable",
|
|
13
|
-
"
|
|
14
|
-
"identifier": "10.5281/zenodo.
|
|
13
|
+
"schema:version": "5.0.0",
|
|
14
|
+
"identifier": "10.5281/zenodo.17331305",
|
|
15
15
|
"dcterms:modified": "2023-07-18 09:05:38.112885+00:00",
|
|
16
16
|
"ssno:standardNames": [
|
|
17
17
|
{
|
|
@@ -386,5 +386,5 @@
|
|
|
386
386
|
"@id": "_:N3354c7311dee428391ae501b6ebc8bba"
|
|
387
387
|
}
|
|
388
388
|
],
|
|
389
|
-
"@id": "https://doi.org/10.5281/zenodo.
|
|
389
|
+
"@id": "https://doi.org/10.5281/zenodo.17331305"
|
|
390
390
|
}
|
|
@@ -16,7 +16,7 @@ class ToUnitsInterface:
|
|
|
16
16
|
self.coord_units = coord_units
|
|
17
17
|
|
|
18
18
|
def _convert_units(self, data: xr.DataArray):
|
|
19
|
-
assert isinstance(data, xr.DataArray)
|
|
19
|
+
assert isinstance(data, xr.DataArray), 'Data is not an xarray DataArray'
|
|
20
20
|
assert 'units' in data.attrs, 'No units attribute found in the dataset'
|
|
21
21
|
for c, cn in self.coord_units.items():
|
|
22
22
|
assert 'units' in data.coords[c].attrs, f'No units attribute found in the coordinate {c}'
|
|
@@ -42,4 +42,7 @@ class ToUnitsAccessor(Accessor):
|
|
|
42
42
|
"""Accessor to await selected data to be converted to a new units"""
|
|
43
43
|
|
|
44
44
|
def __call__(self, dataset_unit: Optional[str] = None, **coord_units) -> ToUnitsInterface:
|
|
45
|
+
if isinstance(dataset_unit, dict): # fix for pint-xarray > 0.4.0
|
|
46
|
+
coord_units = dataset_unit
|
|
47
|
+
dataset_unit = None
|
|
45
48
|
return ToUnitsInterface(self._obj, dataset_unit=dataset_unit, **coord_units)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import pathlib
|
|
2
|
-
import warnings
|
|
3
2
|
from typing import Union, Optional, Dict
|
|
4
3
|
|
|
5
4
|
import h5py
|
|
@@ -18,7 +17,8 @@ def get_ld(
|
|
|
18
17
|
skipND: Optional[int] = 1,
|
|
19
18
|
context: Optional[Dict] = None) -> rdflib.Graph:
|
|
20
19
|
"""Return the HDF file content as a rdflib.Graph object."""
|
|
21
|
-
|
|
20
|
+
if file_uri and not (str(file_uri)).endswith("#"):
|
|
21
|
+
file_uri = f"{file_uri}#"
|
|
22
22
|
graph = None
|
|
23
23
|
with h5py.File(hdf_filename) as h5:
|
|
24
24
|
if contextual and structural:
|
|
@@ -50,8 +50,61 @@ def hdf2jsonld(
|
|
|
50
50
|
file_uri: Optional[str] = None,
|
|
51
51
|
skipND: Optional[int] = 1,
|
|
52
52
|
):
|
|
53
|
+
return _hdf2ld(
|
|
54
|
+
filename=filename,
|
|
55
|
+
fmt='json-ld',
|
|
56
|
+
metadata_filename=metadata_filename,
|
|
57
|
+
context=context,
|
|
58
|
+
structural=structural,
|
|
59
|
+
contextual=contextual,
|
|
60
|
+
indent=indent,
|
|
61
|
+
file_uri=file_uri,
|
|
62
|
+
skipND=skipND,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def hdf2ttl(
|
|
67
|
+
filename: Union[str, pathlib.Path],
|
|
68
|
+
metadata_filename: Optional[Union[str, pathlib.Path]] = None,
|
|
69
|
+
context: Optional[dict] = None,
|
|
70
|
+
structural: bool = True,
|
|
71
|
+
contextual: bool = True,
|
|
72
|
+
indent: int = 2,
|
|
73
|
+
file_uri: Optional[str] = None,
|
|
74
|
+
skipND: Optional[int] = 1,
|
|
75
|
+
):
|
|
76
|
+
return _hdf2ld(
|
|
77
|
+
filename=filename,
|
|
78
|
+
fmt='ttl',
|
|
79
|
+
metadata_filename=metadata_filename,
|
|
80
|
+
context=context,
|
|
81
|
+
structural=structural,
|
|
82
|
+
contextual=contextual,
|
|
83
|
+
indent=indent,
|
|
84
|
+
file_uri=file_uri,
|
|
85
|
+
skipND=skipND,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _hdf2ld(
|
|
90
|
+
filename: Union[str, pathlib.Path],
|
|
91
|
+
fmt: str,
|
|
92
|
+
metadata_filename: Optional[Union[str, pathlib.Path]] = None,
|
|
93
|
+
context: Optional[dict] = None,
|
|
94
|
+
structural: bool = True,
|
|
95
|
+
contextual: bool = True,
|
|
96
|
+
indent: int = 2,
|
|
97
|
+
file_uri: Optional[str] = None,
|
|
98
|
+
skipND: Optional[int] = 1,
|
|
99
|
+
):
|
|
100
|
+
if fmt in ('json', 'json-ld', 'jsonld'):
|
|
101
|
+
suffix = '.jsonld'
|
|
102
|
+
elif fmt in ('turtle', 'ttl'):
|
|
103
|
+
suffix = '.ttl'
|
|
104
|
+
else:
|
|
105
|
+
raise ValueError(f"Format '{fmt}' currently not supported. Use 'json-ld' or 'ttl'.")
|
|
53
106
|
if metadata_filename is None:
|
|
54
|
-
metadata_filename = pathlib.Path(filename).with_suffix(
|
|
107
|
+
metadata_filename = pathlib.Path(filename).with_suffix(suffix) # recommended suffix for JSON-LD is .jsonld!
|
|
55
108
|
else:
|
|
56
109
|
metadata_filename = pathlib.Path(metadata_filename)
|
|
57
110
|
|
|
@@ -67,7 +120,7 @@ def hdf2jsonld(
|
|
|
67
120
|
|
|
68
121
|
with open(metadata_filename, 'w', encoding='utf-8') as f:
|
|
69
122
|
f.write(
|
|
70
|
-
graph.serialize(format=
|
|
123
|
+
graph.serialize(format=fmt,
|
|
71
124
|
indent=indent,
|
|
72
125
|
auto_compact=True,
|
|
73
126
|
context=context)
|