eodag 3.0.0b3__py3-none-any.whl → 3.1.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.
- eodag/api/core.py +347 -247
- eodag/api/product/_assets.py +44 -15
- eodag/api/product/_product.py +58 -47
- eodag/api/product/drivers/__init__.py +81 -4
- eodag/api/product/drivers/base.py +65 -4
- eodag/api/product/drivers/generic.py +65 -0
- eodag/api/product/drivers/sentinel1.py +97 -0
- eodag/api/product/drivers/sentinel2.py +95 -0
- eodag/api/product/metadata_mapping.py +129 -93
- eodag/api/search_result.py +28 -12
- eodag/cli.py +61 -24
- eodag/config.py +457 -167
- eodag/plugins/apis/base.py +10 -4
- eodag/plugins/apis/ecmwf.py +53 -23
- eodag/plugins/apis/usgs.py +41 -17
- eodag/plugins/authentication/aws_auth.py +30 -18
- eodag/plugins/authentication/base.py +14 -3
- eodag/plugins/authentication/generic.py +14 -3
- eodag/plugins/authentication/header.py +14 -6
- eodag/plugins/authentication/keycloak.py +44 -25
- eodag/plugins/authentication/oauth.py +18 -4
- eodag/plugins/authentication/openid_connect.py +192 -171
- eodag/plugins/authentication/qsauth.py +12 -4
- eodag/plugins/authentication/sas_auth.py +22 -5
- eodag/plugins/authentication/token.py +95 -17
- eodag/plugins/authentication/token_exchange.py +19 -19
- eodag/plugins/base.py +4 -4
- eodag/plugins/crunch/base.py +8 -5
- eodag/plugins/crunch/filter_date.py +9 -6
- eodag/plugins/crunch/filter_latest_intersect.py +9 -8
- eodag/plugins/crunch/filter_latest_tpl_name.py +8 -8
- eodag/plugins/crunch/filter_overlap.py +9 -11
- eodag/plugins/crunch/filter_property.py +10 -10
- eodag/plugins/download/aws.py +181 -105
- eodag/plugins/download/base.py +49 -67
- eodag/plugins/download/creodias_s3.py +40 -2
- eodag/plugins/download/http.py +247 -223
- eodag/plugins/download/s3rest.py +29 -28
- eodag/plugins/manager.py +176 -41
- eodag/plugins/search/__init__.py +6 -5
- eodag/plugins/search/base.py +123 -60
- eodag/plugins/search/build_search_result.py +1046 -355
- eodag/plugins/search/cop_marine.py +132 -39
- eodag/plugins/search/creodias_s3.py +19 -68
- eodag/plugins/search/csw.py +48 -8
- eodag/plugins/search/data_request_search.py +124 -23
- eodag/plugins/search/qssearch.py +531 -310
- eodag/plugins/search/stac_list_assets.py +85 -0
- eodag/plugins/search/static_stac_search.py +23 -24
- eodag/resources/ext_product_types.json +1 -1
- eodag/resources/product_types.yml +1295 -355
- eodag/resources/providers.yml +1819 -3010
- eodag/resources/stac.yml +3 -163
- eodag/resources/stac_api.yml +2 -2
- eodag/resources/user_conf_template.yml +115 -99
- eodag/rest/cache.py +2 -2
- eodag/rest/config.py +3 -4
- eodag/rest/constants.py +0 -1
- eodag/rest/core.py +157 -117
- eodag/rest/errors.py +181 -0
- eodag/rest/server.py +57 -339
- eodag/rest/stac.py +133 -581
- eodag/rest/types/collections_search.py +3 -3
- eodag/rest/types/eodag_search.py +41 -30
- eodag/rest/types/queryables.py +42 -32
- eodag/rest/types/stac_search.py +15 -16
- eodag/rest/utils/__init__.py +14 -21
- eodag/rest/utils/cql_evaluate.py +6 -6
- eodag/rest/utils/rfc3339.py +2 -2
- eodag/types/__init__.py +153 -32
- eodag/types/bbox.py +2 -2
- eodag/types/download_args.py +4 -4
- eodag/types/queryables.py +183 -73
- eodag/types/search_args.py +6 -6
- eodag/types/whoosh.py +127 -3
- eodag/utils/__init__.py +228 -106
- eodag/utils/exceptions.py +47 -26
- eodag/utils/import_system.py +2 -2
- eodag/utils/logging.py +37 -77
- eodag/utils/repr.py +65 -6
- eodag/utils/requests.py +13 -15
- eodag/utils/rest.py +2 -2
- eodag/utils/s3.py +231 -0
- eodag/utils/stac_reader.py +11 -11
- {eodag-3.0.0b3.dist-info → eodag-3.1.0.dist-info}/METADATA +81 -81
- eodag-3.1.0.dist-info/RECORD +113 -0
- {eodag-3.0.0b3.dist-info → eodag-3.1.0.dist-info}/WHEEL +1 -1
- {eodag-3.0.0b3.dist-info → eodag-3.1.0.dist-info}/entry_points.txt +5 -2
- eodag/resources/constraints/climate-dt.json +0 -13
- eodag/resources/constraints/extremes-dt.json +0 -8
- eodag/utils/constraints.py +0 -244
- eodag-3.0.0b3.dist-info/RECORD +0 -110
- {eodag-3.0.0b3.dist-info → eodag-3.1.0.dist-info}/LICENSE +0 -0
- {eodag-3.0.0b3.dist-info → eodag-3.1.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2024, CS GROUP - France, https://www.csgroup.eu/
|
|
3
|
+
#
|
|
4
|
+
# This file is part of EODAG project
|
|
5
|
+
# https://www.github.com/CS-SI/EODAG
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
import logging
|
|
19
|
+
from types import MethodType
|
|
20
|
+
from typing import Any, List
|
|
21
|
+
|
|
22
|
+
from botocore.exceptions import BotoCoreError
|
|
23
|
+
|
|
24
|
+
from eodag.api.product import EOProduct # type: ignore
|
|
25
|
+
from eodag.api.search_result import RawSearchResult
|
|
26
|
+
from eodag.plugins.search.qssearch import StacSearch
|
|
27
|
+
from eodag.utils.exceptions import RequestError
|
|
28
|
+
from eodag.utils.s3 import update_assets_from_s3
|
|
29
|
+
|
|
30
|
+
logger = logging.getLogger("eodag.search.stac_list_assets")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def patched_register_downloader(self, downloader, authenticator):
|
|
34
|
+
"""Add the download information to the product.
|
|
35
|
+
|
|
36
|
+
:param self: product to which information should be added
|
|
37
|
+
:param downloader: The download method that it can use
|
|
38
|
+
:class:`~eodag.plugins.download.base.Download` or
|
|
39
|
+
:class:`~eodag.plugins.api.base.Api`
|
|
40
|
+
:param authenticator: The authentication method needed to perform the download
|
|
41
|
+
:class:`~eodag.plugins.authentication.base.Authentication`
|
|
42
|
+
"""
|
|
43
|
+
# register downloader
|
|
44
|
+
self.register_downloader_only(downloader, authenticator)
|
|
45
|
+
# and also update assets
|
|
46
|
+
try:
|
|
47
|
+
update_assets_from_s3(
|
|
48
|
+
self, authenticator, getattr(downloader.config, "s3_endpoint", None)
|
|
49
|
+
)
|
|
50
|
+
except BotoCoreError as e:
|
|
51
|
+
raise RequestError.from_error(e, "could not update assets") from e
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class StacListAssets(StacSearch):
|
|
55
|
+
"""``StacListAssets`` is an extension of :class:`~eodag.plugins.search.qssearch.StacSearch`.
|
|
56
|
+
|
|
57
|
+
It executes a Search on given STAC API endpoint and updates assets with content listed by the plugin using
|
|
58
|
+
``downloadLink`` :class:`~eodag.api.product._product.EOProduct` property.
|
|
59
|
+
|
|
60
|
+
:param provider: provider name
|
|
61
|
+
:param config: It has the same Search plugin configuration as :class:`~eodag.plugins.search.qssearch.StacSearch` and
|
|
62
|
+
one additional parameter:
|
|
63
|
+
|
|
64
|
+
* :attr:`~eodag.config.PluginConfig.s3_endpoint` (``str``): s3 endpoint if not hosted on AWS
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
def __init__(self, provider, config):
|
|
68
|
+
super(StacSearch, self).__init__(provider, config)
|
|
69
|
+
|
|
70
|
+
def normalize_results(
|
|
71
|
+
self, results: RawSearchResult, **kwargs: Any
|
|
72
|
+
) -> List[EOProduct]:
|
|
73
|
+
"""Build EOProducts from provider results"""
|
|
74
|
+
|
|
75
|
+
products = super(StacSearch, self).normalize_results(results, **kwargs)
|
|
76
|
+
|
|
77
|
+
for product in products:
|
|
78
|
+
# backup original register_downloader to register_downloader_only
|
|
79
|
+
product.register_downloader_only = product.register_downloader
|
|
80
|
+
# patched register_downloader that will also update assets
|
|
81
|
+
product.register_downloader = MethodType(
|
|
82
|
+
patched_register_downloader, product
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
return products
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
20
|
import logging
|
|
21
|
-
from typing import TYPE_CHECKING, Any,
|
|
21
|
+
from typing import TYPE_CHECKING, Any, Optional
|
|
22
22
|
from unittest import mock
|
|
23
23
|
|
|
24
24
|
import geojson
|
|
@@ -44,23 +44,23 @@ logger = logging.getLogger("eodag.search.static_stac_search")
|
|
|
44
44
|
class StaticStacSearch(StacSearch):
|
|
45
45
|
"""Static STAC Catalog search plugin
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
This plugin first loads all STAC items found in the catalog, and converts them to
|
|
48
|
+
EOProducts using :class:`~eodag.plugins.search.qssearch.StacSearch`.
|
|
49
|
+
Then it uses crunchers to only keep products matching query parameters.
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
The plugin inherits the configuration parameters from :class:`~eodag.plugins.search.qssearch.PostJsonSearch`
|
|
52
|
+
(via the :class:`~eodag.plugins.search.qssearch.StacSearch` inheritance) with the following particularities:
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
:param provider: provider name
|
|
55
|
+
:param config: Search plugin configuration:
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
* :attr:`~eodag.config.PluginConfig.api_endpoint` (``str``) (**mandatory**): path to the catalog;
|
|
58
|
+
in contrast to the api_endpoint for other plugin types this can be a url or local system path.
|
|
59
|
+
* :attr:`~eodag.config.PluginConfig.max_connections` (``int``): Maximum number of concurrent
|
|
60
|
+
connections for HTTP requests; default: ``100``
|
|
61
|
+
* :attr:`~eodag.config.PluginConfig.timeout` (``int``): Timeout in seconds for each
|
|
62
|
+
internal HTTP request; default: ``5``
|
|
57
63
|
|
|
58
|
-
This plugin first loads all STAC items found in the catalog, and converts them to
|
|
59
|
-
EOProducts using StacSearch.
|
|
60
|
-
Then it uses crunchers to only keep products matching query parameters.
|
|
61
|
-
|
|
62
|
-
:param provider: An eodag providers configuration dictionary
|
|
63
|
-
:param config: Path to the user configuration file
|
|
64
64
|
"""
|
|
65
65
|
|
|
66
66
|
def __init__(self, provider: str, config: PluginConfig) -> None:
|
|
@@ -88,19 +88,18 @@ class StaticStacSearch(StacSearch):
|
|
|
88
88
|
getattr(self.config, "discover_product_types", {}).get("fetch_url")
|
|
89
89
|
== "{api_endpoint}/../collections"
|
|
90
90
|
):
|
|
91
|
-
self.config.discover_product_types = {
|
|
91
|
+
self.config.discover_product_types = {}
|
|
92
92
|
|
|
93
|
-
def discover_product_types(self, **kwargs: Any) -> Optional[
|
|
93
|
+
def discover_product_types(self, **kwargs: Any) -> Optional[dict[str, Any]]:
|
|
94
94
|
"""Fetch product types list from a static STAC Catalog provider using `discover_product_types` conf
|
|
95
95
|
|
|
96
96
|
:returns: configuration dict containing fetched product types information
|
|
97
97
|
"""
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
)
|
|
98
|
+
unformatted_fetch_url = self.config.discover_product_types.get("fetch_url")
|
|
99
|
+
if unformatted_fetch_url is None:
|
|
100
|
+
return None
|
|
101
|
+
fetch_url = unformatted_fetch_url.format(**self.config.__dict__)
|
|
102
|
+
|
|
104
103
|
collections = fetch_stac_collections(
|
|
105
104
|
fetch_url,
|
|
106
105
|
collection=kwargs.get("q"),
|
|
@@ -128,7 +127,7 @@ class StaticStacSearch(StacSearch):
|
|
|
128
127
|
self,
|
|
129
128
|
prep: PreparedSearch = PreparedSearch(),
|
|
130
129
|
**kwargs: Any,
|
|
131
|
-
) ->
|
|
130
|
+
) -> tuple[list[EOProduct], Optional[int]]:
|
|
132
131
|
"""Perform a search on a static STAC Catalog"""
|
|
133
132
|
|
|
134
133
|
# only return 1 page if pagination is disabled
|
|
@@ -143,7 +142,7 @@ class StaticStacSearch(StacSearch):
|
|
|
143
142
|
product_type = kwargs.get("productType", prep.product_type)
|
|
144
143
|
# provider product type specific conf
|
|
145
144
|
self.product_type_def_params = (
|
|
146
|
-
self.get_product_type_def_params(product_type,
|
|
145
|
+
self.get_product_type_def_params(product_type, format_variables=kwargs)
|
|
147
146
|
if product_type is not None
|
|
148
147
|
else {}
|
|
149
148
|
)
|