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.
Files changed (75) hide show
  1. eodag/__init__.py +6 -1
  2. eodag/api/collection.py +353 -0
  3. eodag/api/core.py +606 -641
  4. eodag/api/product/__init__.py +3 -3
  5. eodag/api/product/_product.py +74 -56
  6. eodag/api/product/drivers/__init__.py +4 -46
  7. eodag/api/product/drivers/base.py +0 -28
  8. eodag/api/product/metadata_mapping.py +178 -216
  9. eodag/api/search_result.py +156 -15
  10. eodag/cli.py +83 -403
  11. eodag/config.py +81 -51
  12. eodag/plugins/apis/base.py +2 -2
  13. eodag/plugins/apis/ecmwf.py +36 -25
  14. eodag/plugins/apis/usgs.py +55 -40
  15. eodag/plugins/authentication/base.py +1 -3
  16. eodag/plugins/crunch/filter_date.py +3 -3
  17. eodag/plugins/crunch/filter_latest_intersect.py +2 -2
  18. eodag/plugins/crunch/filter_latest_tpl_name.py +1 -1
  19. eodag/plugins/download/aws.py +46 -42
  20. eodag/plugins/download/base.py +13 -14
  21. eodag/plugins/download/http.py +65 -65
  22. eodag/plugins/manager.py +28 -29
  23. eodag/plugins/search/__init__.py +6 -4
  24. eodag/plugins/search/base.py +131 -80
  25. eodag/plugins/search/build_search_result.py +245 -173
  26. eodag/plugins/search/cop_marine.py +87 -56
  27. eodag/plugins/search/csw.py +47 -37
  28. eodag/plugins/search/qssearch.py +653 -429
  29. eodag/plugins/search/stac_list_assets.py +1 -1
  30. eodag/plugins/search/static_stac_search.py +43 -44
  31. eodag/resources/{product_types.yml → collections.yml} +2594 -2453
  32. eodag/resources/ext_collections.json +1 -1
  33. eodag/resources/ext_product_types.json +1 -1
  34. eodag/resources/providers.yml +2706 -2733
  35. eodag/resources/stac_provider.yml +50 -92
  36. eodag/resources/user_conf_template.yml +9 -0
  37. eodag/types/__init__.py +2 -0
  38. eodag/types/queryables.py +70 -91
  39. eodag/types/search_args.py +1 -1
  40. eodag/utils/__init__.py +97 -21
  41. eodag/utils/dates.py +0 -12
  42. eodag/utils/exceptions.py +6 -6
  43. eodag/utils/free_text_search.py +3 -3
  44. eodag/utils/repr.py +2 -0
  45. {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/METADATA +13 -99
  46. eodag-4.0.0a2.dist-info/RECORD +93 -0
  47. {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/entry_points.txt +0 -4
  48. eodag/plugins/authentication/oauth.py +0 -60
  49. eodag/plugins/download/creodias_s3.py +0 -71
  50. eodag/plugins/download/s3rest.py +0 -351
  51. eodag/plugins/search/data_request_search.py +0 -565
  52. eodag/resources/stac.yml +0 -294
  53. eodag/resources/stac_api.yml +0 -2105
  54. eodag/rest/__init__.py +0 -24
  55. eodag/rest/cache.py +0 -70
  56. eodag/rest/config.py +0 -67
  57. eodag/rest/constants.py +0 -26
  58. eodag/rest/core.py +0 -764
  59. eodag/rest/errors.py +0 -210
  60. eodag/rest/server.py +0 -604
  61. eodag/rest/server.wsgi +0 -6
  62. eodag/rest/stac.py +0 -1032
  63. eodag/rest/templates/README +0 -1
  64. eodag/rest/types/__init__.py +0 -18
  65. eodag/rest/types/collections_search.py +0 -44
  66. eodag/rest/types/eodag_search.py +0 -386
  67. eodag/rest/types/queryables.py +0 -174
  68. eodag/rest/types/stac_search.py +0 -272
  69. eodag/rest/utils/__init__.py +0 -207
  70. eodag/rest/utils/cql_evaluate.py +0 -119
  71. eodag/rest/utils/rfc3339.py +0 -64
  72. eodag-3.10.1.dist-info/RECORD +0 -116
  73. {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/WHEEL +0 -0
  74. {eodag-3.10.1.dist-info → eodag-4.0.0a2.dist-info}/licenses/LICENSE +0 -0
  75. {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
- ``downloadLink`` :class:`~eodag.api.product._product.EOProduct` property.
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 != "productType":
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["product_type_fetch_url"] = None
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 product types discovery by default (if endpoints equals to STAC API default)
87
+ # disable collections discovery by default (if endpoints equals to STAC API default)
89
88
  if (
90
- getattr(self.config, "discover_product_types", {}).get("fetch_url")
89
+ getattr(self.config, "discover_collections", {}).get("fetch_url")
91
90
  == "{api_endpoint}/../collections"
92
91
  ):
93
- self.config.discover_product_types = {}
92
+ self.config.discover_collections = {}
94
93
 
95
- def discover_product_types(self, **kwargs: Any) -> Optional[dict[str, Any]]:
96
- """Fetch product types list from a static STAC Catalog provider using `discover_product_types` conf
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 product types information
97
+ :returns: configuration dict containing fetched collections information
99
98
  """
100
- unformatted_fetch_url = self.config.discover_product_types.get("fetch_url")
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
- # discover_product_types on mocked QueryStringSearch._request
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).discover_product_types(
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 (`productType` and other search
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
- "productType": Queryables.get_with_default(
140
- "productType", kwargs.get("productType")
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("startTimeFromAscendingNode")
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("completionTimeFromAscendingNode"),
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
- ) -> tuple[list[EOProduct], Optional[int]]:
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
- return ([], 0) if prep.count else ([], None)
171
-
172
- product_type = kwargs.get("productType", prep.product_type)
173
- # provider product type specific conf
174
- self.product_type_def_params = (
175
- self.get_product_type_def_params(product_type, format_variables=kwargs)
176
- if product_type is not None
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 collection in self.get_collections(prep, **kwargs):
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 "{collection}" in self.config.api_endpoint and not collection:
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
- collection=collection
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
- eo_products, _ = super(StaticStacSearch, self).query(
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 "startTimeFromAscendingNode" in kwargs:
211
- kwargs["start"] = kwargs.pop("startTimeFromAscendingNode")
212
- if "completionTimeFromAscendingNode" in kwargs:
213
- kwargs["end"] = kwargs.pop("completionTimeFromAscendingNode")
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 "cloudCover" in kwargs.keys():
228
+ if "eo:cloud_cover" in kwargs.keys():
227
229
  search_result = search_result.crunch(
228
230
  FilterProperty(
229
- {"cloudCover": kwargs.pop("cloudCover"), "operator": "lt"}
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
- "productType",
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
- return (
249
- (search_result.data, len(search_result))
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