defair 0.4.0rc2__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.
- defair-0.4.0rc2/LICENSE +175 -0
- defair-0.4.0rc2/PKG-INFO +295 -0
- defair-0.4.0rc2/README.md +249 -0
- defair-0.4.0rc2/pyproject.toml +244 -0
- defair-0.4.0rc2/src/defair/__init__.py +26 -0
- defair-0.4.0rc2/src/defair/__main__.py +18 -0
- defair-0.4.0rc2/src/defair/cf_history_mixin.py +478 -0
- defair-0.4.0rc2/src/defair/cf_metadata.py +208 -0
- defair-0.4.0rc2/src/defair/cli/__init__.py +38 -0
- defair-0.4.0rc2/src/defair/cli/constants.py +22 -0
- defair-0.4.0rc2/src/defair/cli/eda.py +131 -0
- defair-0.4.0rc2/src/defair/cli/main.py +125 -0
- defair-0.4.0rc2/src/defair/cli/readers.py +68 -0
- defair-0.4.0rc2/src/defair/cli/run.py +132 -0
- defair-0.4.0rc2/src/defair/cli/validate.py +87 -0
- defair-0.4.0rc2/src/defair/cli/version.py +31 -0
- defair-0.4.0rc2/src/defair/execute.py +272 -0
- defair-0.4.0rc2/src/defair/kwargs_validation.py +273 -0
- defair-0.4.0rc2/src/defair/logging.py +273 -0
- defair-0.4.0rc2/src/defair/models/__init__.py +15 -0
- defair-0.4.0rc2/src/defair/models/workflow.py +643 -0
- defair-0.4.0rc2/src/defair/plugin_manager.py +385 -0
- defair-0.4.0rc2/src/defair/profiling.py +513 -0
defair-0.4.0rc2/LICENSE
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
defair-0.4.0rc2/PKG-INFO
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: defair
|
|
3
|
+
Version: 0.4.0rc2
|
|
4
|
+
Summary: Destination Earth Framework for preparing AI-Ready data
|
|
5
|
+
Keywords: eumetsat,defair,destine,destination earth,machine learning,earth observation
|
|
6
|
+
Author: Dusan Figala, Erwan Fassot
|
|
7
|
+
Author-email: Dusan Figala <dusan@oxidian.com>, Erwan Fassot <erwan@oxidian.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
17
|
+
Classifier: Topic :: Software Development
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Requires-Dist: defair-ops
|
|
26
|
+
Requires-Dist: defair-data
|
|
27
|
+
Requires-Dist: typer>=0.19.2
|
|
28
|
+
Requires-Dist: loguru>=0.7.3
|
|
29
|
+
Requires-Dist: h5netcdf>=1.6.4
|
|
30
|
+
Requires-Dist: pydantic>=2.12.3
|
|
31
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
32
|
+
Requires-Dist: psutil>=7.1.1
|
|
33
|
+
Requires-Dist: bokeh>=3.8.2
|
|
34
|
+
Requires-Dist: urllib3>=2.6.3
|
|
35
|
+
Requires-Dist: aiohttp>=3.13.3
|
|
36
|
+
Requires-Dist: dask-gateway>=2023.1.1
|
|
37
|
+
Requires-Dist: satpy>=0.60 ; python_full_version >= '3.11' and extra == 'benchmark'
|
|
38
|
+
Requires-Dist: pyresample>=1.28 ; extra == 'benchmark'
|
|
39
|
+
Requires-Dist: matplotlib>=3.10,<3.11 ; extra == 'benchmark'
|
|
40
|
+
Requires-Dist: python-geotiepoints>=1.7.5 ; extra == 'benchmark'
|
|
41
|
+
Requires-Dist: cartopy>=0.25.0 ; extra == 'visualization'
|
|
42
|
+
Requires-Python: >=3.10
|
|
43
|
+
Provides-Extra: benchmark
|
|
44
|
+
Provides-Extra: visualization
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
# DEFAIR
|
|
48
|
+
|
|
49
|
+
DEFAIR (Destination Earth Framework for preparing AI-Ready data) reads,
|
|
50
|
+
transforms, aligns, and writes meteorological and Earth-observation data as
|
|
51
|
+
Dask-backed xarray datasets. Its plugin system supports EUMETSAT product
|
|
52
|
+
readers, local and S3-compatible storage, geospatial transformations, and
|
|
53
|
+
NetCDF/Zarr output.
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
DEFAIR requires Python 3.10 or later. Install a supplied wheel bundle into a
|
|
58
|
+
virtual environment:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python -m venv .venv
|
|
62
|
+
source .venv/bin/activate
|
|
63
|
+
python -m pip install /path/to/dist/*.whl
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For development from a source checkout, install the uv-managed workspace:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
make install
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
DEFAIR releases frequently. Pin the exact version in reproducible pipelines
|
|
73
|
+
and check the release notes, which list the resolved ticket numbers, before
|
|
74
|
+
upgrading.
|
|
75
|
+
|
|
76
|
+
## First dataset
|
|
77
|
+
|
|
78
|
+
`Dataset.from_source()` accepts a local path, an S3 URI, a glob, or an explicit
|
|
79
|
+
list of paths. The reader and source plugins are auto-detected when possible.
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from defair_data import Dataset
|
|
83
|
+
|
|
84
|
+
dataset = Dataset.from_source(
|
|
85
|
+
"/data/MSG3-SEVI-MSG15-product.nat",
|
|
86
|
+
reader="msg15nat",
|
|
87
|
+
channels=["IR_108"],
|
|
88
|
+
calibration="brightness_temperature",
|
|
89
|
+
use_channel_names=True,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
print(dataset.data)
|
|
93
|
+
dataset.to_file("output/msg.zarr", writer="zarrv2")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Reader results are Dask-backed by default. Do not pass the removed `use_dask`
|
|
97
|
+
argument.
|
|
98
|
+
|
|
99
|
+
## S3 source selection
|
|
100
|
+
|
|
101
|
+
For an `s3://` URI, omitting `source` auto-selects `source="s3"`. This is the
|
|
102
|
+
s3fs/fsspec-backed plugin and is the normal choice for xarray and Dask
|
|
103
|
+
workflows. `source="s3boto"` selects the direct boto3 plugin for source-level
|
|
104
|
+
operations such as range-based file access, listing, and globbing.
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
dataset = Dataset.from_source(
|
|
108
|
+
"s3://bucket/path/product.nc",
|
|
109
|
+
source="s3", # optional: this is the auto-detected S3 default
|
|
110
|
+
source_kwargs={
|
|
111
|
+
"endpoint_url": "https://s3.example.com",
|
|
112
|
+
"aws_access_key_id": "...",
|
|
113
|
+
"aws_secret_access_key": "...",
|
|
114
|
+
},
|
|
115
|
+
reader="mtg_fci_l1c_nc",
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Both plugins pass the same read settings to xarray. `s3boto` changes how DEFAIR
|
|
120
|
+
lists files and performs direct reads, but xarray readers may still use s3fs.
|
|
121
|
+
See [Data loading, S3, and streaming](docs/data-loading.md) for the differences,
|
|
122
|
+
credential options, and performance settings.
|
|
123
|
+
|
|
124
|
+
## Large multi-file datasets
|
|
125
|
+
|
|
126
|
+
Normal multi-file loading builds one `Dataset`, while reading array data only
|
|
127
|
+
when it is needed. For a large collection of files, use `streaming=True`.
|
|
128
|
+
DEFAIR processes a fixed number of scene groups at a time and appends each
|
|
129
|
+
group to Zarr:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
cube = Dataset.from_source(
|
|
133
|
+
"s3://bucket/archive/*.nc",
|
|
134
|
+
reader="mtg_fci_l1c_nc",
|
|
135
|
+
use_channel_names=True,
|
|
136
|
+
streaming=True,
|
|
137
|
+
stream_batch_size=4,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
cube = cube.transform("content_filter", include_vars=["vis_06", "ir_105"])
|
|
141
|
+
cube.to_file("output/archive.zarr", writer="zarrv2")
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
A streaming plan does not provide `.data`. It records supported transformations
|
|
145
|
+
and writes only to Zarr. Reload the Zarr to inspect the result. Use
|
|
146
|
+
`streaming=False` when you need the complete dataset or an operation that
|
|
147
|
+
combines all files.
|
|
148
|
+
|
|
149
|
+
## Discovering capabilities and reader options
|
|
150
|
+
|
|
151
|
+
List registered plugins and inspect the selected reader's constructor and
|
|
152
|
+
`read()` signatures. Options from both signatures can be passed through
|
|
153
|
+
`Dataset.from_source()`. IDE completion on `from_source()` shows only its
|
|
154
|
+
common parameters because reader-specific options travel through `**kwargs`:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from inspect import signature
|
|
158
|
+
|
|
159
|
+
from defair.plugin_manager import list_readers, list_sources, load_reader
|
|
160
|
+
|
|
161
|
+
print(list_sources())
|
|
162
|
+
print(list_readers())
|
|
163
|
+
|
|
164
|
+
reader = load_reader("msg15nat")
|
|
165
|
+
print(signature(type(reader))) # calibration, chunks, use_channel_names, ...
|
|
166
|
+
print(signature(reader.read)) # channels, lazy_coordinates, ...
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
To resolve a reader short name to its product name and EUMETSAT collection ID, use
|
|
170
|
+
`describe_readers()` (or `defair readers` on the command line):
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from defair_data.readers import describe_readers, get_reader_info
|
|
174
|
+
|
|
175
|
+
print(describe_readers())
|
|
176
|
+
print(get_reader_info("mtg_fci_l2_amv")) # EO:EUM:DAT:0676
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The full table is in `docs/reader-catalogue.md`.
|
|
180
|
+
|
|
181
|
+
The current API supports `use_channel_names`, but not `use_channel_times`.
|
|
182
|
+
Each reader creates the time coordinates required by its product. Reader
|
|
183
|
+
arguments are validated against the reader's declared parameters, so an
|
|
184
|
+
unrecognised option raises and lists the accepted arguments rather than being
|
|
185
|
+
ignored. This applies to third-party reader plugins too: a `**kwargs` catch-all
|
|
186
|
+
on `read()` no longer widens what a reader accepts, so declare every supported
|
|
187
|
+
option by name.
|
|
188
|
+
|
|
189
|
+
## Documentation
|
|
190
|
+
|
|
191
|
+
- [Getting started](docs/what-is-defair.md): what DEFAIR is, installation, a first product and a first workflow
|
|
192
|
+
- [Data loading, S3, streaming, and reader options](docs/data-loading.md)
|
|
193
|
+
- [Workflow examples](docs/workflow-examples.md)
|
|
194
|
+
- [Dask cluster recommendations](docs/dask-cluster-recommendations.md)
|
|
195
|
+
- [Performance benchmarks](docs/benchmarks.md)
|
|
196
|
+
- [Demonstration notebooks](docs/demos/)
|
|
197
|
+
- [Collocation AI use case](packages/defair-ai-demo/msg_mtg_era5_collocation_ai_usecase.ipynb),
|
|
198
|
+
the notebook that puts MSG, MTG and ERA5 on one grid and trains a cloud-mask model on it
|
|
199
|
+
- [Reader](docs/reader-plugins.md), [writer](docs/writer-plugins.md), and
|
|
200
|
+
[transformation](docs/transformation-plugins.md) plugin development
|
|
201
|
+
|
|
202
|
+
The command-line entry point also lists the installed commands and options:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
defair --help
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Logging
|
|
209
|
+
|
|
210
|
+
Set logging with CLI flags or environment variables:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
defair --log-level DEBUG version
|
|
214
|
+
defair --log-json version
|
|
215
|
+
defair --log-module-level "defair_data:DEBUG,defair_ops:WARNING" version
|
|
216
|
+
|
|
217
|
+
export DEFAIR_LOG_LEVEL=INFO
|
|
218
|
+
export DEFAIR_LOG_JSON=true
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Python callers can configure logging directly:
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
from defair.logging import setup_logging
|
|
225
|
+
|
|
226
|
+
setup_logging(log_level="INFO", json_output=False)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
The uv workspace contains three publishable packages:
|
|
232
|
+
|
|
233
|
+
- `defair` (`src/defair/`): CLI and workflow orchestration
|
|
234
|
+
- `defair-data` (`packages/defair-data/`): data sources, readers, and writers
|
|
235
|
+
- `defair-ops` (`packages/defair-ops/`): transformations and Dask management
|
|
236
|
+
|
|
237
|
+
These are mutually dependent rather than strictly layered: each imports the other two, so each
|
|
238
|
+
declares the other two, and installing any one of them pulls in the rest. The coupling exists
|
|
239
|
+
because the shared kernel — the entry-point plugin manager, `CFHistoryMixin`, kwargs validation
|
|
240
|
+
and logging — lives in `defair` rather than in a leaf package, so the lower-level packages call
|
|
241
|
+
back up into it. A new cross-package import therefore has to be declared in that package's
|
|
242
|
+
`pyproject.toml`, even though a workspace `uv sync` satisfies it either way.
|
|
243
|
+
|
|
244
|
+
Common development commands:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
make install
|
|
248
|
+
make check
|
|
249
|
+
make test
|
|
250
|
+
make docs
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Add a dependency to a workspace package with:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
uv add --package <defair|defair-data|defair-ops> <dependency_name>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
All Python source files require Apache 2.0 license headers. Run
|
|
260
|
+
`make headers-check` to validate them or `make headers-add` to add missing
|
|
261
|
+
headers.
|
|
262
|
+
|
|
263
|
+
## Release maintenance
|
|
264
|
+
|
|
265
|
+
Build all workspace packages with:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
uv build --all-packages
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Version commands use uv's workspace support:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
uv version --package <defair|defair-data|defair-ops> --bump <major|minor|patch|rc|stable>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
For a patch to an older release, merge the fix to `main`, create a release
|
|
278
|
+
branch from the target tag, cherry-pick the fix, update package versions, and
|
|
279
|
+
tag the patched release.
|
|
280
|
+
|
|
281
|
+
## Building the documentation
|
|
282
|
+
|
|
283
|
+
Build the local Material for MkDocs site with:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
make docs
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
To generate the DEDL ReadTheDocs/Sphinx source tree, run:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
uv run python scripts/generate_docs.py path/to/target/directory
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
[](https://gitlab.eumetsat.int/defair/defair-core/-/commits/main)
|