Skip to content

Commit 6859554

Browse files
authored
Pre 6.2 (#239)
* minor version info changes * add Graham to author list * Minor docs changes.
1 parent 2f5c6eb commit 6859554

File tree

7 files changed

+78
-20
lines changed

7 files changed

+78
-20
lines changed

docs/source/devdocs.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Developer documentation
22
-----------------------
33

4+
.. note::
5+
6+
If you want to use yadg in your project, you probably want to see :ref:`the API of the extractor mode <extractor api>` or process a `dataschema` using :func:`yadg.core.process_schema`.
7+
48
The project follows fairly standard developer practices. Every new feature should be associated with a test, and every PR requires linting and formatting using ``ruff``.
59

610
Testing
@@ -23,4 +27,4 @@ Implementing new features
2327
- adding their schema into :class:`dgbowl_schemas.yadg.dataschema.DataSchema`
2428
- adding their implementation in a separate Python package under :mod:`yadg.extractors`
2529

26-
Each extractor should be documented by adding a structured docstring at the top of the file. This documentation should describe the application and usage of the extractor, and refer to the Pydantic audotocs via :obj:`~dgbowl_schemas.yadg.dataschema` to discuss the features exposed via the parameters dictionary. If the filetype extracted is binary, a description of the file structure should be provided in the docstring. Every new filetype will have to be added into the :mod:`~dgbowl_schemas.yadg.dataschema.filetype` module as well.
30+
Each extractor should be documented by adding a structured docstring at the top of the file. This documentation should describe the application and usage of the extractor, and refer to the Pydantic audotocs via :obj:`~dgbowl_schemas.yadg.dataschema` to discuss the features exposed via the parameters dictionary. If the filetype extracted is binary, a description of the file structure should be provided in the docstring. Every new filetype will have to be added into the :mod:`~dgbowl_schemas.yadg.dataschema.filetype` module as well.

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Contributors
1818
- `Peter Kraus <https://github.com/PeterKraus>`_
1919
- `Nicolas Vetsch <https://github.com/vetschn>`_
2020
- `Carla Terboven <https://github.com/carla-terboven>`_
21+
- `Graham Kimbell <https://github.com/g-kimbell>`_
2122

2223
Acknowledgements
2324
````````````````

docs/source/usage.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ The ``infile`` will be then parsed using **yadg** into a :class:`~xarray.DataTre
4040
4141
yadg extract --locale=de_DE --encoding=utf-8 --timezone=Europe/Berlin filetype infile [outfile]
4242
43+
.. _extractor api:
44+
45+
API endpoint for `extractor` mode
46+
`````````````````````````````````
47+
If you want to use **yadg** in your own code, you should use the common extractors API available in the :mod:`yadg.extractors` module:
48+
49+
.. autofunction:: yadg.extractors.extract
50+
:no-index:
51+
52+
.. autofunction:: yadg.extractors.extract_from_path
53+
:no-index:
54+
55+
.. autofunction:: yadg.extractors.extract_from_bytes
56+
:no-index:
57+
58+
.. warning::
59+
60+
Please do not use the :func:`extract` functions from each extractor (e.g. :func:`yadg.extractors.eclab.mpr.extract_from_path`) directly. Those are not part of the user-facing API and their function signatures may change between minor or point versions.
61+
4362

4463
Metadata-only extraction
4564
````````````````````````
@@ -103,6 +122,13 @@ If you'd like to update a `dataschema` from a previous version of **yadg** to th
103122
104123
This will update the `dataschema` specified in ``infile`` and save it to ``outfile``, if provided.
105124

125+
API for processing `dataschema`
126+
```````````````````````````````
127+
128+
129+
.. autofunction:: yadg.core.process_schema
130+
:no-index:
131+
106132

107133
.. _NetCDF: https://www.unidata.ucar.edu/software/netcdf/
108134

docs/source/version.6_2.rst

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
**yadg** version next
2-
`````````````````````
3-
..
4-
.. image:: https://img.shields.io/static/v1?label=yadg&message=v6.1&color=blue&logo=github
5-
:target: https://github.com/PeterKraus/yadg/tree/6.1
6-
.. image:: https://img.shields.io/static/v1?label=yadg&message=v6.1&color=blue&logo=pypi
7-
:target: https://pypi.org/project/yadg/6.1/
8-
.. image:: https://img.shields.io/static/v1?label=release%20date&message=2025-06-03&color=red&logo=pypi
1+
**yadg** version 6.2
2+
````````````````````
93

4+
.. image:: https://img.shields.io/static/v1?label=yadg&message=v6.2&color=blue&logo=github
5+
:target: https://github.com/PeterKraus/yadg/tree/6.2
6+
.. image:: https://img.shields.io/static/v1?label=yadg&message=v6.2&color=blue&logo=pypi
7+
:target: https://pypi.org/project/yadg/6.2/
8+
.. image:: https://img.shields.io/static/v1?label=release%20date&message=2025-08-20&color=red&logo=pypi
109

11-
Developed in the `ConCat Lab <https://tu.berlin/en/concat>`_ at Technische Universität Berlin (Berlin, DE).
12-
13-
New features in ``yadg-next`` are:
1410

11+
Developed in the `ConCat Lab <https://tu.berlin/en/concat>`_ at Technische Universität Berlin (Berlin, DE).
1512

16-
Breaking changes in ``yadg-next`` are:
13+
Breaking changes in ``yadg-6.2`` are:
1714

1815
- Some column names in :mod:`yadg.extractors.eclab.mpr` files might have changed, as EC-Lab 11.62 has a new naming convention for derived quantities. In particular:
1916

@@ -22,7 +19,7 @@ Breaking changes in ``yadg-next`` are:
2219
- ``P`` is now ``Pwe``,
2320
- ``R`` is now ``Rwe``.
2421

25-
This will also unfortunately affect processing older ``mpr`` files. Depending on which version of EC-Lab was used to convert the ``mpr`` file to the ``mpt`` file, the ``mpt`` file will contain the old (i.e. ``P`` or ``Energy charge``) or the new (i.e. ``Pwe`` or ``Energy we charge``) column names. For yadg internal consistency testing, we still attempt an exact match between ``mpr`` and ``mpt`` columns; if the ``mpr`` column is not present in the ``mpt`` file, we look for an equivalent column without the ``we`` annotation.
22+
This will also unfortunately affect processing older ``mpr`` files. Depending on which version of EC-Lab was used to convert the ``mpr`` file to the ``mpt`` file, the ``mpt`` file will contain the old (i.e. ``P`` or ``Energy charge``) or the new (i.e. ``Pwe`` or ``Energy we charge``) column names. For yadg internal test-suite, we still attempt an exact match between ``mpr`` and ``mpt`` columns; if the ``mpr`` column is not present in the ``mpt`` file, we look for an equivalent column without the ``we`` annotation.
2623

2724
- The ``control/V/mA`` column and the ``mode`` column in :mod:`~yadg.extractors.eclab.mpr` as well as :mod:`~yadg.extractors.eclab.mpr` files is now used to create the ``control_V`` (units ``V``) and ``control_I`` (units ``mA``) columns in both kinds of files:
2825

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ build-backend = "setuptools.build_meta"
66
dynamic = ["version"]
77
name = "yadg"
88
authors = [
9-
{name = "Peter Kraus", email = "peter.kraus@tu-berlin.de"},
9+
{name = "Peter Kraus"},
1010
{name = "Nicolas Vetsch"},
1111
{name = "Carla Terboven"},
12+
{name = "Graham Kimbell"},
1213
]
1314
maintainers = [
1415
{name = "Peter Kraus", email = "peter.kraus@tu-berlin.de"},

src/yadg/core.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,21 @@
1111

1212
def process_schema(dataschema: DataSchema, strict_merge: bool = False) -> DataTree:
1313
"""
14-
The main processing function of yadg.
14+
The main :class:`DataSchema` processing function of yadg.
1515
16-
Takes in a :class:`DataSchema` object and returns a single :class:`DataTree` created
17-
from the :class:`DataSchema`.
16+
Takes in a :class:`DataSchema` object, updates it to the latest version compatible
17+
with the installed version of yadg, processes each `step`, and returns a single
18+
:class:`DataTree` created from the :class:`DataSchema`.
19+
20+
Parameters
21+
----------
22+
23+
dataschema:
24+
A :class:`DataSchema` object describing the extraction process.
25+
26+
strict_merge:
27+
A :class:`bool` indicating whether metadata of the files processed in a single `step`
28+
has to be identical. Defaults to ``False`` which means conflicts will be dropped.
1829
1930
"""
2031
if strict_merge:

src/yadg/extractors/__init__.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def extract(
4747
Extract data and metadata from a path using the supplied filetype.
4848
4949
A wrapper around the :func:`extract_from_path` worker function, which creates a
50-
default extractor object. Coerces any :class:`str` provided to :class:`Path`.
50+
default extractor object. Coerces any :class:`str`s provided as ``path`` to :class:`Path`.
5151
5252
Parameters
5353
----------
@@ -56,7 +56,7 @@ def extract(
5656
Specifies the filetype. Has to be a filetype supported by the dataschema.
5757
5858
path:
59-
A :class:`pathlib.Path` object pointing to the file to be extracted.
59+
A :class:`Path` object pointing to the file to be extracted.
6060
6161
timezone:
6262
A :class:`str` containing the TZ identifier, e.g. "Europe/Berlin".
@@ -93,6 +93,15 @@ def extract_from_path(
9393
the returned objects are flattened using json serialisation. The returned objects
9494
have a :func:`to_netcdf` as well as a :func:`to_dict` method, which can be used to
9595
write the returned object into a file.
96+
97+
Parameters
98+
----------
99+
100+
source:
101+
A :obj:`Path` pointing to the extracted file.
102+
103+
extractor:
104+
A :class:`FileType` object describing the extraction process.
96105
"""
97106

98107
m = importlib.import_module(f"yadg.extractors.{extractor.filetype}")
@@ -127,6 +136,15 @@ def extract_from_bytes(
127136
the returned objects are flattened using json serialisation. The returned objects
128137
have a :func:`to_netcdf` as well as a :func:`to_dict` method, which can be used to
129138
write the returned object into a file.
139+
140+
Parameters
141+
----------
142+
143+
source:
144+
A :obj:`bytes` object containing the raw data to be extracted.
145+
146+
extractor:
147+
A :class:`FileType` object describing the extraction process.
130148
"""
131149

132150
m = importlib.import_module(f"yadg.extractors.{extractor.filetype}")

0 commit comments

Comments
 (0)