-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_collections.py
executable file
·37 lines (30 loc) · 1.09 KB
/
create_collections.py
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
34
35
36
37
#!/usr/bin/env python3
from pathlib import Path
from dep_collections.dep_ls_geomad import dep_ls_geomad
from dep_collections.dep_ls_wofs_summary_annual import dep_ls_wofs_summary_annual
from dep_collections.dep_ls_wofl import dep_ls_wofl
from dep_collections.dep_s1_mosaic import dep_s1_mosaic
from dep_collections.dep_s2_geomad import dep_s2_geomad
from dep_collections.dep_s2_mangroves import dep_s2_mangroves
from dep_collections.dep_s2s1_mrd import dep_s2s1_mrd
STAGING_URL = "https://stac.staging.digitalearthpacific.org"
OUT_FOLDER = "collections"
out_dir = Path(OUT_FOLDER)
out_dir.mkdir(exist_ok=True)
all_collections = (
dep_ls_wofs_summary_annual,
dep_ls_wofl,
dep_ls_geomad,
dep_s2_geomad,
dep_s2_mangroves,
dep_s1_mosaic,
dep_s2s1_mrd,
)
for collection in all_collections:
collection_url = f"{STAGING_URL}/collections/{collection.id}"
collection.validate()
collection.set_self_href(collection_url)
print(f"Writing {collection.id} to {out_dir}")
collection_dict = collection.save_object(
dest_href=out_dir / f"{collection.id}.json"
)