-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (26 loc) · 899 Bytes
/
main.py
File metadata and controls
33 lines (26 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import time
import asyncio
def main():
from superstac import get_catalog_registry, federated_search_async
cr = get_catalog_registry()
cr.load_catalogs_from_config()
print("\nRunning asynchronous federated_search_async...")
start_async = time.perf_counter()
results_async = asyncio.run(
federated_search_async(
registry=cr,
collections=["sentinel-2-l2a"],
bbox=[6.0, 49.0, 7.0, 50.0],
datetime="2024-01-01/2024-01-31",
query={"eo:cloud_cover": {"lt": 20}},
sortby=[{"field": "properties.datetime", "direction": "desc"}],
)
)
end_async = time.perf_counter()
print(
f"Asynchronous search found {len(results_async)} items in {end_async - start_async:.2f} seconds."
)
for x in results_async:
print(x.self_href)
if __name__ == "__main__":
main()