eotdl 2025.3.25__tar.gz → 2025.4.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 (126) hide show
  1. eotdl-2025.4.2/.gitignore +43 -0
  2. {eotdl-2025.3.25 → eotdl-2025.4.2}/PKG-INFO +19 -32
  3. eotdl-2025.3.25/pyproject.toml → eotdl-2025.4.2/_pyproject.toml +1 -1
  4. eotdl-2025.4.2/eotdl/__init__.py +1 -0
  5. eotdl-2025.4.2/eotdl/access/__init__.py +17 -0
  6. eotdl-2025.4.2/eotdl/access/download.py +97 -0
  7. eotdl-2025.4.2/eotdl/access/search.py +52 -0
  8. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/access/sentinelhub/__init__.py +6 -2
  9. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/access/sentinelhub/client.py +9 -8
  10. eotdl-2025.4.2/eotdl/access/sentinelhub/evalscripts.py +398 -0
  11. eotdl-2025.4.2/eotdl/access/sentinelhub/parameters.py +167 -0
  12. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/access/sentinelhub/utils.py +55 -20
  13. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/curation/stac/stac.py +1 -1
  14. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/datasets/__init__.py +1 -1
  15. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/datasets/ingest.py +9 -2
  16. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/datasets/stage.py +5 -5
  17. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/files/ingest.py +17 -11
  18. eotdl-2025.4.2/eotdl/models/download.py +101 -0
  19. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/models/ingest.py +11 -3
  20. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/models/stage.py +4 -1
  21. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/repos/FilesAPIRepo.py +1 -1
  22. eotdl-2025.4.2/eotdl/repos/ModelsAPIRepo.py +88 -0
  23. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/tools/time_utils.py +3 -3
  24. eotdl-2025.4.2/eotdl.png +0 -0
  25. eotdl-2025.4.2/main.py +5 -0
  26. eotdl-2025.4.2/pyproject.toml +35 -0
  27. eotdl-2025.4.2/tests/__init__.py +0 -0
  28. eotdl-2025.4.2/tests/_test_access.py +24 -0
  29. eotdl-2025.4.2/tests/_test_hello.py +6 -0
  30. eotdl-2025.4.2/tests/unit/__init__.py +0 -0
  31. eotdl-2025.4.2/tests/unit/_test_auth.py +97 -0
  32. eotdl-2025.4.2/tests/unit/access/__init__.py +0 -0
  33. eotdl-2025.4.2/tests/unit/curation/__init__.py +0 -0
  34. eotdl-2025.4.2/tests/unit/curation/stac/__init__.py +0 -0
  35. eotdl-2025.4.2/tests/unit/curation/stac/fixtures.py +76 -0
  36. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac/catalog.json +18 -0
  37. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/Jaca_1/Jaca_1.json +222 -0
  38. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/Jaca_2/Jaca_2.json +222 -0
  39. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/Jaca_3/Jaca_3.json +222 -0
  40. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/Jaca_4/Jaca_4.json +222 -0
  41. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/collection.json +59 -0
  42. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/catalog.json +23 -0
  43. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/Jaca_1/Jaca_1.json +98 -0
  44. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/Jaca_2/Jaca_2.json +98 -0
  45. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/Jaca_3/Jaca_3.json +98 -0
  46. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/Jaca_4/Jaca_4.json +98 -0
  47. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/collection.json +77 -0
  48. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/Jaca_1/Jaca_1.json +222 -0
  49. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/Jaca_2/Jaca_2.json +222 -0
  50. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/Jaca_3/Jaca_3.json +222 -0
  51. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/Jaca_4/Jaca_4.json +222 -0
  52. eotdl-2025.4.2/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/collection.json +59 -0
  53. eotdl-2025.4.2/tests/unit/curation/stac/test_data/labels_scaneo/Jaca_1_labels.geojson +1 -0
  54. eotdl-2025.4.2/tests/unit/curation/stac/test_data/labels_scaneo/Jaca_2_labels.geojson +1 -0
  55. eotdl-2025.4.2/tests/unit/curation/stac/test_data/labels_scaneo/Jaca_3_labels.geojson +1 -0
  56. eotdl-2025.4.2/tests/unit/curation/stac/test_data/labels_scaneo/Jaca_4_labels.geojson +1 -0
  57. eotdl-2025.4.2/tests/unit/curation/stac/test_data/labels_scaneo/labels.json +1 -0
  58. eotdl-2025.4.2/tests/unit/curation/stac/test_data/sentinel_2/Boadella_2020-01-13.tif +0 -0
  59. eotdl-2025.4.2/tests/unit/curation/stac/test_data/sentinel_2/Boadella_2020-01-13_labels.geojson +1 -0
  60. eotdl-2025.4.2/tests/unit/curation/stac/test_data/sentinel_2/Boadella_2020-01-28.tif +0 -0
  61. eotdl-2025.4.2/tests/unit/curation/stac/test_data/sentinel_2/Boadella_2020-02-02_labels.geojson +6255 -0
  62. eotdl-2025.4.2/tests/unit/curation/stac/test_dataframe.py +39 -0
  63. eotdl-2025.4.2/tests/unit/curation/stac/test_extent.py +33 -0
  64. eotdl-2025.4.2/tests/unit/curation/stac/test_labels.py +37 -0
  65. eotdl-2025.4.2/tests/unit/curation/stac/test_ml_dataset.py +96 -0
  66. eotdl-2025.4.2/tests/unit/curation/stac/test_stac.py +89 -0
  67. eotdl-2025.4.2/tests/unit/datasets/__init__.py +0 -0
  68. eotdl-2025.4.2/tests/unit/datasets/_test_datasets.py +114 -0
  69. eotdl-2025.4.2/tests/unit/datasets/_test_download_dataset.py +19 -0
  70. eotdl-2025.4.2/tests/unit/datasets/_test_retrieve_datasets.py +117 -0
  71. eotdl-2025.4.2/tests/unit/tools/__init__.py +0 -0
  72. eotdl-2025.4.2/tests/unit/tools/test_geo_utils.py +132 -0
  73. eotdl-2025.4.2/tests/unit/tools/test_metadata.py +50 -0
  74. eotdl-2025.4.2/tests/unit/tools/test_paths.py +40 -0
  75. eotdl-2025.4.2/tests/unit/tools/test_time_utils.py +107 -0
  76. eotdl-2025.4.2/tests/unit/tools/test_tools.py +6 -0
  77. eotdl-2025.3.25/eotdl/__init__.py +0 -1
  78. eotdl-2025.3.25/eotdl/access/__init__.py +0 -7
  79. eotdl-2025.3.25/eotdl/access/download.py +0 -63
  80. eotdl-2025.3.25/eotdl/access/search.py +0 -24
  81. eotdl-2025.3.25/eotdl/access/sentinelhub/evalscripts.py +0 -132
  82. eotdl-2025.3.25/eotdl/access/sentinelhub/parameters.py +0 -89
  83. eotdl-2025.3.25/eotdl/repos/ModelsAPIRepo.py +0 -80
  84. {eotdl-2025.3.25 → eotdl-2025.4.2}/README.md +0 -0
  85. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/access/airbus/__init__.py +0 -0
  86. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/access/airbus/client.py +0 -0
  87. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/access/airbus/parameters.py +0 -0
  88. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/access/airbus/utils.py +0 -0
  89. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/auth/__init__.py +0 -0
  90. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/auth/auth.py +0 -0
  91. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/auth/errors.py +0 -0
  92. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/auth/is_logged.py +0 -0
  93. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/auth/logout.py +0 -0
  94. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/cli.py +0 -0
  95. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/commands/__init__.py +0 -0
  96. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/commands/auth.py +0 -0
  97. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/commands/datasets.py +0 -0
  98. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/commands/models.py +0 -0
  99. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/commands/stac.py +0 -0
  100. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/curation/__init__.py +0 -0
  101. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/curation/stac/__init__.py +0 -0
  102. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/curation/stac/api.py +0 -0
  103. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/datasets/retrieve.py +0 -0
  104. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/datasets/update.py +0 -0
  105. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/files/__init__.py +0 -0
  106. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/files/ingest.bck +0 -0
  107. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/files/metadata.py +0 -0
  108. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/models/__init__.py +0 -0
  109. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/models/retrieve.py +0 -0
  110. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/models/update.py +0 -0
  111. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/repos/APIRepo.py +0 -0
  112. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/repos/AuthAPIRepo.py +0 -0
  113. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/repos/AuthRepo.py +0 -0
  114. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/repos/DatasetsAPIRepo.py +0 -0
  115. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/repos/STACAPIRepo.py +0 -0
  116. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/repos/__init__.py +0 -0
  117. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/shared/__init__.py +0 -0
  118. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/shared/checksum.py +0 -0
  119. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/tools/__init__.py +0 -0
  120. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/tools/geo_utils.py +0 -0
  121. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/tools/metadata.py +0 -0
  122. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/tools/paths.py +0 -0
  123. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/tools/stac.py +0 -0
  124. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/tools/tools.py +0 -0
  125. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/wrappers/__init__.py +0 -0
  126. {eotdl-2025.3.25 → eotdl-2025.4.2}/eotdl/wrappers/models.py +0 -0
@@ -0,0 +1,43 @@
1
+ __pycache__
2
+ .pytest_cache
3
+ dist
4
+ .DS_Store
5
+ node_modules
6
+ build
7
+ .svelte-kit
8
+ package
9
+ .env
10
+ .env.*
11
+ .conda
12
+ !.env.example
13
+ yarn.lock
14
+ poetry.lock
15
+ .vercel
16
+ data
17
+ metadata
18
+ eurosat-stac
19
+ .ipynb_checkpoints
20
+ eurosat-stac**
21
+ .coverage
22
+ data
23
+ db
24
+ *.zip
25
+ docker-compose.prod.yml
26
+ tutorials/*md
27
+ !test.zip
28
+ .vscode
29
+ kk
30
+ auth.json
31
+ node_modules/
32
+ /test-results/
33
+ playwright-report
34
+ playwright/.cache/
35
+ test-results
36
+ lightning_logs
37
+ jobs.csv
38
+ *.parquet
39
+ download_commands.txt
40
+ _data
41
+ datasets.csv
42
+ files_map.csv
43
+ models.csv
@@ -1,36 +1,23 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: eotdl
3
- Version: 2025.3.25
3
+ Version: 2025.4.2
4
4
  Summary: Earth Observation Training Data Lab
5
- License: MIT
6
- Author: EarthPulse
7
- Author-email: it@earthpulse.es
8
- Requires-Python: >=3.8,<4.0
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.8
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
- Requires-Dist: black (>=23.10.1,<24.0.0)
18
- Requires-Dist: geomet (>=1.0.0,<2.0.0)
19
- Requires-Dist: geopandas (>=0.13.2,<0.14.0)
20
- Requires-Dist: markdown (>=3.5.2,<4.0.0)
21
- Requires-Dist: markdownify (>=0.11.6,<0.12.0)
22
- Requires-Dist: mypy (>=1.6.1,<2.0.0)
23
- Requires-Dist: openeo (>=0.31.0,<0.32.0)
24
- Requires-Dist: pydantic (>=1.10.6,<2.0.0)
25
- Requires-Dist: pyjwt (>=2.6.0,<3.0.0)
26
- Requires-Dist: pystac[validation] (==1.8.2)
27
- Requires-Dist: python-frontmatter (>=1.1.0,<2.0.0)
28
- Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
29
- Requires-Dist: rasterio (>=1.3.9,<2.0.0)
30
- Requires-Dist: requests (>=2.28.2,<3.0.0)
31
- Requires-Dist: sentinelhub (>=3.9.1,<4.0.0)
32
- Requires-Dist: tqdm (>=4.65.0,<5.0.0)
33
- Requires-Dist: typer[all] (>=0.9.0,<0.10.0)
5
+ Author-email: earthpulse <it@earthpulse.es>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.8
8
+ Requires-Dist: geomet>=1.1.0
9
+ Requires-Dist: geopandas>=0.13.2
10
+ Requires-Dist: markdown>=3.7
11
+ Requires-Dist: pydantic>=2.10.6
12
+ Requires-Dist: pyjwt>=2.9.0
13
+ Requires-Dist: pystac>=1.8.4
14
+ Requires-Dist: python-frontmatter>=1.1.0
15
+ Requires-Dist: pyyaml>=6.0.2
16
+ Requires-Dist: rasterio>=1.3.11
17
+ Requires-Dist: requests>=2.32.3
18
+ Requires-Dist: sentinelhub>=3.11.1
19
+ Requires-Dist: tqdm>=4.67.1
20
+ Requires-Dist: typer>=0.15.1
34
21
  Description-Content-Type: text/markdown
35
22
 
36
23
  <p align="center">
@@ -63,4 +50,4 @@ One of the most limiting factors of AI for EO applications is the scarcity of su
63
50
 
64
51
  Generating TDS is time consuming and expensive. Data access is usually limited and costly, especially for Very High Resolution (VHR) images that allow objects like trees to be clearly identified. In some cases, domain experts or even in-person (in-situ) trips are required to manually confirm the objects in a satellite image are correctly annotated with a high degree of quality. This results in the field of AI for EO applications lagging when compared to other fields, impeding the development of new applications and limiting the full potential of AI in EO.
65
52
 
66
- The European Space Agency (ESA) Earth Observation Training Data Lab (EOTDL) will address key limitations and capability gaps for working with Machine Learning (ML) training data in EO by providing a set of open-source tools to create, share, and improve datasets as well as training ML algorithms in the cloud. EOTDL will also offer an online repository where datasets and models can be explored and accessed.
53
+ The European Space Agency (ESA) Earth Observation Training Data Lab (EOTDL) will address key limitations and capability gaps for working with Machine Learning (ML) training data in EO by providing a set of open-source tools to create, share, and improve datasets as well as training ML algorithms in the cloud. EOTDL will also offer an online repository where datasets and models can be explored and accessed.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "eotdl"
3
- version = "2025.03.25"
3
+ version = "2024.10.07"
4
4
  description = "Earth Observation Training Data Lab"
5
5
  authors = ["EarthPulse <it@earthpulse.es>"]
6
6
  license = "MIT"
@@ -0,0 +1 @@
1
+ __version__ = "2025.04.02"
@@ -0,0 +1,17 @@
1
+ """
2
+ Data access module for eotdl package.
3
+ """
4
+
5
+ from .download import (
6
+ download_sentinel_imagery,
7
+ search_and_download_sentinel_imagery,
8
+ advanced_imagery_download,
9
+ )
10
+ from .search import search_sentinel_imagery, advanced_imagery_search
11
+ from .sentinelhub.parameters import (
12
+ SUPPORTED_COLLECTION_IDS,
13
+ DATA_COLLECTION_ID,
14
+ get_default_parameters,
15
+ OUTPUT_FORMAT,
16
+ )
17
+ from .sentinelhub.evalscripts import EvalScripts
@@ -0,0 +1,97 @@
1
+ """
2
+ Download imagery
3
+ """
4
+
5
+ from datetime import datetime, timedelta
6
+ from typing import Union, List, Optional
7
+
8
+ from .sentinelhub import (
9
+ SHClient,
10
+ evaluate_sentinel_parameters,
11
+ imagery_from_tmp_to_dir,
12
+ get_default_parameters,
13
+ SHParameters,
14
+ filter_times,
15
+ )
16
+ from .search import advanced_imagery_search
17
+
18
+
19
+ def download_sentinel_imagery(
20
+ output: str,
21
+ time_interval: Union[str, datetime, List[Union[str, datetime]]],
22
+ bounding_box: List[Union[int, float]],
23
+ collection_id: str,
24
+ name: Optional[str] = None,
25
+ ) -> None:
26
+ """
27
+ Download Sentinel imagery
28
+ """
29
+ evaluate_sentinel_parameters(time_interval, bounding_box, collection_id, output)
30
+ parameters = get_default_parameters(collection_id)
31
+ return advanced_imagery_download(
32
+ output, time_interval, bounding_box, parameters, name
33
+ )
34
+
35
+
36
+ def advanced_imagery_download(
37
+ output: str,
38
+ time_interval: Union[str, datetime, List[Union[str, datetime]]],
39
+ bounding_box: List[Union[int, float]],
40
+ parameters: SHParameters,
41
+ name: Optional[str] = None,
42
+ ) -> None:
43
+ """
44
+ Advanced imagery download
45
+ """
46
+ evaluate_sentinel_parameters(
47
+ time_interval, bounding_box, output=output, parameters=parameters
48
+ )
49
+ client = SHClient(parameters.BASE_URL)
50
+
51
+ results = advanced_imagery_search(time_interval, bounding_box, parameters)
52
+ timestamps = results.get_timestamps()
53
+ time_difference = timedelta(hours=1)
54
+ filtered_timestamps = filter_times(timestamps, time_difference)
55
+
56
+ requests_list = []
57
+ for date in filtered_timestamps:
58
+ timestamp_interval = (date - time_difference, date + time_difference)
59
+ requests_list.append(
60
+ client.request_data(timestamp_interval, bounding_box, parameters)
61
+ )
62
+ if len(requests_list) == 0:
63
+ print(
64
+ f"No images found for {parameters.DATA_COLLECTION.api_id} in the specified time: {time_interval}"
65
+ )
66
+ return
67
+ elif len(requests_list) <= 2:
68
+ bulk = False
69
+ else:
70
+ bulk = True
71
+
72
+ client.download_data(requests_list)
73
+ imagery_from_tmp_to_dir(
74
+ output,
75
+ bounding_box,
76
+ client.tmp_dir,
77
+ name=name,
78
+ bulk=bulk,
79
+ output_format=parameters.OUTPUT_FORMAT.value,
80
+ )
81
+
82
+
83
+ def search_and_download_sentinel_imagery(
84
+ output: str,
85
+ time_interval: Union[str, datetime, List[Union[str, datetime]]],
86
+ bounding_box: List[Union[int, float]],
87
+ sensor: str,
88
+ ) -> None:
89
+ """
90
+ Search and download Sentinel imagery
91
+ """
92
+ from warnings import warn
93
+
94
+ warn(
95
+ "The function `search_and_download_sentinel_imagery` has been deprecated and will be removed in future updates. Please use download_satellite_imagery instead."
96
+ )
97
+ download_sentinel_imagery(output, time_interval, bounding_box, sensor)
@@ -0,0 +1,52 @@
1
+ """
2
+ Search imagery
3
+ """
4
+
5
+ from typing import Union, List
6
+ from datetime import datetime
7
+
8
+ from .sentinelhub import (
9
+ SHClient,
10
+ get_default_parameters,
11
+ evaluate_sentinel_parameters,
12
+ SHParameters,
13
+ supports_cloud_coverage,
14
+ )
15
+
16
+
17
+ def search_sentinel_imagery(
18
+ time_interval: Union[str, datetime, List[Union[str, datetime]]],
19
+ bounding_box: List[Union[int, float]],
20
+ collection_id: str,
21
+ ) -> None:
22
+ """
23
+ Search Sentinel imagery
24
+ """
25
+ evaluate_sentinel_parameters(
26
+ time_interval, bounding_box, collection_id, output_needed=False
27
+ )
28
+ parameters = get_default_parameters(collection_id)
29
+ client = SHClient(parameters.BASE_URL)
30
+ return client.search_data(bounding_box, time_interval, parameters)
31
+
32
+
33
+ def advanced_imagery_search(
34
+ time_interval: Union[str, datetime, List[Union[str, datetime]]],
35
+ bounding_box: List[Union[int, float]],
36
+ parameters: SHParameters,
37
+ ) -> None:
38
+ """
39
+ Advanced imagery search
40
+ """
41
+ evaluate_sentinel_parameters(
42
+ time_interval, bounding_box, output_needed=False, parameters=parameters
43
+ )
44
+
45
+ if (
46
+ supports_cloud_coverage(parameters.DATA_COLLECTION.api_id)
47
+ and parameters.MAX_CLOUD_COVERAGE
48
+ ):
49
+ parameters.FILTER = "eo:cloud_cover < " + str(parameters.MAX_CLOUD_COVERAGE)
50
+
51
+ client = SHClient(parameters.BASE_URL)
52
+ return client.search_data(bounding_box, time_interval, parameters)
@@ -3,6 +3,10 @@ Sentinel-Hub data access module.
3
3
  """
4
4
 
5
5
  from .client import SHClient
6
- from .parameters import SHParameters, SH_PARAMETERS_DICT
6
+ from .parameters import (
7
+ SHParameters,
8
+ supports_cloud_coverage,
9
+ get_default_parameters,
10
+ )
7
11
  from .evalscripts import EvalScripts
8
- from .utils import evaluate_sentinel_parameters, imagery_from_tmp_to_dir
12
+ from .utils import evaluate_sentinel_parameters, imagery_from_tmp_to_dir, filter_times
@@ -3,6 +3,7 @@ Module for managing the Sentinel Hub configuration and data access
3
3
  """
4
4
 
5
5
  import json
6
+ from datetime import datetime
6
7
  from os import getenv
7
8
  from os.path import exists
8
9
  from sentinelhub import (
@@ -13,12 +14,11 @@ from sentinelhub import (
13
14
  CRS,
14
15
  SentinelHubRequest,
15
16
  SentinelHubDownloadClient,
16
- MimeType,
17
17
  )
18
+ import uuid
18
19
 
19
20
  from ...repos.AuthRepo import AuthRepo
20
21
  from .parameters import SHParameters
21
- from ...tools.time_utils import prepare_time_interval
22
22
  from ...tools.geo_utils import compute_image_size
23
23
 
24
24
 
@@ -27,7 +27,7 @@ class SHClient:
27
27
  Client class to manage the Sentinel Hub Python interface.
28
28
  """
29
29
 
30
- def __init__(self) -> None:
30
+ def __init__(self, base_url) -> None:
31
31
  """ """
32
32
  self.config = SHConfig()
33
33
  if getenv("SH_CLIENT_ID") and getenv("SH_CLIENT_SECRET"):
@@ -56,8 +56,9 @@ class SHClient:
56
56
  else:
57
57
  self.config.sh_client_id = creds["SH_CLIENT_ID"]
58
58
  self.config.sh_client_secret = creds["SH_CLIENT_SECRET"]
59
+ self.config.sh_base_url = base_url
59
60
  self.catalog = SentinelHubCatalog(config=self.config)
60
- self.tmp_dir = "/tmp/sentinelhub"
61
+ self.tmp_dir = "/tmp/sentinelhub/" + str(uuid.uuid4())
61
62
 
62
63
  def search_data(
63
64
  self, bounding_box: list, time_interval: list, parameters: SHParameters
@@ -76,12 +77,11 @@ class SHClient:
76
77
  return search_iterator
77
78
 
78
79
  def request_data(
79
- self, time_interval, bounding_box: list, parameters: SHParameters
80
+ self, time_interval: datetime, bounding_box: list, parameters: SHParameters
80
81
  ) -> list:
81
82
  """
82
83
  Request data from Sentinel Hub
83
84
  """
84
- time_interval = prepare_time_interval(time_interval)
85
85
  bounding_box, _ = compute_image_size(bounding_box, parameters)
86
86
 
87
87
  return SentinelHubRequest(
@@ -94,7 +94,9 @@ class SHClient:
94
94
  mosaicking_order=parameters.MOSAICKING_ORDER,
95
95
  )
96
96
  ],
97
- responses=[SentinelHubRequest.output_response("default", MimeType.TIFF)],
97
+ responses=[
98
+ SentinelHubRequest.output_response("default", parameters.OUTPUT_FORMAT)
99
+ ],
98
100
  bbox=bounding_box,
99
101
  size=bbox_to_dimensions(bounding_box, parameters.RESOLUTION),
100
102
  config=self.config,
@@ -109,5 +111,4 @@ class SHClient:
109
111
  requests = [requests]
110
112
  download_requests = [request.download_list[0] for request in requests]
111
113
  data = download_client.download(download_requests)
112
-
113
114
  return data