Skip to content

Commit 4a574d8

Browse files
committed
add collect_young2018.py
1 parent 2d2a6ff commit 4a574d8

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

helpers/collect_all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ python3 collect_clennett2020_m2019.py $1
2121
python3 collect_clennett2020_s2013.py $1
2222
python3 collect_zahirovic2022.py $1
2323
python3 collect_shephard2013.py $1
24+
python3 collect_young2018.py $1

helpers/collect_young2018.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import glob
2+
import io
3+
import os
4+
import shutil
5+
import sys
6+
import zipfile
7+
from datetime import datetime
8+
9+
import requests
10+
import utils
11+
12+
model_path = utils.get_model_path(sys.argv, "young2018")
13+
zip_path = "Young_etal_2018_GeoscienceFrontiers_GPlatesPlateMotionModel"
14+
15+
info_fp = open(f"{model_path}/info.txt", "w+")
16+
info_fp.write(f"{datetime.now()}\n")
17+
18+
# download the model zip file
19+
zip_url = "https://www.earthbyte.org/webdav/ftp/Data_Collections/Young_etal_2018_GeoscienceFrontiers/Young_etal_2018_GeoscienceFrontiers_GPlatesPlateMotionModel.zip"
20+
info_fp.write(f"Download zip file from {zip_url}\n")
21+
r = requests.get(zip_url, allow_redirects=True, verify=True)
22+
if r.status_code in [200]:
23+
z = zipfile.ZipFile(io.BytesIO(r.content))
24+
z.extractall(f"{model_path}/")
25+
26+
27+
# zip Rotations
28+
files = glob.glob(f"{model_path}/{zip_path}/*.rot")
29+
utils.zip_files(files, f"{model_path}/Rotations.zip", "Rotations", info_fp)
30+
31+
32+
# zip StaticPolygons
33+
files = glob.glob(f"{model_path}/{zip_path}/StaticPolygons/*")
34+
utils.zip_files(files, f"{model_path}/StaticPolygons.zip", "StaticPolygons", info_fp)
35+
36+
# zip Coastlines
37+
files = glob.glob(f"{model_path}/{zip_path}/Coastlines/*")
38+
utils.zip_files(files, f"{model_path}/Coastlines.zip", "Coastlines", info_fp)
39+
40+
41+
# zip Topologies
42+
files = [
43+
f"{model_path}/{zip_path}/Global_Mesozoic-Cenozoic_plate_boundaries_Young_et_al.gpml",
44+
f"{model_path}/{zip_path}/Global_Paleozoic_plate_boundaries_Young_et_al.gpml",
45+
f"{model_path}/{zip_path}/TopologyBuildingBlocks_Young_et_al.gpml",
46+
]
47+
utils.zip_files(files, f"{model_path}/Topologies.zip", "Topologies", info_fp)
48+
49+
50+
# zip ContinentalPolygons
51+
files = glob.glob(f"{model_path}/{zip_path}/ContinentalPolygons/*")
52+
utils.zip_files(
53+
files, f"{model_path}/ContinentalPolygons.zip", "ContinentalPolygons", info_fp
54+
)
55+
56+
57+
shutil.rmtree(f"{model_path}/{zip_path}")
58+
os.remove(f"{model_path}/License.txt")
59+
60+
info_fp.close()

models.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,21 @@
109109
"URL": "https://gwsdoc.gplates.org/models#muller2019",
110110
"Version": "2023-12-06"
111111
},
112+
"young2018": {
113+
"BigTime": 410,
114+
"SmallTime": 0,
115+
"Rotations": "https://repo.gplates.org/webdav/pmm/young2018/Rotations.zip",
116+
"Layers": {
117+
"Coastlines": "https://repo.gplates.org/webdav/pmm/young2018/Coastlines.zip",
118+
"StaticPolygons": "https://repo.gplates.org/webdav/pmm/young2018/StaticPolygons.zip",
119+
"ContinentalPolygons": "https://repo.gplates.org/webdav/pmm/young2018/ContinentalPolygons.zip",
120+
"Topologies": "https://repo.gplates.org/webdav/pmm/young2018/Topologies.zip"
121+
},
122+
"TimeDepRasters": {},
123+
"Description": "Global kinematics of tectonic plates and subduction zones since the late Paleozoic Era",
124+
"URL": "https://www.sciencedirect.com/science/article/pii/S1674987118301373",
125+
"Version": "2023-12-19"
126+
},
112127
"torsvikcocks2017": {
113128
"BigTime": 1100,
114129
"SmallTime": 0,

0 commit comments

Comments
 (0)