eotdl 2024.3.15__py3-none-any.whl → 2024.5.2__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/download.py +22 -16
- eotdl/access/sentinelhub/utils.py +12 -4
- eotdl/curation/stac/dataframe.py +0 -2
- eotdl/datasets/__init__.py +1 -1
- eotdl/datasets/download.py +4 -9
- eotdl/datasets/ingest.py +1 -0
- eotdl/files/__init__.py +1 -0
- eotdl/files/list_files.py +13 -0
- eotdl/models/__init__.py +1 -1
- eotdl/repos/FilesAPIRepo.py +9 -0
- {eotdl-2024.3.15.dist-info → eotdl-2024.5.2.dist-info}/METADATA +2 -1
- {eotdl-2024.3.15.dist-info → eotdl-2024.5.2.dist-info}/RECORD +15 -14
- {eotdl-2024.3.15.dist-info → eotdl-2024.5.2.dist-info}/WHEEL +1 -1
- {eotdl-2024.3.15.dist-info → eotdl-2024.5.2.dist-info}/entry_points.txt +0 -0
eotdl/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "2024.
|
1
|
+
__version__ = "2024.05.02"
|
eotdl/access/download.py
CHANGED
@@ -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
|
-
|
32
|
-
|
33
|
-
|
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
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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,
|
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
|
67
|
-
output_filename =
|
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
|
-
|
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:
|
eotdl/curation/stac/dataframe.py
CHANGED
@@ -157,9 +157,7 @@ def read_stac(
|
|
157
157
|
"""
|
158
158
|
if isinstance(stac_file, (str, Path)):
|
159
159
|
stac_file = pystac.read_file(stac_file) # we assume this is always a catalog
|
160
|
-
print(stac_file)
|
161
160
|
stac_file.make_all_asset_hrefs_absolute()
|
162
|
-
print("ie")
|
163
161
|
children = get_all_children(stac_file)
|
164
162
|
|
165
163
|
# Convert Dataframe to STACDataFrame
|
eotdl/datasets/__init__.py
CHANGED
eotdl/datasets/download.py
CHANGED
@@ -60,11 +60,10 @@ def download_dataset(
|
|
60
60
|
file_version,
|
61
61
|
progress=True,
|
62
62
|
)
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
if verbose:
|
64
|
+
logger("Generating README.md ...")
|
65
|
+
generate_metadata(download_path, dataset)
|
66
66
|
else:
|
67
|
-
# raise NotImplementedError("Downloading a STAC dataset is not implemented")
|
68
67
|
if verbose:
|
69
68
|
logger("Downloading STAC metadata...")
|
70
69
|
repo = DatasetsAPIRepo()
|
@@ -92,11 +91,7 @@ def download_dataset(
|
|
92
91
|
href, filename, f"{download_path}/assets", user
|
93
92
|
)
|
94
93
|
else:
|
95
|
-
|
96
|
-
logger("To download assets, set assets=True or -a in the CLI.")
|
97
|
-
if verbose:
|
98
|
-
logger("Generating README.md ...")
|
99
|
-
generate_metadata(download_path, dataset)
|
94
|
+
logger("To download assets, set assets=True or -a in the CLI.")
|
100
95
|
if verbose:
|
101
96
|
logger("Done")
|
102
97
|
return download_path
|
eotdl/datasets/ingest.py
CHANGED
eotdl/files/__init__.py
CHANGED
@@ -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.")
|
eotdl/models/__init__.py
CHANGED
eotdl/repos/FilesAPIRepo.py
CHANGED
@@ -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
|
Metadata-Version: 2.1
|
2
2
|
Name: eotdl
|
3
|
-
Version: 2024.
|
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)
|
@@ -1,16 +1,16 @@
|
|
1
|
-
eotdl/__init__.py,sha256=
|
1
|
+
eotdl/__init__.py,sha256=xrNIo8ojW99vbCIfmq4FSOCpbcqkPd11zXtBDaGUxXA,27
|
2
2
|
eotdl/access/__init__.py,sha256=jbyjD7BRGJURlTNmtcbBBhw3Xk4EiZvkqmEykM-bJ1k,231
|
3
3
|
eotdl/access/airbus/__init__.py,sha256=G_kkRS9eFjXbQ-aehmTLXeAxh7zpAxz_rgB7J_w0NRg,107
|
4
4
|
eotdl/access/airbus/client.py,sha256=zjfgB_NTsCCIszoQesYkyLJgheKg-eTh28vbleXYxfw,12018
|
5
5
|
eotdl/access/airbus/parameters.py,sha256=Z8XIrxG5wAOuOoH-fkdKfdNMEMLFp6PaxJN7v4MefMI,1009
|
6
6
|
eotdl/access/airbus/utils.py,sha256=oh_N1Rn4fhcvUgNPpH2QzVvpe4bA0gqRgNguzRVqUps,652
|
7
|
-
eotdl/access/download.py,sha256=
|
7
|
+
eotdl/access/download.py,sha256=DgemJKafNOlCUVW8OxpSP4br9ij5F1iSrSD-x0B5qFU,1845
|
8
8
|
eotdl/access/search.py,sha256=sO2hml6JLK30DncNUqTWq16zy9LvRiWC6wtt5bNRzrI,633
|
9
9
|
eotdl/access/sentinelhub/__init__.py,sha256=YpvaUBTRXM26WrXipo51ZUBCDv9WjRIdT8l1Pklpt_M,238
|
10
10
|
eotdl/access/sentinelhub/client.py,sha256=g40avqlUpIa-WLjD7tK8CL8_SohBA2v3m8NZ0KbIFxc,4098
|
11
11
|
eotdl/access/sentinelhub/evalscripts.py,sha256=m6cnZ6ryXHgdH2B7RDVSlDHXWfvKi7HMGkTHXEcJsTw,4142
|
12
12
|
eotdl/access/sentinelhub/parameters.py,sha256=Ni3Lqx1bLVcMzgmnuayDS00BLDm7SuM1FExVdGafopI,2061
|
13
|
-
eotdl/access/sentinelhub/utils.py,sha256=
|
13
|
+
eotdl/access/sentinelhub/utils.py,sha256=X9Q1YvErBdMsRKszXyaOaG6ZMvPdM2Nl_0SH-dWSFo0,3560
|
14
14
|
eotdl/auth/__init__.py,sha256=OuGNfJQ-8Kymn4zIywlHQfImEO8DJMJIwOwTQm-u_dc,99
|
15
15
|
eotdl/auth/auth.py,sha256=EjbVFREA2H0sjFJhVqjFZrwjKPzxRJ2x83MTjizpRBs,2029
|
16
16
|
eotdl/auth/errors.py,sha256=E1lv3Igk--J-SOgNH18i8Xx9bXrrMyBSHKt_CAUmGPo,308
|
@@ -24,7 +24,7 @@ eotdl/commands/models.py,sha256=fxS0HJCkhorUpH9mwGMwbWxvQzbeRFXpwpZHtlfuZus,4873
|
|
24
24
|
eotdl/curation/__init__.py,sha256=Qdp1cRR_wUYjnpyzGfyRFnL3X7aKtmgZQS8NNzPCc1s,269
|
25
25
|
eotdl/curation/stac/__init__.py,sha256=BGBDvW-IqcxhrxvLap2Ocj0nINYaqjgjzFuAipRcoa4,220
|
26
26
|
eotdl/curation/stac/assets.py,sha256=ay3JO6iEANMqTAe40sF7QYeEY574LbrhyanqSlVUITc,3347
|
27
|
-
eotdl/curation/stac/dataframe.py,sha256=
|
27
|
+
eotdl/curation/stac/dataframe.py,sha256=w0CXK4tAegbXQgnXbak2QbLfWgC6SQXpR2g-snoimAM,5503
|
28
28
|
eotdl/curation/stac/dataframe_bck.py,sha256=PwAwol7kll0xYtlkhLeQ_Sc5TBQ85cVd6eyzdfTMJnE,8493
|
29
29
|
eotdl/curation/stac/dataframe_labeling.py,sha256=F22-4gpF9zFuCLqRva2XAyArOmGdrgGxXbgo9d54BFE,1520
|
30
30
|
eotdl/curation/stac/extensions/__init__.py,sha256=NSzKe14Iyr8Pm2AVg8RHxddtBD2so45--BRJmJd8bTs,629
|
@@ -42,15 +42,16 @@ eotdl/curation/stac/extensions/sar.py,sha256=Akw3_5brY_x2yU094nSLbv0E6M9jnAeUC0V
|
|
42
42
|
eotdl/curation/stac/extent.py,sha256=Jb3K4v59eu_h5t429r0762o0zG_LA50iEE-abWNL0e0,5108
|
43
43
|
eotdl/curation/stac/parsers.py,sha256=H5IukLA61mpLojeuhWNQdiZk2eiYHAfpJBFxmjdGDso,1529
|
44
44
|
eotdl/curation/stac/stac.py,sha256=9GdiB1mV8iyREvXZoJmNJKQGawWyK3h9Eu0hJX5u6O4,13180
|
45
|
-
eotdl/datasets/__init__.py,sha256=
|
46
|
-
eotdl/datasets/download.py,sha256=
|
47
|
-
eotdl/datasets/ingest.py,sha256=
|
45
|
+
eotdl/datasets/__init__.py,sha256=xNbkUjqI1mf0TGjy52tpZtr5DnWNX5EVgyM04P4sU3Y,175
|
46
|
+
eotdl/datasets/download.py,sha256=JSOi7OKiENYQ3TRVj2WsC1CPYD22VlC9W5kYHPfx8Vs,3667
|
47
|
+
eotdl/datasets/ingest.py,sha256=Ukiah6TapD1oBE0AxUTaEFf-k3hAMRrKr4cXVlVW-_Y,5806
|
48
48
|
eotdl/datasets/metadata.py,sha256=qonblTDGr4IZvJaiIc2rh7qwP76whEA72DorSVqZxd4,1457
|
49
49
|
eotdl/datasets/retrieve.py,sha256=DJz5K1bCLizg9YNwBnhHMFzcxMXar2socYkFONdSL4c,1041
|
50
50
|
eotdl/datasets/update.py,sha256=x-rpfxnavn9X-7QYkFMGtbn1b3bKmAZydOeS7Tjr5AQ,386
|
51
|
-
eotdl/files/__init__.py,sha256=
|
51
|
+
eotdl/files/__init__.py,sha256=2zfAxgLHmU_jWq_3emnfPXsX-R20gSt-yZX0bPa9h0g,87
|
52
52
|
eotdl/files/ingest.py,sha256=dgjZfd-ACCKradDo2B02CPahwEhFtWvnKvTm372K5eo,6185
|
53
|
-
eotdl/
|
53
|
+
eotdl/files/list_files.py,sha256=k4OgdbQ7u6tUEE9nJZGXw5s5HtvG0ZApOVTy0KbfTqs,519
|
54
|
+
eotdl/models/__init__.py,sha256=-PvGWG0iSRNBqeFWpxol12dYw-QodXjR81n-JX3x6zI,146
|
54
55
|
eotdl/models/download.py,sha256=uXWUslaBkJ222BfctbO0eKNcw6Unx1-Pa9Yv5RHXJIo,4119
|
55
56
|
eotdl/models/ingest.py,sha256=KmBFUS1pkUYdegfi0lL1sd__lj9GMoJ7jxvnVXfY8Ts,3381
|
56
57
|
eotdl/models/metadata.py,sha256=S5bpIB4e2pivDnReszJKC3bYBZcaHu-KMYOc3AwHbQ4,1443
|
@@ -60,7 +61,7 @@ eotdl/repos/APIRepo.py,sha256=dJNdX3atBpug0FZNako7uyom25iccNPQrnoIRTIZEXE,791
|
|
60
61
|
eotdl/repos/AuthAPIRepo.py,sha256=vYCqFawe3xUm2cx4SqVXCvzl8J_sr9rs_MkipYC0bXE,957
|
61
62
|
eotdl/repos/AuthRepo.py,sha256=jpzzhINCcDZHRCyrPDsp49h17IlXp2HvX3BB3f5cnb4,1154
|
62
63
|
eotdl/repos/DatasetsAPIRepo.py,sha256=rKqSe-UjJOlD0Kbypu4Gs5kx2mzUD7TY05gv2vgUTv4,2660
|
63
|
-
eotdl/repos/FilesAPIRepo.py,sha256=
|
64
|
+
eotdl/repos/FilesAPIRepo.py,sha256=cS6CFTkSYIXcefHEeLt7I69_EyyO-jhoAwQ7UWYlLkc,7171
|
64
65
|
eotdl/repos/ModelsAPIRepo.py,sha256=7-0c-3OCTCwKUZ-Z7PWtbRusUxpTU7m2H5jIAcFoJ9M,1677
|
65
66
|
eotdl/repos/__init__.py,sha256=WvX5TP49k7yYb5dWWNjv5kzbdluO3dJ4LqjQxRIOUVc,222
|
66
67
|
eotdl/shared/__init__.py,sha256=mF7doJC8Z5eTPmB01UQvPivThZac32DRY33T6qshXfg,41
|
@@ -72,7 +73,7 @@ eotdl/tools/paths.py,sha256=yWhOtVxX4NxrDrrBX2fuye5N1mAqrxXFy_eA7dffd84,1152
|
|
72
73
|
eotdl/tools/stac.py,sha256=ovXdrPm4Sn9AAJmrP88WnxDmq2Ut-xPoscjphxz3Iyo,5763
|
73
74
|
eotdl/tools/time_utils.py,sha256=qJ3-rk1I7ne722SLfAP6-59kahQ0vLQqIf9VpOi0Kpg,4691
|
74
75
|
eotdl/tools/tools.py,sha256=Tl4_v2ejkQo_zyZek8oofJwoYcdVosdOwW1C0lvWaNM,6354
|
75
|
-
eotdl-2024.
|
76
|
-
eotdl-2024.
|
77
|
-
eotdl-2024.
|
78
|
-
eotdl-2024.
|
76
|
+
eotdl-2024.5.2.dist-info/METADATA,sha256=O_RtJWIg7MvaJ3PeX4ZPIpQHuxUdSSZvdtK6qWb8ciY,4102
|
77
|
+
eotdl-2024.5.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
78
|
+
eotdl-2024.5.2.dist-info/entry_points.txt,sha256=s6sfxUfRrSX2IP2UbrzTFTvRCtLgw3_OKcHlOKf_5F8,39
|
79
|
+
eotdl-2024.5.2.dist-info/RECORD,,
|
File without changes
|