eotdl 2024.4.25__tar.gz → 2024.5.2__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.
Files changed (80) hide show
  1. {eotdl-2024.4.25 → eotdl-2024.5.2}/PKG-INFO +2 -1
  2. eotdl-2024.5.2/eotdl/__init__.py +1 -0
  3. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/download.py +22 -16
  4. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/sentinelhub/utils.py +12 -4
  5. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/datasets/__init__.py +1 -1
  6. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/files/__init__.py +1 -0
  7. eotdl-2024.5.2/eotdl/files/list_files.py +13 -0
  8. eotdl-2024.5.2/eotdl/models/__init__.py +3 -0
  9. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/repos/FilesAPIRepo.py +9 -0
  10. {eotdl-2024.4.25 → eotdl-2024.5.2}/pyproject.toml +1 -1
  11. eotdl-2024.4.25/eotdl/__init__.py +0 -1
  12. eotdl-2024.4.25/eotdl/models/__init__.py +0 -3
  13. {eotdl-2024.4.25 → eotdl-2024.5.2}/README.md +0 -0
  14. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/__init__.py +0 -0
  15. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/airbus/__init__.py +0 -0
  16. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/airbus/client.py +0 -0
  17. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/airbus/parameters.py +0 -0
  18. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/airbus/utils.py +0 -0
  19. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/search.py +0 -0
  20. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/sentinelhub/__init__.py +0 -0
  21. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/sentinelhub/client.py +0 -0
  22. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/sentinelhub/evalscripts.py +0 -0
  23. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/access/sentinelhub/parameters.py +0 -0
  24. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/auth/__init__.py +0 -0
  25. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/auth/auth.py +0 -0
  26. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/auth/errors.py +0 -0
  27. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/auth/is_logged.py +0 -0
  28. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/auth/logout.py +0 -0
  29. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/cli.py +0 -0
  30. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/commands/__init__.py +0 -0
  31. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/commands/auth.py +0 -0
  32. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/commands/datasets.py +0 -0
  33. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/commands/models.py +0 -0
  34. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/__init__.py +0 -0
  35. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/__init__.py +0 -0
  36. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/assets.py +0 -0
  37. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/dataframe.py +0 -0
  38. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/dataframe_bck.py +0 -0
  39. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/dataframe_labeling.py +0 -0
  40. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/__init__.py +0 -0
  41. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/base.py +0 -0
  42. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/dem.py +0 -0
  43. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/eo.py +0 -0
  44. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/label/__init__.py +0 -0
  45. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/label/base.py +0 -0
  46. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/label/image_name_labeler.py +0 -0
  47. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/label/scaneo.py +0 -0
  48. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/ml_dataset.py +0 -0
  49. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/projection.py +0 -0
  50. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/raster.py +0 -0
  51. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extensions/sar.py +0 -0
  52. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/extent.py +0 -0
  53. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/parsers.py +0 -0
  54. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/curation/stac/stac.py +0 -0
  55. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/datasets/download.py +0 -0
  56. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/datasets/ingest.py +0 -0
  57. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/datasets/metadata.py +0 -0
  58. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/datasets/retrieve.py +0 -0
  59. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/datasets/update.py +0 -0
  60. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/files/ingest.py +0 -0
  61. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/models/download.py +0 -0
  62. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/models/ingest.py +0 -0
  63. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/models/metadata.py +0 -0
  64. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/models/retrieve.py +0 -0
  65. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/models/update.py +0 -0
  66. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/repos/APIRepo.py +0 -0
  67. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/repos/AuthAPIRepo.py +0 -0
  68. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/repos/AuthRepo.py +0 -0
  69. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/repos/DatasetsAPIRepo.py +0 -0
  70. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/repos/ModelsAPIRepo.py +0 -0
  71. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/repos/__init__.py +0 -0
  72. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/shared/__init__.py +0 -0
  73. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/shared/checksum.py +0 -0
  74. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/tools/__init__.py +0 -0
  75. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/tools/geo_utils.py +0 -0
  76. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/tools/metadata.py +0 -0
  77. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/tools/paths.py +0 -0
  78. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/tools/stac.py +0 -0
  79. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/tools/time_utils.py +0 -0
  80. {eotdl-2024.4.25 → eotdl-2024.5.2}/eotdl/tools/tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eotdl
3
- Version: 2024.4.25
3
+ Version: 2024.5.2
4
4
  Summary: Earth Observation Training Data Lab
5
5
  License: MIT
6
6
  Author: EarthPulse
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.8
12
12
  Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
15
16
  Requires-Dist: black (>=23.10.1,<24.0.0)
16
17
  Requires-Dist: geomet (>=1.0.0,<2.0.0)
17
18
  Requires-Dist: geopandas (>=0.13.2,<0.14.0)
@@ -0,0 +1 @@
1
+ __version__ = "2024.05.02"
@@ -3,7 +3,7 @@ Download imagery
3
3
  """
4
4
 
5
5
  from datetime import datetime
6
- from typing import Union, List
6
+ from typing import Union, List, Optional
7
7
 
8
8
  from .sentinelhub import (
9
9
  SHClient,
@@ -19,6 +19,7 @@ def download_sentinel_imagery(
19
19
  time_interval: Union[str, datetime, List[Union[str, datetime]]],
20
20
  bounding_box: List[Union[int, float]],
21
21
  sensor: str,
22
+ name: Optional[str] = None,
22
23
  ) -> None:
23
24
  """
24
25
  Download Sentinel imagery
@@ -28,9 +29,21 @@ def download_sentinel_imagery(
28
29
  client = SHClient()
29
30
  parameters = SH_PARAMETERS_DICT[sensor]()
30
31
 
31
- request = client.request_data(time_interval, bounding_box, parameters)
32
- client.download_data(request)
33
- imagery_from_tmp_to_dir(output)
32
+ results = search_sentinel_imagery(time_interval, bounding_box, sensor)
33
+ timestamps = [date.strftime("%Y-%m-%d") for date in results.get_timestamps()]
34
+
35
+ requests_list = []
36
+ for date in timestamps:
37
+ requests_list.append(client.request_data(date, bounding_box, parameters))
38
+ if len(requests_list) == 0:
39
+ print(f"No images found for {sensor} in the specified time: {time_interval}")
40
+ return
41
+ elif len(requests_list) <= 2:
42
+ bulk = False
43
+ else:
44
+ bulk = True
45
+ client.download_data(requests_list)
46
+ imagery_from_tmp_to_dir(output, name=name, bulk=bulk)
34
47
 
35
48
 
36
49
  def search_and_download_sentinel_imagery(
@@ -42,16 +55,9 @@ def search_and_download_sentinel_imagery(
42
55
  """
43
56
  Search and download Sentinel imagery
44
57
  """
45
- evaluate_sentinel_parameters(sensor, time_interval, bounding_box, output)
46
-
47
- client = SHClient()
48
- parameters = SH_PARAMETERS_DICT[sensor]()
49
-
50
- results = search_sentinel_imagery(time_interval, bounding_box, sensor)
51
- timestamps = [date.strftime("%Y-%m-%d") for date in results.get_timestamps()]
58
+ from warnings import warn
52
59
 
53
- requests_list = []
54
- for date in timestamps:
55
- requests_list.append(client.request_data(date, bounding_box, parameters))
56
- client.download_data(requests_list)
57
- imagery_from_tmp_to_dir(output)
60
+ warn(
61
+ "The function `search_and_download_sentinel_imagery` has been deprecated and will be removed in future updates. Please use download_satellite_imagery instead."
62
+ )
63
+ download_sentinel_imagery(output, time_interval, bounding_box, sensor)
@@ -49,7 +49,10 @@ def evaluate_sentinel_parameters(
49
49
 
50
50
 
51
51
  def imagery_from_tmp_to_dir(
52
- output_dir: str, tmp_dir: Optional[str] = "/tmp/sentinelhub"
52
+ output_dir: str,
53
+ tmp_dir: Optional[str] = "/tmp/sentinelhub",
54
+ name: Optional[str] = None,
55
+ bulk: Optional[bool] = False,
53
56
  ) -> None:
54
57
  """
55
58
  Copy imagery from tmp to output dir
@@ -63,10 +66,15 @@ def imagery_from_tmp_to_dir(
63
66
  for downloaded_file in downloaded_files:
64
67
  request_json = downloaded_file.replace("response.tiff", "request.json")
65
68
  metadata = generate_raster_metadata(downloaded_file, request_json)
66
- if metadata["acquisition-date"]:
67
- output_filename = f"{metadata['type']}_{metadata['acquisition-date']}"
69
+ if name and not bulk:
70
+ output_filename = name
71
+ elif name and bulk:
72
+ output_filename = f"{name}_{metadata['acquisition-date']}"
68
73
  else:
69
- output_filename = metadata["type"]
74
+ if metadata["acquisition-date"]:
75
+ output_filename = f"{metadata['type']}_{metadata['acquisition-date']}"
76
+ else:
77
+ output_filename = metadata["type"]
70
78
 
71
79
  copyfile(downloaded_file, f"{output_dir}/{output_filename}.tif")
72
80
  with open(f"{output_dir}/{output_filename}.json", "w", encoding="utf-8") as f:
@@ -1,3 +1,3 @@
1
- from .retrieve import retrieve_datasets # , retrieve_dataset, list_datasets
1
+ from .retrieve import retrieve_datasets, retrieve_dataset, retrieve_dataset_files
2
2
  from .ingest import ingest_dataset
3
3
  from .download import download_dataset, download_file_url
@@ -1 +1,2 @@
1
1
  from .ingest import ingest_files, create_new_version
2
+ from .list_files import list_files
@@ -0,0 +1,13 @@
1
+ from ..datasets import retrieve_dataset, retrieve_dataset_files
2
+ from ..models import retrieve_model, retrieve_model_files
3
+
4
+ def list_files(dataset_or_model_name, version=1):
5
+ try:
6
+ dataset = retrieve_dataset(dataset_or_model_name)
7
+ return retrieve_dataset_files(dataset['id'], version)
8
+ except Exception as e:
9
+ try:
10
+ model = retrieve_model(dataset_or_model_name)
11
+ return retrieve_model_files(model['id'], version)
12
+ except Exception as e:
13
+ raise Exception(f"Dataset or model {dataset_or_model_name} not found.")
@@ -0,0 +1,3 @@
1
+ from .retrieve import retrieve_models, retrieve_model, retrieve_model_files
2
+ from .ingest import ingest_model
3
+ from .download import download_model
@@ -2,6 +2,7 @@ import requests
2
2
  import os
3
3
  from tqdm import tqdm
4
4
  import hashlib
5
+ from io import BytesIO
5
6
 
6
7
  from ..repos import APIRepo
7
8
 
@@ -189,3 +190,11 @@ class FilesAPIRepo(APIRepo):
189
190
  headers=self.generate_headers(user),
190
191
  )
191
192
  return self.format_response(r)
193
+
194
+ def get_file_stream(self, dataset_id, filename, user, version=None):
195
+ url = self.url + f"datasets/{dataset_id}/download/{filename}"
196
+ if version is not None:
197
+ url += "?version=" + str(version)
198
+ headers = self.generate_headers(user)
199
+ response = requests.get(url, headers=headers, stream=True)
200
+ return BytesIO(response.content)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "eotdl"
3
- version = "2024.04.25"
3
+ version = "2024.05.02"
4
4
  description = "Earth Observation Training Data Lab"
5
5
  authors = ["EarthPulse <it@earthpulse.es>"]
6
6
  license = "MIT"
@@ -1 +0,0 @@
1
- __version__ = "2024.04.25"
@@ -1,3 +0,0 @@
1
- from .retrieve import retrieve_models
2
- from .ingest import ingest_model
3
- from .download import download_model
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes