defair-ops 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_ops-0.4.0rc2/LICENSE +175 -0
- defair_ops-0.4.0rc2/PKG-INFO +42 -0
- defair_ops-0.4.0rc2/README.md +1 -0
- defair_ops-0.4.0rc2/pyproject.toml +88 -0
- defair_ops-0.4.0rc2/src/defair_ops/__init__.py +36 -0
- defair_ops-0.4.0rc2/src/defair_ops/core.py +139 -0
- defair_ops-0.4.0rc2/src/defair_ops/eda.py +542 -0
- defair_ops-0.4.0rc2/src/defair_ops/geometry/__init__.py +22 -0
- defair_ops-0.4.0rc2/src/defair_ops/geometry/latlon.py +403 -0
- defair_ops-0.4.0rc2/src/defair_ops/handlers.py +180 -0
- defair_ops-0.4.0rc2/src/defair_ops/logging.py +34 -0
- defair_ops-0.4.0rc2/src/defair_ops/py.typed +0 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/__init__.py +17 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/alignment/__init__.py +23 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/alignment/alignment_plugin.py +2163 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/angles/__init__.py +19 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/angles/_solar.py +70 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/angles/angles_plugin.py +401 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/content_filter/__init__.py +21 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/content_filter/content_filter.py +256 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/mask_filter/__init__.py +21 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/mask_filter/mask_filter_plugin.py +872 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/rasterise/__init__.py +24 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/rasterise/rasterise_plugin.py +403 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/__init__.py +62 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/_authalic.py +145 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/_conservative_weights.py +729 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/_conservative_weights_numba.py +556 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/_geostationary_image_plane.py +505 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/_healpix_resamplers.py +1580 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/_native_geostationary_numba.py +85 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/_sinusoidal.py +159 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/astropy_healpix_backend.py +1612 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/base.py +470 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/conservative_backend.py +1059 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/rioxarray_backend.py +1932 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/backends/swath_resampling_backend.py +2437 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/geometry_validation.py +619 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/reprojection/reprojection.py +1378 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/spatial_filter/__init__.py +22 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/spatial_filter/_projection_window.py +324 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/spatial_filter/spatial_filter_plugin.py +2183 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/temporal_aggregate/__init__.py +23 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/temporal_aggregate/temporal_aggregate.py +799 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/temporal_filter/__init__.py +21 -0
- defair_ops-0.4.0rc2/src/defair_ops/transformations/temporal_filter/temporal_filter.py +241 -0
|
@@ -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.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: defair-ops
|
|
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
|
|
26
|
+
Requires-Dist: defair-data
|
|
27
|
+
Requires-Dist: astropy>=6.1.7
|
|
28
|
+
Requires-Dist: astropy-healpix>=1.1.2
|
|
29
|
+
Requires-Dist: loguru>=0.7.3
|
|
30
|
+
Requires-Dist: shapely>=2.0.0
|
|
31
|
+
Requires-Dist: geopandas>=1.1.2
|
|
32
|
+
Requires-Dist: pyproj>=3.0.0
|
|
33
|
+
Requires-Dist: pyresample>=1.31.0
|
|
34
|
+
Requires-Dist: pykdtree>=1.3.7
|
|
35
|
+
Requires-Dist: psutil>=7.1.1
|
|
36
|
+
Requires-Dist: scipy>=1.15.3
|
|
37
|
+
Requires-Dist: numba>=0.60
|
|
38
|
+
Requires-Dist: pyorbital>=1.12
|
|
39
|
+
Requires-Python: >=3.10
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# Defair Ops
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Defair Ops
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Copyright 2025 EUMETSAT
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
[project]
|
|
16
|
+
name = "defair-ops"
|
|
17
|
+
version = "0.4.0rc2"
|
|
18
|
+
description = "Destination Earth Framework for preparing AI-Ready data"
|
|
19
|
+
readme = "README.md"
|
|
20
|
+
authors = [
|
|
21
|
+
{ name = "Dusan Figala", email = "dusan@oxidian.com" },
|
|
22
|
+
{ name = "Erwan Fassot", email = "erwan@oxidian.com" }
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 3 - Alpha",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"License :: OSI Approved :: Apache Software License",
|
|
28
|
+
"Intended Audience :: Education",
|
|
29
|
+
"Intended Audience :: Science/Research",
|
|
30
|
+
"Topic :: Scientific/Engineering",
|
|
31
|
+
"Topic :: Scientific/Engineering :: GIS",
|
|
32
|
+
"Topic :: Software Development",
|
|
33
|
+
"Topic :: Software Development :: Libraries",
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
36
|
+
"Programming Language :: Python :: 3.10",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"Programming Language :: Python :: 3.13",
|
|
40
|
+
]
|
|
41
|
+
keywords = ["eumetsat", "defair", "destine", "destination earth", "machine learning", "earth observation"]
|
|
42
|
+
license = "Apache-2.0"
|
|
43
|
+
license-files = ["LICENSE"]
|
|
44
|
+
requires-python = ">=3.10"
|
|
45
|
+
dependencies = [
|
|
46
|
+
"defair",
|
|
47
|
+
"defair-data",
|
|
48
|
+
"astropy>=6.1.7",
|
|
49
|
+
"astropy-healpix>=1.1.2",
|
|
50
|
+
"loguru>=0.7.3",
|
|
51
|
+
"shapely>=2.0.0",
|
|
52
|
+
"geopandas>=1.1.2",
|
|
53
|
+
"pyproj>=3.0.0",
|
|
54
|
+
"pyresample>=1.31.0",
|
|
55
|
+
"pykdtree>=1.3.7",
|
|
56
|
+
"psutil>=7.1.1",
|
|
57
|
+
"scipy>=1.15.3",
|
|
58
|
+
"numba>=0.60",
|
|
59
|
+
"pyorbital>=1.12",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[project.entry-points."defair_ops.reprojection_backends"]
|
|
63
|
+
swath_resampling = "defair_ops.transformations.reprojection.backends.swath_resampling_backend:SwathResamplingBackend"
|
|
64
|
+
rioxarray = "defair_ops.transformations.reprojection.backends.rioxarray_backend:RioxarrayBackend"
|
|
65
|
+
astropy_healpix = "defair_ops.transformations.reprojection.backends.astropy_healpix_backend:AstropyHealpixBackend"
|
|
66
|
+
conservative = "defair_ops.transformations.reprojection.backends.conservative_backend:ConservativeRegridBackend"
|
|
67
|
+
|
|
68
|
+
[project.entry-points."defair_ops.transformations"]
|
|
69
|
+
angles = "defair_ops.transformations.angles:AnglesPlugin"
|
|
70
|
+
content_filter = "defair_ops.transformations.content_filter:ContentFilterPlugin"
|
|
71
|
+
temporal_filter = "defair_ops.transformations.temporal_filter:TemporalFilterPlugin"
|
|
72
|
+
temporal_aggregate = "defair_ops.transformations.temporal_aggregate:TemporalAggregationPlugin"
|
|
73
|
+
spatial_filter = "defair_ops.transformations.spatial_filter.spatial_filter_plugin:SpatialFilterPlugin"
|
|
74
|
+
mask_filter = "defair_ops.transformations.mask_filter.mask_filter_plugin:MaskFilterPlugin"
|
|
75
|
+
rasterise = "defair_ops.transformations.rasterise.rasterise_plugin:RasterisePlugin"
|
|
76
|
+
reprojection = "defair_ops.transformations.reprojection.reprojection:Reprojection"
|
|
77
|
+
alignment = "defair_ops.transformations.alignment:AlignmentPlugin"
|
|
78
|
+
|
|
79
|
+
[build-system]
|
|
80
|
+
requires = ["uv_build>=0.8.11,<0.9.0"]
|
|
81
|
+
build-backend = "uv_build"
|
|
82
|
+
|
|
83
|
+
[dependency-groups]
|
|
84
|
+
dev = []
|
|
85
|
+
|
|
86
|
+
[tool.uv.sources]
|
|
87
|
+
defair = { workspace = true }
|
|
88
|
+
defair-data = { workspace = true }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2026 EUMETSAT
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from importlib.metadata import version
|
|
20
|
+
|
|
21
|
+
import loguru
|
|
22
|
+
from loguru import logger
|
|
23
|
+
|
|
24
|
+
__version__ = version("defair-ops")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_logger(name: str) -> loguru.Logger:
|
|
28
|
+
"""Get a Loguru logger bound to a specific module name.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
name: Name of the module (typically __name__).
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
Loguru logger instance bound to the module name.
|
|
35
|
+
"""
|
|
36
|
+
return logger.bind(name=name)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2026 EUMETSAT
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
import threading
|
|
18
|
+
from abc import ABC, abstractmethod
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
21
|
+
from defair_data.core import Dataset
|
|
22
|
+
from defair_data.dask_manager import DaskClientManager
|
|
23
|
+
|
|
24
|
+
from defair_ops import get_logger
|
|
25
|
+
|
|
26
|
+
logger = get_logger(__name__)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class TransformationPlugin(ABC):
|
|
30
|
+
"""Abstract base class for transformation plugins."""
|
|
31
|
+
|
|
32
|
+
def __init__(self, dask_client_kwargs: dict[str, Any] | None = None):
|
|
33
|
+
"""Initialize the transformation plugin.
|
|
34
|
+
|
|
35
|
+
Construction is lazy by default: no Dask client is created until
|
|
36
|
+
a code path explicitly asks for it via the ``dask_client``
|
|
37
|
+
property.
|
|
38
|
+
|
|
39
|
+
Without a distributed client, compute runs on Dask's bare threaded
|
|
40
|
+
scheduler — no worker-memory monitoring, no spill-to-disk, no
|
|
41
|
+
adaptive scaling. That is fine for small in-memory transforms but
|
|
42
|
+
memory-bound work (e.g. large reprojections that previously
|
|
43
|
+
spilled under the eager-LocalCluster default) can OOM. Pass a
|
|
44
|
+
non-empty ``dask_client_kwargs`` dict to acquire a distributed
|
|
45
|
+
client eagerly and restore OOM protection — the kwargs go to
|
|
46
|
+
``dask.distributed.Client(**kwargs)``. An empty dict / ``None``
|
|
47
|
+
keeps the lazy contract.
|
|
48
|
+
"""
|
|
49
|
+
self._dask_client_kwargs = dask_client_kwargs or {}
|
|
50
|
+
self._dask_manager: DaskClientManager | None = DaskClientManager()
|
|
51
|
+
self._dask_client = None
|
|
52
|
+
self._dask_client_acquired = False
|
|
53
|
+
self._client_lock = threading.Lock()
|
|
54
|
+
if self._dask_client_kwargs:
|
|
55
|
+
# Explicit configuration from the caller — honour it eagerly.
|
|
56
|
+
_ = self.dask_client
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def dask_client(self):
|
|
60
|
+
"""Return the Dask client, acquiring it lazily on first access."""
|
|
61
|
+
if self._dask_client_acquired:
|
|
62
|
+
return self._dask_client
|
|
63
|
+
with self._client_lock:
|
|
64
|
+
if self._dask_client_acquired:
|
|
65
|
+
return self._dask_client
|
|
66
|
+
if self._dask_manager is None:
|
|
67
|
+
self._dask_manager = DaskClientManager()
|
|
68
|
+
self._dask_client = self._dask_manager.acquire_client(**self._dask_client_kwargs)
|
|
69
|
+
self._dask_client_acquired = True
|
|
70
|
+
return self._dask_client
|
|
71
|
+
|
|
72
|
+
def _release_dask_client(self) -> None:
|
|
73
|
+
"""Release the Dask client reference count.
|
|
74
|
+
|
|
75
|
+
No-op when the transformation never acquired a client. For
|
|
76
|
+
plugins that did acquire, the reference is kept alive across
|
|
77
|
+
successive or concurrent calls.
|
|
78
|
+
"""
|
|
79
|
+
if not self._dask_client_acquired:
|
|
80
|
+
return
|
|
81
|
+
if self._dask_manager is not None:
|
|
82
|
+
self._dask_manager.release_client()
|
|
83
|
+
if logger is not None:
|
|
84
|
+
logger.debug("Released Dask client")
|
|
85
|
+
|
|
86
|
+
def __enter__(self):
|
|
87
|
+
"""Context manager entry."""
|
|
88
|
+
return self
|
|
89
|
+
|
|
90
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
91
|
+
"""Context manager exit"""
|
|
92
|
+
self._release_dask_client()
|
|
93
|
+
return False
|
|
94
|
+
|
|
95
|
+
def __del__(self):
|
|
96
|
+
"""Destructor"""
|
|
97
|
+
self._release_dask_client()
|
|
98
|
+
|
|
99
|
+
@abstractmethod
|
|
100
|
+
def transform(
|
|
101
|
+
self,
|
|
102
|
+
dataset: Dataset,
|
|
103
|
+
target: str | None = None,
|
|
104
|
+
) -> Dataset:
|
|
105
|
+
"""Transform the dataset.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
dataset: Input dataset to transform
|
|
109
|
+
target: Target specification (CRS, grid, etc.). Optional for some transformations.
|
|
110
|
+
|
|
111
|
+
Note:
|
|
112
|
+
Subclasses may define additional parameters for transformation-specific
|
|
113
|
+
options (e.g., resampling method, bounds, etc.).
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
Transformed dataset
|
|
117
|
+
"""
|
|
118
|
+
raise NotImplementedError("Implement me!")
|
|
119
|
+
|
|
120
|
+
def execute(self, dataset: Dataset, **kwargs: Any) -> Dataset:
|
|
121
|
+
"""Execute the transformation.
|
|
122
|
+
|
|
123
|
+
This is a wrapper method that calls transform() with the appropriate parameters.
|
|
124
|
+
It provides a consistent interface for the workflow executor while allowing
|
|
125
|
+
subclasses to implement the specific transform() method.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
dataset: Input dataset to transform
|
|
129
|
+
**kwargs: Operation-specific parameters (e.g., target, resampling, resolution, etc.)
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
Transformed dataset
|
|
133
|
+
"""
|
|
134
|
+
return self.transform(dataset=dataset, **kwargs)
|
|
135
|
+
|
|
136
|
+
@property
|
|
137
|
+
@abstractmethod
|
|
138
|
+
def name(self) -> str:
|
|
139
|
+
pass
|