forked from wagdav/atomic
-
Notifications
You must be signed in to change notification settings - Fork 7
/
fetch_adas_data
executable file
·35 lines (28 loc) · 1.02 KB
/
fetch_adas_data
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
#!/usr/bin/env python3
import adas
import tarfile
atomic_data = './adas_data'
elements_years = [('hydrogen', 96), ('lithium', 96), ('carbon', 96),
('argon', 89), ('neon', 96), ('nitrogen', 96),
('beryllium', 96), ('boron', 89), ('tungsten', 50)]
db = adas.OpenAdas()
for element, year in elements_years:
res = db.search_adf11(element, year)
for r in res:
print(r[1])
db.fetch(r, atomic_data)
for element, year in elements_years:
res = db.search_adf15(element)
for r in res:
print(r[1])
db.fetch(r, atomic_data)
destination = './src'
for routine in (11,15):
fname = 'xxdata_' + str(routine) + '.tar.gz'
print("Downloading " + fname)
db.fetch(('/code/' + fname, fname), destination)
tar = tarfile.open(destination + '/' + fname)
# here we specifically go against the prohibition in
# https://docs.python.org/2/library/tarfile.html#tarfile.TarFile.extractall
print("Extracting " + fname)
tar.extractall(path=destination)