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.
Files changed (84) hide show
  1. eotdl/__init__.py +1 -1
  2. eotdl/access/__init__.py +0 -0
  3. eotdl/access/airbus/__init__.py +0 -0
  4. eotdl/access/airbus/client.py +0 -0
  5. eotdl/access/airbus/parameters.py +0 -0
  6. eotdl/access/airbus/utils.py +0 -0
  7. eotdl/access/download.py +0 -0
  8. eotdl/access/search.py +0 -0
  9. eotdl/access/sentinelhub/__init__.py +0 -0
  10. eotdl/access/sentinelhub/client.py +0 -0
  11. eotdl/access/sentinelhub/evalscripts.py +0 -4
  12. eotdl/access/sentinelhub/parameters.py +3 -4
  13. eotdl/access/sentinelhub/utils.py +2 -1
  14. eotdl/auth/__init__.py +0 -0
  15. eotdl/auth/auth.py +43 -29
  16. eotdl/auth/errors.py +0 -0
  17. eotdl/auth/is_logged.py +0 -0
  18. eotdl/auth/logout.py +0 -0
  19. eotdl/cli.py +0 -0
  20. eotdl/commands/__init__.py +0 -0
  21. eotdl/commands/auth.py +0 -0
  22. eotdl/commands/datasets.py +0 -0
  23. eotdl/commands/models.py +0 -0
  24. eotdl/curation/__init__.py +0 -0
  25. eotdl/curation/stac/__init__.py +0 -0
  26. eotdl/curation/stac/assets.py +3 -43
  27. eotdl/curation/stac/dataframe.py +14 -3
  28. eotdl/curation/stac/dataframe_bck.py +0 -0
  29. eotdl/curation/stac/dataframe_labeling.py +0 -0
  30. eotdl/curation/stac/extensions/__init__.py +0 -0
  31. eotdl/curation/stac/extensions/base.py +0 -0
  32. eotdl/curation/stac/extensions/dem.py +0 -0
  33. eotdl/curation/stac/extensions/eo.py +0 -0
  34. eotdl/curation/stac/extensions/label/__init__.py +0 -0
  35. eotdl/curation/stac/extensions/label/base.py +0 -0
  36. eotdl/curation/stac/extensions/label/image_name_labeler.py +0 -0
  37. eotdl/curation/stac/extensions/label/scaneo.py +3 -2
  38. eotdl/curation/stac/extensions/ml_dataset.py +0 -0
  39. eotdl/curation/stac/extensions/projection.py +0 -0
  40. eotdl/curation/stac/extensions/raster.py +0 -0
  41. eotdl/curation/stac/extensions/sar.py +0 -0
  42. eotdl/curation/stac/extent.py +0 -0
  43. eotdl/curation/stac/parsers.py +0 -0
  44. eotdl/curation/stac/stac.py +0 -0
  45. eotdl/datasets/__init__.py +0 -0
  46. eotdl/datasets/download.py +4 -6
  47. eotdl/datasets/ingest.py +6 -9
  48. eotdl/datasets/metadata.py +0 -0
  49. eotdl/datasets/retrieve.py +0 -0
  50. eotdl/files/__init__.py +0 -0
  51. eotdl/files/ingest.py +6 -6
  52. eotdl/models/__init__.py +0 -0
  53. eotdl/models/download.py +1 -10
  54. eotdl/models/ingest.py +2 -2
  55. eotdl/models/metadata.py +0 -0
  56. eotdl/models/retrieve.py +0 -0
  57. eotdl/repos/APIRepo.py +7 -0
  58. eotdl/repos/AuthAPIRepo.py +9 -2
  59. eotdl/repos/AuthRepo.py +7 -3
  60. eotdl/repos/DatasetsAPIRepo.py +10 -71
  61. eotdl/repos/FilesAPIRepo.py +17 -35
  62. eotdl/repos/ModelsAPIRepo.py +4 -4
  63. eotdl/repos/__init__.py +0 -0
  64. eotdl/shared/__init__.py +0 -0
  65. eotdl/shared/checksum.py +0 -0
  66. eotdl/tools/__init__.py +0 -0
  67. eotdl/tools/geo_utils.py +0 -0
  68. eotdl/tools/metadata.py +0 -0
  69. eotdl/tools/paths.py +0 -0
  70. eotdl/tools/stac.py +0 -0
  71. eotdl/tools/time_utils.py +0 -0
  72. eotdl/tools/tools.py +4 -4
  73. {eotdl-2023.11.3.post4.dist-info → eotdl-2024.2.15.dist-info}/METADATA +2 -5
  74. {eotdl-2023.11.3.post4.dist-info → eotdl-2024.2.15.dist-info}/RECORD +24 -32
  75. eotdl/datasets/usecases/__init__.py +0 -0
  76. eotdl/datasets/usecases/datasets/DownloadFile.py +0 -30
  77. eotdl/datasets/usecases/datasets/DownloadFileURL.py +0 -22
  78. eotdl/datasets/usecases/datasets/IngestDataset.py +0 -30
  79. eotdl/datasets/usecases/datasets/IngestLargeDataset.py +0 -43
  80. eotdl/datasets/usecases/datasets/IngestLargeDatasetParallel.py +0 -51
  81. eotdl/datasets/usecases/datasets/IngestSTAC.py +0 -77
  82. eotdl/datasets/usecases/datasets/__init__.py +0 -9
  83. {eotdl-2023.11.3.post4.dist-info → eotdl-2024.2.15.dist-info}/WHEEL +0 -0
  84. {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