eotdl 2023.11.3.post4__py3-none-any.whl → 2024.2.15__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.
- eotdl/__init__.py +1 -1
- eotdl/access/__init__.py +0 -0
- eotdl/access/airbus/__init__.py +0 -0
- eotdl/access/airbus/client.py +0 -0
- eotdl/access/airbus/parameters.py +0 -0
- eotdl/access/airbus/utils.py +0 -0
- eotdl/access/download.py +0 -0
- eotdl/access/search.py +0 -0
- eotdl/access/sentinelhub/__init__.py +0 -0
- eotdl/access/sentinelhub/client.py +0 -0
- eotdl/access/sentinelhub/evalscripts.py +0 -4
- eotdl/access/sentinelhub/parameters.py +3 -4
- eotdl/access/sentinelhub/utils.py +2 -1
- eotdl/auth/__init__.py +0 -0
- eotdl/auth/auth.py +43 -29
- eotdl/auth/errors.py +0 -0
- eotdl/auth/is_logged.py +0 -0
- eotdl/auth/logout.py +0 -0
- eotdl/cli.py +0 -0
- eotdl/commands/__init__.py +0 -0
- eotdl/commands/auth.py +0 -0
- eotdl/commands/datasets.py +0 -0
- eotdl/commands/models.py +0 -0
- eotdl/curation/__init__.py +0 -0
- eotdl/curation/stac/__init__.py +0 -0
- eotdl/curation/stac/assets.py +3 -43
- eotdl/curation/stac/dataframe.py +14 -3
- eotdl/curation/stac/dataframe_bck.py +0 -0
- eotdl/curation/stac/dataframe_labeling.py +0 -0
- eotdl/curation/stac/extensions/__init__.py +0 -0
- eotdl/curation/stac/extensions/base.py +0 -0
- eotdl/curation/stac/extensions/dem.py +0 -0
- eotdl/curation/stac/extensions/eo.py +0 -0
- eotdl/curation/stac/extensions/label/__init__.py +0 -0
- eotdl/curation/stac/extensions/label/base.py +0 -0
- eotdl/curation/stac/extensions/label/image_name_labeler.py +0 -0
- eotdl/curation/stac/extensions/label/scaneo.py +3 -2
- eotdl/curation/stac/extensions/ml_dataset.py +0 -0
- eotdl/curation/stac/extensions/projection.py +0 -0
- eotdl/curation/stac/extensions/raster.py +0 -0
- eotdl/curation/stac/extensions/sar.py +0 -0
- eotdl/curation/stac/extent.py +0 -0
- eotdl/curation/stac/parsers.py +0 -0
- eotdl/curation/stac/stac.py +0 -0
- eotdl/datasets/__init__.py +0 -0
- eotdl/datasets/download.py +4 -6
- eotdl/datasets/ingest.py +6 -9
- eotdl/datasets/metadata.py +0 -0
- eotdl/datasets/retrieve.py +0 -0
- eotdl/files/__init__.py +0 -0
- eotdl/files/ingest.py +6 -6
- eotdl/models/__init__.py +0 -0
- eotdl/models/download.py +1 -10
- eotdl/models/ingest.py +2 -2
- eotdl/models/metadata.py +0 -0
- eotdl/models/retrieve.py +0 -0
- eotdl/repos/APIRepo.py +7 -0
- eotdl/repos/AuthAPIRepo.py +9 -2
- eotdl/repos/AuthRepo.py +7 -3
- eotdl/repos/DatasetsAPIRepo.py +10 -71
- eotdl/repos/FilesAPIRepo.py +17 -35
- eotdl/repos/ModelsAPIRepo.py +4 -4
- eotdl/repos/__init__.py +0 -0
- eotdl/shared/__init__.py +0 -0
- eotdl/shared/checksum.py +0 -0
- eotdl/tools/__init__.py +0 -0
- eotdl/tools/geo_utils.py +0 -0
- eotdl/tools/metadata.py +0 -0
- eotdl/tools/paths.py +0 -0
- eotdl/tools/stac.py +0 -0
- eotdl/tools/time_utils.py +0 -0
- eotdl/tools/tools.py +4 -4
- {eotdl-2023.11.3.post4.dist-info → eotdl-2024.2.15.dist-info}/METADATA +2 -5
- {eotdl-2023.11.3.post4.dist-info → eotdl-2024.2.15.dist-info}/RECORD +24 -32
- eotdl/datasets/usecases/__init__.py +0 -0
- eotdl/datasets/usecases/datasets/DownloadFile.py +0 -30
- eotdl/datasets/usecases/datasets/DownloadFileURL.py +0 -22
- eotdl/datasets/usecases/datasets/IngestDataset.py +0 -30
- eotdl/datasets/usecases/datasets/IngestLargeDataset.py +0 -43
- eotdl/datasets/usecases/datasets/IngestLargeDatasetParallel.py +0 -51
- eotdl/datasets/usecases/datasets/IngestSTAC.py +0 -77
- eotdl/datasets/usecases/datasets/__init__.py +0 -9
- {eotdl-2023.11.3.post4.dist-info → eotdl-2024.2.15.dist-info}/WHEEL +0 -0
- {eotdl-2023.11.3.post4.dist-info → eotdl-2024.2.15.dist-info}/entry_points.txt +0 -0
@@ -1,77 +0,0 @@
|
|
1
|
-
from pydantic import BaseModel
|
2
|
-
import json
|
3
|
-
from pathlib import Path
|
4
|
-
from tqdm import tqdm
|
5
|
-
|
6
|
-
from ....curation.stac import STACDataFrame
|
7
|
-
|
8
|
-
|
9
|
-
class IngestSTAC:
|
10
|
-
def __init__(self, repo, ingest_file, allowed_extensions, logger):
|
11
|
-
self.repo = repo
|
12
|
-
self.ingest_file = ingest_file
|
13
|
-
self.allowed_extensions = allowed_extensions
|
14
|
-
self.logger = logger if logger else print
|
15
|
-
|
16
|
-
class Inputs(BaseModel):
|
17
|
-
stac_catalog: Path
|
18
|
-
user: dict
|
19
|
-
|
20
|
-
class Outputs(BaseModel):
|
21
|
-
dataset: dict
|
22
|
-
|
23
|
-
def __call__(self, inputs: Inputs) -> Outputs:
|
24
|
-
# retrieve the user's geodb credentials
|
25
|
-
# creds, error = self.repo.retrieve_credentials(inputs.user["id_token"])
|
26
|
-
# self.validate_credentials(creds)
|
27
|
-
# load the STAC catalog as a STACsetFrame
|
28
|
-
self.logger("Loading STAC catalog...")
|
29
|
-
df = STACDataFrame.from_stac_file(inputs.stac_catalog)
|
30
|
-
catalog = df[df["type"] == "Catalog"]
|
31
|
-
assert len(catalog) == 1, "STAC catalog must have exactly one root catalog"
|
32
|
-
dataset_name = catalog.id.iloc[0]
|
33
|
-
# create dataset
|
34
|
-
data, error = self.repo.create_stac_dataset(
|
35
|
-
dataset_name, inputs.user["id_token"]
|
36
|
-
)
|
37
|
-
if error:
|
38
|
-
data, error2 = self.repo.retrieve_dataset(dataset_name)
|
39
|
-
if error2:
|
40
|
-
raise Exception(error)
|
41
|
-
if data["uid"] != inputs.user["sub"]:
|
42
|
-
raise Exception("Dataset already exists.")
|
43
|
-
dataset_id = data["id"]
|
44
|
-
# TODO: put size to 0 or else will add up
|
45
|
-
else:
|
46
|
-
dataset_id = data["dataset_id"]
|
47
|
-
# TODO: check that we can ingest in geodb
|
48
|
-
# upload all assets to EOTDL
|
49
|
-
self.logger("Uploading assets...")
|
50
|
-
df2 = df.dropna(subset=["assets"])
|
51
|
-
for row in tqdm(df2.iterrows(), total=len(df2)):
|
52
|
-
# for asset in df.assets.dropna().values[:10]:
|
53
|
-
try:
|
54
|
-
for k, v in row[1]["assets"].items():
|
55
|
-
data = self.ingest_file(
|
56
|
-
v["href"],
|
57
|
-
dataset_id,
|
58
|
-
self.logger,
|
59
|
-
self.allowed_extensions + [".tif", ".tiff", ".jpg"],
|
60
|
-
verbose=False,
|
61
|
-
root=inputs.stac_catalog.parent.parent, # esto será siempre así en STAC?
|
62
|
-
)
|
63
|
-
file_url = f"{self.repo.url}datasets/{data['dataset_id']}/download/{data['file_name']}"
|
64
|
-
df.loc[row[0], "assets"][k]["href"] = file_url
|
65
|
-
except Exception as e:
|
66
|
-
self.logger(f"Error uploading asset {row[0]}: {e}")
|
67
|
-
break
|
68
|
-
# ingest the STAC catalog into geodb
|
69
|
-
self.logger("Ingesting STAC catalog...")
|
70
|
-
data, error = self.repo.ingest_stac(
|
71
|
-
json.loads(df.to_json()), dataset_id, inputs.user["id_token"]
|
72
|
-
)
|
73
|
-
if error:
|
74
|
-
# TODO: delete all assets that were uploaded
|
75
|
-
raise Exception(error)
|
76
|
-
self.logger("Done")
|
77
|
-
return self.Outputs(dataset=data)
|
@@ -1,9 +0,0 @@
|
|
1
|
-
from .DownloadDataset import DownloadDataset
|
2
|
-
from .DownloadFileURL import DownloadFileURL
|
3
|
-
from .IngestDataset import IngestDataset
|
4
|
-
from .IngestLargeDataset import IngestLargeDataset
|
5
|
-
from .RetrieveDataset import RetrieveDataset
|
6
|
-
from .RetrieveDatasets import RetrieveDatasets
|
7
|
-
from .IngestFile import IngestFile
|
8
|
-
from .IngestFolder import IngestFolder
|
9
|
-
from .IngestSTAC import IngestSTAC
|
File without changes
|
File without changes
|