eodag 3.10.1__py3-none-any.whl → 4.0.0a2__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.
- eodag/__init__.py +6 -1
- eodag/api/collection.py +353 -0
- eodag/api/core.py +606 -641
- eodag/api/product/__init__.py +3 -3
- eodag/api/product/_product.py +74 -56
- eodag/api/product/drivers/__init__.py +4 -46
- eodag/api/product/drivers/base.py +0 -28
- eodag/api/product/metadata_mapping.py +178 -216
- eodag/api/search_result.py +156 -15
- eodag/cli.py +83 -403
- eodag/config.py +81 -51
- eodag/plugins/apis/base.py +2 -2
- eodag/plugins/apis/ecmwf.py +36 -25
- eodag/plugins/apis/usgs.py +55 -40
- eodag/plugins/authentication/base.py +1 -3
- eodag/plugins/crunch/filter_date.py +3 -3
- eodag/plugins/crunch/filter_latest_intersect.py +2 -2
- eodag/plugins/crunch/filter_latest_tpl_name.py +1 -1
- eodag/plugins/download/aws.py +46 -42
- eodag/plugins/download/base.py +13 -14
- eodag/plugins/download/http.py +65 -65
- eodag/plugins/manager.py +28 -29
- eodag/plugins/search/__init__.py +6 -4
- eodag/plugins/search/base.py +131 -80
- eodag/plugins/search/build_search_result.py +245 -173
- eodag/plugins/search/cop_marine.py +87 -56
- eodag/plugins/search/csw.py +47 -37
- eodag/plugins/search/qssearch.py +653 -429
- eodag/plugins/search/stac_list_assets.py +1 -1
- eodag/plugins/search/static_stac_search.py +43 -44
- eodag/resources/{product_types.yml → collections.yml} +2594 -2453
- eodag/resources/ext_collections.json +1 -1
- eodag/resources/ext_product_types.json +1 -1
- eodag/resources/providers.yml +2706 -2733
- eodag/resources/stac_provider.yml +50 -92
- eodag/resources/user_conf_template.yml +9 -0
- eodag/types/__init__.py +2 -0
- eodag/types/queryables.py +70 -91
- eodag/types/search_args.py +1 -1
- eodag/utils/__init__.py +97 -21
- eodag/utils/dates.py +0 -12
- eodag/utils/exceptions.py +6 -6
- eodag/utils/free_text_search.py +3 -3
- eodag/utils/repr.py +2 -0
- {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/METADATA +13 -99
- eodag-4.0.0a2.dist-info/RECORD +93 -0
- {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/entry_points.txt +0 -4
- eodag/plugins/authentication/oauth.py +0 -60
- eodag/plugins/download/creodias_s3.py +0 -71
- eodag/plugins/download/s3rest.py +0 -351
- eodag/plugins/search/data_request_search.py +0 -565
- eodag/resources/stac.yml +0 -294
- eodag/resources/stac_api.yml +0 -2105
- eodag/rest/__init__.py +0 -24
- eodag/rest/cache.py +0 -70
- eodag/rest/config.py +0 -67
- eodag/rest/constants.py +0 -26
- eodag/rest/core.py +0 -764
- eodag/rest/errors.py +0 -210
- eodag/rest/server.py +0 -604
- eodag/rest/server.wsgi +0 -6
- eodag/rest/stac.py +0 -1032
- eodag/rest/templates/README +0 -1
- eodag/rest/types/__init__.py +0 -18
- eodag/rest/types/collections_search.py +0 -44
- eodag/rest/types/eodag_search.py +0 -386
- eodag/rest/types/queryables.py +0 -174
- eodag/rest/types/stac_search.py +0 -272
- eodag/rest/utils/__init__.py +0 -207
- eodag/rest/utils/cql_evaluate.py +0 -119
- eodag/rest/utils/rfc3339.py +0 -64
- eodag-3.10.1.dist-info/RECORD +0 -116
- {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/WHEEL +0 -0
- {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/licenses/LICENSE +0 -0
- {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/top_level.txt +0 -0
|
@@ -55,7 +55,7 @@ class StacListAssets(StacSearch):
|
|
|
55
55
|
"""``StacListAssets`` is an extension of :class:`~eodag.plugins.search.qssearch.StacSearch`.
|
|
56
56
|
|
|
57
57
|
It executes a Search on given STAC API endpoint and updates assets with content listed by the plugin using
|
|
58
|
-
``
|
|
58
|
+
``eodag:download_link`` :class:`~eodag.api.product._product.EOProduct` property.
|
|
59
59
|
|
|
60
60
|
:param provider: provider name
|
|
61
61
|
:param config: It has the same Search plugin configuration as :class:`~eodag.plugins.search.qssearch.StacSearch` and
|
|
@@ -36,7 +36,6 @@ from eodag.utils import HTTP_REQ_TIMEOUT, MockResponse
|
|
|
36
36
|
from eodag.utils.stac_reader import fetch_stac_collections, fetch_stac_items
|
|
37
37
|
|
|
38
38
|
if TYPE_CHECKING:
|
|
39
|
-
from eodag.api.product import EOProduct
|
|
40
39
|
from eodag.config import PluginConfig
|
|
41
40
|
|
|
42
41
|
|
|
@@ -69,12 +68,12 @@ class StaticStacSearch(StacSearch):
|
|
|
69
68
|
# prevent search parameters from being queried when they are known in the configuration or not
|
|
70
69
|
for param, mapping in config.metadata_mapping.items():
|
|
71
70
|
# only keep one queryable to allow the mock search request
|
|
72
|
-
if param != "
|
|
71
|
+
if param != "collection":
|
|
73
72
|
config.metadata_mapping[param] = get_metadata_path_value(mapping)
|
|
74
73
|
config.discover_metadata["auto_discovery"] = False
|
|
75
74
|
# there is no endpoint for fetching queryables with a static search
|
|
76
75
|
config.discover_queryables["fetch_url"] = None
|
|
77
|
-
config.discover_queryables["
|
|
76
|
+
config.discover_queryables["collection_fetch_url"] = None
|
|
78
77
|
|
|
79
78
|
super(StaticStacSearch, self).__init__(provider, config)
|
|
80
79
|
self.config.__dict__.setdefault("max_connections", 100)
|
|
@@ -85,23 +84,25 @@ class StaticStacSearch(StacSearch):
|
|
|
85
84
|
"total_items_nb_key_path", "$.null"
|
|
86
85
|
)
|
|
87
86
|
self.config.__dict__["pagination"].setdefault("max_items_per_page", -1)
|
|
88
|
-
# disable
|
|
87
|
+
# disable collections discovery by default (if endpoints equals to STAC API default)
|
|
89
88
|
if (
|
|
90
|
-
getattr(self.config, "
|
|
89
|
+
getattr(self.config, "discover_collections", {}).get("fetch_url")
|
|
91
90
|
== "{api_endpoint}/../collections"
|
|
92
91
|
):
|
|
93
|
-
self.config.
|
|
92
|
+
self.config.discover_collections = {}
|
|
94
93
|
|
|
95
|
-
def
|
|
96
|
-
"""Fetch
|
|
94
|
+
def discover_collections(self, **kwargs: Any) -> Optional[dict[str, Any]]:
|
|
95
|
+
"""Fetch collections list from a static STAC Catalog provider using `discover_collections` conf
|
|
97
96
|
|
|
98
|
-
:returns: configuration dict containing fetched
|
|
97
|
+
:returns: configuration dict containing fetched collections information
|
|
99
98
|
"""
|
|
100
|
-
unformatted_fetch_url = self.config.
|
|
99
|
+
unformatted_fetch_url = self.config.discover_collections.get("fetch_url")
|
|
101
100
|
if unformatted_fetch_url is None:
|
|
102
101
|
return None
|
|
103
102
|
fetch_url = unformatted_fetch_url.format(**self.config.__dict__)
|
|
104
103
|
|
|
104
|
+
logger.info(f"Fetching collections: {fetch_url}")
|
|
105
|
+
|
|
105
106
|
collections = fetch_stac_collections(
|
|
106
107
|
fetch_url,
|
|
107
108
|
collection=kwargs.get("q"),
|
|
@@ -113,13 +114,13 @@ class StaticStacSearch(StacSearch):
|
|
|
113
114
|
collections = [c for c in collections if c["id"] == kwargs["q"]]
|
|
114
115
|
collections_mock_response = {"collections": collections}
|
|
115
116
|
|
|
116
|
-
#
|
|
117
|
+
# discover_collections on mocked QueryStringSearch._request
|
|
117
118
|
with mock.patch(
|
|
118
119
|
"eodag.plugins.search.qssearch.QueryStringSearch._request",
|
|
119
120
|
autospec=True,
|
|
120
121
|
return_value=MockResponse(collections_mock_response, 200),
|
|
121
122
|
):
|
|
122
|
-
conf_update_dict = super(StaticStacSearch, self).
|
|
123
|
+
conf_update_dict = super(StaticStacSearch, self).discover_collections(
|
|
123
124
|
**kwargs
|
|
124
125
|
)
|
|
125
126
|
|
|
@@ -131,21 +132,21 @@ class StaticStacSearch(StacSearch):
|
|
|
131
132
|
"""Set static available queryables for :class:`~eodag.plugins.search.static_stac_search.StaticStacSearch`
|
|
132
133
|
search plugin
|
|
133
134
|
|
|
134
|
-
:param kwargs: additional filters for queryables (`
|
|
135
|
+
:param kwargs: additional filters for queryables (`collection` and other search
|
|
135
136
|
arguments)
|
|
136
137
|
:returns: queryable parameters dict
|
|
137
138
|
"""
|
|
138
139
|
return {
|
|
139
|
-
"
|
|
140
|
-
"
|
|
140
|
+
"collection": Queryables.get_with_default(
|
|
141
|
+
"collection", kwargs.get("collection")
|
|
141
142
|
),
|
|
142
143
|
"id": Queryables.get_with_default("id", kwargs.get("id")),
|
|
143
144
|
"start": Queryables.get_with_default(
|
|
144
|
-
"start", kwargs.get("start") or kwargs.get("
|
|
145
|
+
"start", kwargs.get("start") or kwargs.get("start_datetime")
|
|
145
146
|
),
|
|
146
147
|
"end": Queryables.get_with_default(
|
|
147
148
|
"end",
|
|
148
|
-
kwargs.get("end") or kwargs.get("
|
|
149
|
+
kwargs.get("end") or kwargs.get("end_datetime"),
|
|
149
150
|
),
|
|
150
151
|
"geom": Queryables.get_with_default(
|
|
151
152
|
"geom",
|
|
@@ -157,7 +158,7 @@ class StaticStacSearch(StacSearch):
|
|
|
157
158
|
self,
|
|
158
159
|
prep: PreparedSearch = PreparedSearch(),
|
|
159
160
|
**kwargs: Any,
|
|
160
|
-
) ->
|
|
161
|
+
) -> SearchResult:
|
|
161
162
|
"""Perform a search on a static STAC Catalog"""
|
|
162
163
|
|
|
163
164
|
# only return 1 page if pagination is disabled
|
|
@@ -167,22 +168,25 @@ class StaticStacSearch(StacSearch):
|
|
|
167
168
|
and prep.items_per_page is not None
|
|
168
169
|
and prep.items_per_page <= 0
|
|
169
170
|
):
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
result = SearchResult([])
|
|
172
|
+
if prep.count:
|
|
173
|
+
result.number_matched = 0
|
|
174
|
+
return result
|
|
175
|
+
|
|
176
|
+
collection = kwargs.get("collection", prep.collection)
|
|
177
|
+
# provider collection specific conf
|
|
178
|
+
self.collection_def_params = (
|
|
179
|
+
self.get_collection_def_params(collection, format_variables=kwargs)
|
|
180
|
+
if collection is not None
|
|
177
181
|
else {}
|
|
178
182
|
)
|
|
179
183
|
|
|
180
|
-
for
|
|
184
|
+
for provider_collections in self.get_provider_collections(prep, **kwargs):
|
|
181
185
|
# skip empty collection if one is required in api_endpoint
|
|
182
|
-
if "{
|
|
186
|
+
if "{_collection}" in self.config.api_endpoint and not provider_collections:
|
|
183
187
|
continue
|
|
184
188
|
search_endpoint = self.config.api_endpoint.rstrip("/").format(
|
|
185
|
-
|
|
189
|
+
_collection=provider_collections
|
|
186
190
|
)
|
|
187
191
|
|
|
188
192
|
features = fetch_stac_items(
|
|
@@ -201,16 +205,14 @@ class StaticStacSearch(StacSearch):
|
|
|
201
205
|
autospec=True,
|
|
202
206
|
return_value=MockResponse(feature_collection, 200),
|
|
203
207
|
):
|
|
204
|
-
|
|
208
|
+
search_result = super(StaticStacSearch, self).query(
|
|
205
209
|
PreparedSearch(items_per_page=nb_features, page=1, count=True), **kwargs
|
|
206
210
|
)
|
|
207
|
-
# filter using query params
|
|
208
|
-
search_result = SearchResult(eo_products)
|
|
209
211
|
# Filter by date
|
|
210
|
-
if "
|
|
211
|
-
kwargs["start"] = kwargs.pop("
|
|
212
|
-
if "
|
|
213
|
-
kwargs["end"] = kwargs.pop("
|
|
212
|
+
if "start_datetime" in kwargs:
|
|
213
|
+
kwargs["start"] = kwargs.pop("start_datetime")
|
|
214
|
+
if "end_datetime" in kwargs:
|
|
215
|
+
kwargs["end"] = kwargs.pop("end_datetime")
|
|
214
216
|
if any(k in ["start", "end"] for k in kwargs.keys()):
|
|
215
217
|
search_result = search_result.crunch(
|
|
216
218
|
FilterDate({k: kwargs[k] for k in ["start", "end"] if k in kwargs})
|
|
@@ -223,17 +225,17 @@ class StaticStacSearch(StacSearch):
|
|
|
223
225
|
FilterOverlap({"intersects": True}), geometry=geometry
|
|
224
226
|
)
|
|
225
227
|
# Filter by cloudCover
|
|
226
|
-
if "
|
|
228
|
+
if "eo:cloud_cover" in kwargs.keys():
|
|
227
229
|
search_result = search_result.crunch(
|
|
228
230
|
FilterProperty(
|
|
229
|
-
{"
|
|
231
|
+
{"eo:cloud_cover": kwargs.pop("eo:cloud_cover"), "operator": "lt"}
|
|
230
232
|
)
|
|
231
233
|
)
|
|
232
234
|
# Filter by other properties
|
|
233
235
|
skip_eodag_internal_parameters = [
|
|
234
236
|
"auth",
|
|
235
237
|
"raise_errors",
|
|
236
|
-
"
|
|
238
|
+
"collection",
|
|
237
239
|
"locations",
|
|
238
240
|
"start",
|
|
239
241
|
"end",
|
|
@@ -244,9 +246,6 @@ class StaticStacSearch(StacSearch):
|
|
|
244
246
|
search_result = search_result.crunch(
|
|
245
247
|
FilterProperty({property_key: property_value, "operator": "eq"})
|
|
246
248
|
)
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if prep.count
|
|
251
|
-
else (search_result.data, None)
|
|
252
|
-
)
|
|
249
|
+
if prep.count:
|
|
250
|
+
search_result.number_matched = len(search_result.data)
|
|
251
|
+
return search_result
|