mapchete-eo 2026.2.0__py3-none-any.whl
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.
- mapchete_eo/__init__.py +1 -0
- mapchete_eo/array/__init__.py +0 -0
- mapchete_eo/array/buffer.py +16 -0
- mapchete_eo/array/color.py +29 -0
- mapchete_eo/array/convert.py +163 -0
- mapchete_eo/base.py +653 -0
- mapchete_eo/blacklist.txt +175 -0
- mapchete_eo/cli/__init__.py +30 -0
- mapchete_eo/cli/bounds.py +22 -0
- mapchete_eo/cli/options_arguments.py +227 -0
- mapchete_eo/cli/s2_brdf.py +77 -0
- mapchete_eo/cli/s2_cat_results.py +130 -0
- mapchete_eo/cli/s2_find_broken_products.py +77 -0
- mapchete_eo/cli/s2_jp2_static_catalog.py +166 -0
- mapchete_eo/cli/s2_mask.py +71 -0
- mapchete_eo/cli/s2_mgrs.py +45 -0
- mapchete_eo/cli/s2_rgb.py +114 -0
- mapchete_eo/cli/s2_verify.py +129 -0
- mapchete_eo/cli/static_catalog.py +82 -0
- mapchete_eo/eostac.py +30 -0
- mapchete_eo/exceptions.py +87 -0
- mapchete_eo/image_operations/__init__.py +12 -0
- mapchete_eo/image_operations/blend_functions.py +579 -0
- mapchete_eo/image_operations/color_correction.py +136 -0
- mapchete_eo/image_operations/compositing.py +266 -0
- mapchete_eo/image_operations/dtype_scale.py +43 -0
- mapchete_eo/image_operations/fillnodata.py +130 -0
- mapchete_eo/image_operations/filters.py +319 -0
- mapchete_eo/image_operations/linear_normalization.py +81 -0
- mapchete_eo/image_operations/sigmoidal.py +114 -0
- mapchete_eo/io/__init__.py +37 -0
- mapchete_eo/io/assets.py +496 -0
- mapchete_eo/io/items.py +162 -0
- mapchete_eo/io/levelled_cubes.py +259 -0
- mapchete_eo/io/path.py +155 -0
- mapchete_eo/io/products.py +423 -0
- mapchete_eo/io/profiles.py +45 -0
- mapchete_eo/platforms/sentinel2/__init__.py +17 -0
- mapchete_eo/platforms/sentinel2/_mapper_registry.py +89 -0
- mapchete_eo/platforms/sentinel2/bandpass_adjustment.py +104 -0
- mapchete_eo/platforms/sentinel2/brdf/__init__.py +8 -0
- mapchete_eo/platforms/sentinel2/brdf/config.py +32 -0
- mapchete_eo/platforms/sentinel2/brdf/correction.py +260 -0
- mapchete_eo/platforms/sentinel2/brdf/hls.py +251 -0
- mapchete_eo/platforms/sentinel2/brdf/models.py +44 -0
- mapchete_eo/platforms/sentinel2/brdf/protocols.py +27 -0
- mapchete_eo/platforms/sentinel2/brdf/ross_thick.py +136 -0
- mapchete_eo/platforms/sentinel2/brdf/sun_angle_arrays.py +76 -0
- mapchete_eo/platforms/sentinel2/config.py +241 -0
- mapchete_eo/platforms/sentinel2/driver.py +43 -0
- mapchete_eo/platforms/sentinel2/masks.py +329 -0
- mapchete_eo/platforms/sentinel2/metadata_parser/__init__.py +6 -0
- mapchete_eo/platforms/sentinel2/metadata_parser/base.py +56 -0
- mapchete_eo/platforms/sentinel2/metadata_parser/default_path_mapper.py +135 -0
- mapchete_eo/platforms/sentinel2/metadata_parser/models.py +78 -0
- mapchete_eo/platforms/sentinel2/metadata_parser/s2metadata.py +639 -0
- mapchete_eo/platforms/sentinel2/preconfigured_sources/__init__.py +57 -0
- mapchete_eo/platforms/sentinel2/preconfigured_sources/guessers.py +108 -0
- mapchete_eo/platforms/sentinel2/preconfigured_sources/item_mappers.py +171 -0
- mapchete_eo/platforms/sentinel2/preconfigured_sources/metadata_xml_mappers.py +217 -0
- mapchete_eo/platforms/sentinel2/preprocessing_tasks.py +50 -0
- mapchete_eo/platforms/sentinel2/processing_baseline.py +163 -0
- mapchete_eo/platforms/sentinel2/product.py +747 -0
- mapchete_eo/platforms/sentinel2/source.py +114 -0
- mapchete_eo/platforms/sentinel2/types.py +114 -0
- mapchete_eo/processes/__init__.py +0 -0
- mapchete_eo/processes/config.py +51 -0
- mapchete_eo/processes/dtype_scale.py +112 -0
- mapchete_eo/processes/eo_to_xarray.py +19 -0
- mapchete_eo/processes/merge_rasters.py +239 -0
- mapchete_eo/product.py +323 -0
- mapchete_eo/protocols.py +61 -0
- mapchete_eo/search/__init__.py +14 -0
- mapchete_eo/search/base.py +285 -0
- mapchete_eo/search/config.py +113 -0
- mapchete_eo/search/s2_mgrs.py +313 -0
- mapchete_eo/search/stac_search.py +278 -0
- mapchete_eo/search/stac_static.py +197 -0
- mapchete_eo/search/utm_search.py +251 -0
- mapchete_eo/settings.py +25 -0
- mapchete_eo/sort.py +60 -0
- mapchete_eo/source.py +109 -0
- mapchete_eo/time.py +62 -0
- mapchete_eo/types.py +76 -0
- mapchete_eo-2026.2.0.dist-info/METADATA +91 -0
- mapchete_eo-2026.2.0.dist-info/RECORD +89 -0
- mapchete_eo-2026.2.0.dist-info/WHEEL +4 -0
- mapchete_eo-2026.2.0.dist-info/entry_points.txt +11 -0
- mapchete_eo-2026.2.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ProductMaskTypes(BaseModel):
|
|
8
|
+
"""Mapping between mask type and respective metadata.xml type key."""
|
|
9
|
+
|
|
10
|
+
classification: Optional[str] = None
|
|
11
|
+
cloud_probability: Optional[str] = None
|
|
12
|
+
snow_probability: Optional[str] = None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BandMaskTypes(BaseModel):
|
|
16
|
+
"""Mapping between band mask type and respective metadata.xml type key."""
|
|
17
|
+
|
|
18
|
+
technical_quality: Optional[str] = None
|
|
19
|
+
detector_footprints: Optional[str] = None
|
|
20
|
+
# deprecated since 04.00
|
|
21
|
+
# nodata: Optional[str] = None
|
|
22
|
+
# defect: Optional[str] = None
|
|
23
|
+
# saturated: Optional[str] = None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ItemMapping(BaseModel):
|
|
27
|
+
"""Configuration of processing baseline keys in metadata.xml."""
|
|
28
|
+
|
|
29
|
+
product_mask_types: ProductMaskTypes
|
|
30
|
+
band_mask_types: BandMaskTypes
|
|
31
|
+
band_mask_extension: str
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# Available product mask types from PB 00.01 until 03.01.
|
|
35
|
+
# "classification" mask was provided as GML, the other two as JP2.
|
|
36
|
+
# Cloud probability and snow probability are available in two separate files for
|
|
37
|
+
# 20m and 60m.
|
|
38
|
+
pre_0400 = ItemMapping(
|
|
39
|
+
product_mask_types=ProductMaskTypes(
|
|
40
|
+
classification="MSK_CLOUDS",
|
|
41
|
+
cloud_probability="MSK_CLDPRB",
|
|
42
|
+
snow_probability="MSK_SNWPRB",
|
|
43
|
+
),
|
|
44
|
+
band_mask_types=BandMaskTypes(
|
|
45
|
+
technical_quality="MSK_TECQUA",
|
|
46
|
+
detector_footprints="MSK_DETFOO",
|
|
47
|
+
),
|
|
48
|
+
band_mask_extension="gml",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# Available product mask types from PB 04.00 onwards.
|
|
53
|
+
# Cloud probability and snow probability are available in two separate files for
|
|
54
|
+
# 20m and 60m.
|
|
55
|
+
post_0400 = ItemMapping(
|
|
56
|
+
product_mask_types=ProductMaskTypes(
|
|
57
|
+
classification="MSK_CLASSI",
|
|
58
|
+
cloud_probability="MSK_CLDPRB",
|
|
59
|
+
snow_probability="MSK_SNWPRB",
|
|
60
|
+
),
|
|
61
|
+
band_mask_types=BandMaskTypes(
|
|
62
|
+
technical_quality="MSK_QUALIT",
|
|
63
|
+
detector_footprints="MSK_DETFOO",
|
|
64
|
+
),
|
|
65
|
+
band_mask_extension="jp2",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class BaselineVersion:
|
|
71
|
+
"""Helper for Processing Baseline versions."""
|
|
72
|
+
|
|
73
|
+
major: int
|
|
74
|
+
minor: int
|
|
75
|
+
level: str
|
|
76
|
+
|
|
77
|
+
@staticmethod
|
|
78
|
+
def from_string(version: str) -> "BaselineVersion":
|
|
79
|
+
major, minor = map(int, version.split("."))
|
|
80
|
+
if major < 2:
|
|
81
|
+
level = "L1C"
|
|
82
|
+
# everything below 02.06 is Level 1C
|
|
83
|
+
elif major == 2 and minor <= 6:
|
|
84
|
+
level = "L1C"
|
|
85
|
+
else:
|
|
86
|
+
level = "L2A"
|
|
87
|
+
return BaselineVersion(major, minor, level)
|
|
88
|
+
|
|
89
|
+
@staticmethod
|
|
90
|
+
def from_inp(inp: Union[str, "BaselineVersion"]) -> "BaselineVersion":
|
|
91
|
+
if isinstance(inp, str):
|
|
92
|
+
return BaselineVersion.from_string(inp)
|
|
93
|
+
elif isinstance(inp, BaselineVersion):
|
|
94
|
+
return inp
|
|
95
|
+
else:
|
|
96
|
+
raise TypeError(f"cannot generate BaselineVersion from input {inp}")
|
|
97
|
+
|
|
98
|
+
def __eq__(self, other: Any):
|
|
99
|
+
other = BaselineVersion.from_inp(other)
|
|
100
|
+
return self.major == other.major and self.minor == other.minor
|
|
101
|
+
|
|
102
|
+
def __lt__(self, other: Union[str, "BaselineVersion"]):
|
|
103
|
+
other = BaselineVersion.from_inp(other)
|
|
104
|
+
if self.major == other.major:
|
|
105
|
+
return self.minor < other.minor
|
|
106
|
+
else:
|
|
107
|
+
return self.major < other.major
|
|
108
|
+
|
|
109
|
+
def __le__(self, other: Union[str, "BaselineVersion"]):
|
|
110
|
+
other = BaselineVersion.from_inp(other)
|
|
111
|
+
if self.major == other.major:
|
|
112
|
+
return self.minor <= other.minor
|
|
113
|
+
else:
|
|
114
|
+
return self.major <= other.major
|
|
115
|
+
|
|
116
|
+
def __gt__(self, other: Union[str, "BaselineVersion"]):
|
|
117
|
+
other = BaselineVersion.from_inp(other)
|
|
118
|
+
if self.major == other.major:
|
|
119
|
+
return self.minor > other.minor
|
|
120
|
+
else:
|
|
121
|
+
return self.major > other.major
|
|
122
|
+
|
|
123
|
+
def __ge__(self, other: Union[str, "BaselineVersion"]):
|
|
124
|
+
if isinstance(other, str):
|
|
125
|
+
other = BaselineVersion.from_string(other)
|
|
126
|
+
if self.major == other.major:
|
|
127
|
+
return self.minor >= other.minor
|
|
128
|
+
else:
|
|
129
|
+
return self.major >= other.major
|
|
130
|
+
|
|
131
|
+
def __str__(self):
|
|
132
|
+
return f"{self.major:02}.{self.minor:02}"
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class ProcessingBaseline:
|
|
136
|
+
"""Class which combines PB version and metadata.xml keys for QI masks."""
|
|
137
|
+
|
|
138
|
+
version: BaselineVersion
|
|
139
|
+
item_mapping: ItemMapping
|
|
140
|
+
product_mask_types: ProductMaskTypes
|
|
141
|
+
band_mask_types: BandMaskTypes
|
|
142
|
+
band_mask_extension: str
|
|
143
|
+
|
|
144
|
+
def __init__(self, version: BaselineVersion):
|
|
145
|
+
self.version = version
|
|
146
|
+
if self.version.major < 4:
|
|
147
|
+
self.item_mapping = pre_0400
|
|
148
|
+
else:
|
|
149
|
+
self.item_mapping = post_0400
|
|
150
|
+
|
|
151
|
+
self.product_mask_types = self.item_mapping.product_mask_types
|
|
152
|
+
self.band_mask_types = self.item_mapping.band_mask_types
|
|
153
|
+
self.band_mask_extension = self.item_mapping.band_mask_extension
|
|
154
|
+
|
|
155
|
+
def __repr__(self) -> str:
|
|
156
|
+
return f"<ProcessingBaseline version={self.version}>"
|
|
157
|
+
|
|
158
|
+
@staticmethod
|
|
159
|
+
def from_version(version: Union[BaselineVersion, str]) -> "ProcessingBaseline":
|
|
160
|
+
if isinstance(version, BaselineVersion):
|
|
161
|
+
return ProcessingBaseline(version=version)
|
|
162
|
+
else:
|
|
163
|
+
return ProcessingBaseline(version=BaselineVersion.from_string(version))
|