eotdl 2025.4.2__tar.gz → 2025.4.2.post2__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.
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/PKG-INFO +8 -13
- eotdl-2025.4.2.post2/eotdl/__init__.py +1 -0
- eotdl-2025.4.2.post2/eotdl/repos/DatasetsAPIRepo.py +43 -0
- eotdl-2025.4.2.post2/eotdl/repos/FilesAPIRepo.py +103 -0
- eotdl-2025.4.2.post2/eotdl/repos/ModelsAPIRepo.py +41 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/repos/STACAPIRepo.py +0 -1
- eotdl-2025.4.2.post2/pyproject.toml +30 -0
- eotdl-2025.4.2.post2/uv.lock +614 -0
- eotdl-2025.4.2/_pyproject.toml +0 -43
- eotdl-2025.4.2/eotdl/__init__.py +0 -1
- eotdl-2025.4.2/eotdl/repos/DatasetsAPIRepo.py +0 -93
- eotdl-2025.4.2/eotdl/repos/FilesAPIRepo.py +0 -293
- eotdl-2025.4.2/eotdl/repos/ModelsAPIRepo.py +0 -88
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/.gitignore +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/README.md +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/airbus/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/airbus/client.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/airbus/parameters.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/airbus/utils.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/download.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/search.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/sentinelhub/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/sentinelhub/client.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/sentinelhub/evalscripts.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/sentinelhub/parameters.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/access/sentinelhub/utils.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/auth/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/auth/auth.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/auth/errors.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/auth/is_logged.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/auth/logout.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/cli.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/commands/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/commands/auth.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/commands/datasets.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/commands/models.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/commands/stac.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/curation/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/curation/stac/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/curation/stac/api.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/curation/stac/stac.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/datasets/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/datasets/ingest.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/datasets/retrieve.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/datasets/stage.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/datasets/update.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/files/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/files/ingest.bck +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/files/ingest.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/files/metadata.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/models/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/models/download.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/models/ingest.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/models/retrieve.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/models/stage.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/models/update.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/repos/APIRepo.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/repos/AuthAPIRepo.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/repos/AuthRepo.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/repos/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/shared/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/shared/checksum.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/tools/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/tools/geo_utils.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/tools/metadata.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/tools/paths.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/tools/stac.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/tools/time_utils.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/tools/tools.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/wrappers/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl/wrappers/models.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/eotdl.png +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/main.py +0 -0
- /eotdl-2025.4.2/pyproject.toml → /eotdl-2025.4.2.post2/pyproject.toml.bck +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/_test_access.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/_test_hello.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/_test_auth.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/access/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/fixtures.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac/catalog.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/Jaca_1/Jaca_1.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/Jaca_2/Jaca_2.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/Jaca_3/Jaca_3.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/Jaca_4/Jaca_4.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac/sentinel-2-l2a/collection.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/catalog.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/Jaca_1/Jaca_1.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/Jaca_2/Jaca_2.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/Jaca_3/Jaca_3.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/Jaca_4/Jaca_4.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/labels/collection.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/Jaca_1/Jaca_1.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/Jaca_2/Jaca_2.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/Jaca_3/Jaca_3.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/Jaca_4/Jaca_4.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/jaca_dataset_stac_labels/sentinel-2-l2a/collection.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/labels_scaneo/Jaca_1_labels.geojson +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/labels_scaneo/Jaca_2_labels.geojson +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/labels_scaneo/Jaca_3_labels.geojson +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/labels_scaneo/Jaca_4_labels.geojson +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/labels_scaneo/labels.json +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/sentinel_2/Boadella_2020-01-13.tif +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/sentinel_2/Boadella_2020-01-13_labels.geojson +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/sentinel_2/Boadella_2020-01-28.tif +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_data/sentinel_2/Boadella_2020-02-02_labels.geojson +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_dataframe.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_extent.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_labels.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_ml_dataset.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/curation/stac/test_stac.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/datasets/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/datasets/_test_datasets.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/datasets/_test_download_dataset.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/datasets/_test_retrieve_datasets.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/tools/__init__.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/tools/test_geo_utils.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/tools/test_metadata.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/tools/test_paths.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/tools/test_time_utils.py +0 -0
- {eotdl-2025.4.2 → eotdl-2025.4.2.post2}/tests/unit/tools/test_tools.py +0 -0
@@ -1,23 +1,18 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: eotdl
|
3
|
-
Version: 2025.4.2
|
3
|
+
Version: 2025.4.2.post2
|
4
4
|
Summary: Earth Observation Training Data Lab
|
5
5
|
Author-email: earthpulse <it@earthpulse.es>
|
6
6
|
License-Expression: MIT
|
7
|
-
Requires-Python: >=3.
|
8
|
-
Requires-Dist:
|
9
|
-
Requires-Dist:
|
10
|
-
Requires-Dist:
|
11
|
-
Requires-Dist:
|
12
|
-
Requires-Dist: pyjwt>=2.9.0
|
13
|
-
Requires-Dist: pystac>=1.8.4
|
7
|
+
Requires-Python: >=3.12
|
8
|
+
Requires-Dist: geopandas>=1.0.1
|
9
|
+
Requires-Dist: pydantic>=2.11.1
|
10
|
+
Requires-Dist: pyjwt>=2.10.1
|
11
|
+
Requires-Dist: pystac>=1.12.2
|
14
12
|
Requires-Dist: python-frontmatter>=1.1.0
|
15
|
-
Requires-Dist:
|
16
|
-
Requires-Dist: rasterio>=1.3.11
|
17
|
-
Requires-Dist: requests>=2.32.3
|
18
|
-
Requires-Dist: sentinelhub>=3.11.1
|
13
|
+
Requires-Dist: stac-geoparquet>=0.6.0
|
19
14
|
Requires-Dist: tqdm>=4.67.1
|
20
|
-
Requires-Dist: typer>=0.15.
|
15
|
+
Requires-Dist: typer>=0.15.2
|
21
16
|
Description-Content-Type: text/markdown
|
22
17
|
|
23
18
|
<p align="center">
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "2025.04.02-2"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import requests
|
2
|
+
|
3
|
+
from ..repos import APIRepo
|
4
|
+
|
5
|
+
class DatasetsAPIRepo(APIRepo):
|
6
|
+
def __init__(self, url=None):
|
7
|
+
super().__init__(url)
|
8
|
+
|
9
|
+
def retrieve_datasets(self, name, limit):
|
10
|
+
url = self.url + "datasets"
|
11
|
+
if name is not None:
|
12
|
+
url += "?match=" + name
|
13
|
+
if limit is not None:
|
14
|
+
if name is None:
|
15
|
+
url += "?limit=" + str(limit)
|
16
|
+
else:
|
17
|
+
url += "&limit=" + str(limit)
|
18
|
+
response = requests.get(url)
|
19
|
+
return self.format_response(response)
|
20
|
+
|
21
|
+
def retrieve_dataset(self, name):
|
22
|
+
response = requests.get(self.url + "datasets?name=" + name)
|
23
|
+
return self.format_response(response)
|
24
|
+
|
25
|
+
def get_dataset_by_id(self, dataset_id):
|
26
|
+
response = requests.get(self.url + "datasets/" + dataset_id)
|
27
|
+
return self.format_response(response)
|
28
|
+
|
29
|
+
def create_dataset(self, metadata, user):
|
30
|
+
response = requests.post(
|
31
|
+
self.url + "datasets",
|
32
|
+
json=metadata,
|
33
|
+
headers=self.generate_headers(user),
|
34
|
+
)
|
35
|
+
return self.format_response(response)
|
36
|
+
|
37
|
+
def complete_ingestion(self, dataset_id, version, size, user):
|
38
|
+
response = requests.post(
|
39
|
+
self.url + "datasets/complete/" + dataset_id,
|
40
|
+
json={"version": version, "size": size},
|
41
|
+
headers=self.generate_headers(user),
|
42
|
+
)
|
43
|
+
return self.format_response(response)
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import requests
|
2
|
+
import os
|
3
|
+
|
4
|
+
from ..repos import APIRepo
|
5
|
+
|
6
|
+
|
7
|
+
class FilesAPIRepo(APIRepo):
|
8
|
+
def __init__(self, url=None):
|
9
|
+
super().__init__(url)
|
10
|
+
|
11
|
+
def ingest_file(
|
12
|
+
self, file_path_or_bytes, file_name, dataset_or_model_id, user, endpoint, version=None
|
13
|
+
):
|
14
|
+
url = self.url + f"{endpoint}/{dataset_or_model_id}"
|
15
|
+
if version is not None:
|
16
|
+
url += "?version=" + str(version)
|
17
|
+
# get a presigned url to upload the file directly to the bucket
|
18
|
+
reponse = requests.post(
|
19
|
+
url,
|
20
|
+
json={
|
21
|
+
"file_name": file_name,
|
22
|
+
# "file_size": files_size,
|
23
|
+
# "checksum": checksum
|
24
|
+
},
|
25
|
+
headers=self.generate_headers(user),
|
26
|
+
)
|
27
|
+
data, error = self.format_response(reponse)
|
28
|
+
if error:
|
29
|
+
raise Exception(error)
|
30
|
+
# ingest the file
|
31
|
+
error = None
|
32
|
+
try:
|
33
|
+
presigned_url = data["presigned_url"]
|
34
|
+
if isinstance(file_path_or_bytes, (str, bytes)):
|
35
|
+
if isinstance(file_path_or_bytes, str):
|
36
|
+
# Handle file path
|
37
|
+
with open(file_path_or_bytes, 'rb') as f:
|
38
|
+
file_data = f.read()
|
39
|
+
else:
|
40
|
+
# Handle bytes directly
|
41
|
+
file_data = file_path_or_bytes
|
42
|
+
# Send file data to presigned URL
|
43
|
+
response = requests.put(presigned_url, data=file_data)
|
44
|
+
response.raise_for_status()
|
45
|
+
else:
|
46
|
+
raise TypeError("file_path_or_bytes must be either a file path string or bytes")
|
47
|
+
except Exception as e:
|
48
|
+
error = str(e)
|
49
|
+
return data, error
|
50
|
+
|
51
|
+
def stage_file(
|
52
|
+
self,
|
53
|
+
dataset_or_model_id,
|
54
|
+
file_name,
|
55
|
+
user,
|
56
|
+
path,
|
57
|
+
endpoint="datasets",
|
58
|
+
progress=False,
|
59
|
+
):
|
60
|
+
url = self.url + f"{endpoint}/{dataset_or_model_id}/stage/{file_name}"
|
61
|
+
# if file_version is not None:
|
62
|
+
# url += "?version=" + str(file_version)
|
63
|
+
return self.stage_file_url(url, path, user)
|
64
|
+
|
65
|
+
|
66
|
+
def stage_file_url(
|
67
|
+
self,
|
68
|
+
url,
|
69
|
+
path,
|
70
|
+
user,
|
71
|
+
):
|
72
|
+
if '/stage/' in url: # asset is in EOTDL (can do better...)
|
73
|
+
file_name = url.split("/stage/")[-1]
|
74
|
+
reponse = requests.get(url, headers=self.generate_headers(user))
|
75
|
+
data, error = self.format_response(reponse)
|
76
|
+
if error:
|
77
|
+
raise Exception(error)
|
78
|
+
presigned_url = data["presigned_url"]
|
79
|
+
else:
|
80
|
+
file_name = url.split("//")[-1]
|
81
|
+
presigned_url = url
|
82
|
+
file_path = f"{path}/{file_name}"
|
83
|
+
for i in range(1, len(file_path.split("/")) - 1):
|
84
|
+
os.makedirs("/".join(file_path.split("/")[: i + 1]), exist_ok=True)
|
85
|
+
try:
|
86
|
+
response = requests.get(presigned_url)
|
87
|
+
response.raise_for_status() # This will raise an HTTPError for 4XX and 5XX status codes
|
88
|
+
with open(file_path, 'wb') as f:
|
89
|
+
f.write(response.content)
|
90
|
+
except requests.exceptions.HTTPError as e:
|
91
|
+
raise Exception(f"Failed to stage file: {str(e)}")
|
92
|
+
except Exception as e:
|
93
|
+
raise Exception(f"Unexpected error while staging file: {str(e)}")
|
94
|
+
return file_path
|
95
|
+
|
96
|
+
def generate_presigned_url(self, filename, dataset_or_model_id, user, endpoint="datasets"):
|
97
|
+
url = f"{self.url}{endpoint}/{dataset_or_model_id}/stage/{filename}"
|
98
|
+
reponse = requests.get(url, headers=self.generate_headers(user))
|
99
|
+
data, error = self.format_response(reponse)
|
100
|
+
if error:
|
101
|
+
# print("ERROR generate_presigned_url", error)
|
102
|
+
return None
|
103
|
+
return data["presigned_url"]
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import requests
|
2
|
+
|
3
|
+
from ..repos import APIRepo
|
4
|
+
|
5
|
+
class ModelsAPIRepo(APIRepo):
|
6
|
+
def __init__(self, url=None):
|
7
|
+
super().__init__(url)
|
8
|
+
|
9
|
+
def retrieve_models(self, name, limit):
|
10
|
+
url = self.url + "models"
|
11
|
+
if name is not None:
|
12
|
+
url += "?match=" + name
|
13
|
+
if limit is not None:
|
14
|
+
if name is None:
|
15
|
+
url += "?limit=" + str(limit)
|
16
|
+
else:
|
17
|
+
url += "&limit=" + str(limit)
|
18
|
+
response = requests.get(url)
|
19
|
+
return self.format_response(response)
|
20
|
+
|
21
|
+
def retrieve_model(self, name):
|
22
|
+
response = requests.get(self.url + "models?name=" + name)
|
23
|
+
return self.format_response(response)
|
24
|
+
|
25
|
+
def create_model(self, metadata, user):
|
26
|
+
response = requests.post(
|
27
|
+
self.url + "models",
|
28
|
+
json=metadata,
|
29
|
+
headers=self.generate_headers(user),
|
30
|
+
)
|
31
|
+
return self.format_response(response)
|
32
|
+
|
33
|
+
def complete_ingestion(self, model_id, version, size, user):
|
34
|
+
response = requests.post(
|
35
|
+
self.url + "models/complete/" + model_id,
|
36
|
+
json={"version": version, "size": size},
|
37
|
+
headers=self.generate_headers(user),
|
38
|
+
)
|
39
|
+
return self.format_response(response)
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
[project]
|
2
|
+
name = "eotdl"
|
3
|
+
version = "2025.04.02-2"
|
4
|
+
description = "Earth Observation Training Data Lab"
|
5
|
+
authors = [
|
6
|
+
{name = "earthpulse", email = "it@earthpulse.es"},
|
7
|
+
]
|
8
|
+
license = "MIT"
|
9
|
+
readme = "README.md"
|
10
|
+
requires-python = ">=3.12"
|
11
|
+
dependencies = [
|
12
|
+
"geopandas>=1.0.1",
|
13
|
+
"pydantic>=2.11.1",
|
14
|
+
"pyjwt>=2.10.1",
|
15
|
+
"pystac>=1.12.2",
|
16
|
+
"python-frontmatter>=1.1.0",
|
17
|
+
"stac-geoparquet>=0.6.0",
|
18
|
+
"tqdm>=4.67.1",
|
19
|
+
"typer>=0.15.2",
|
20
|
+
]
|
21
|
+
|
22
|
+
[project.scripts]
|
23
|
+
eotdl = "eotdl.cli:app"
|
24
|
+
|
25
|
+
[build-system]
|
26
|
+
requires = ["hatchling"]
|
27
|
+
build-backend = "hatchling.build"
|
28
|
+
|
29
|
+
[tool.hatch.build.targets.wheel]
|
30
|
+
packages = ["eotdl"]
|