Skip to content

Commit 3a25ac4

Browse files
committed
Create webpage for simulation
1 parent ab6dee5 commit 3a25ac4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

post.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from validate import Validator
44
import errno
55
import os
6+
import re
67

78
from climo import climo
89
from ts import ts
@@ -79,3 +80,32 @@
7980
# mpas_analysis tasks
8081
mpas_analysis(config, scriptDir)
8182

83+
# Create page for the simulation
84+
analysis_dir = os.path.join(config['default']['www'], config['default']['case'])
85+
if config['e3sm_diags']['active'] and config['e3sm_diags']['atm_monthly_180x360_aave']:
86+
viewer_dir = dict()
87+
time_periods_dir = os.path.join(analysis_dir, 'e3sm_diags', config['e3sm_diags']['atm_monthly_180x360_aave']['grid'])
88+
time_periods = os.listdir(time_periods_dir)
89+
# model_vs_obs_0001-0020
90+
for time_period in time_periods:
91+
m = re.search('model_vs_obs_(\d\d\d\d)-(\d\d\d\d)', time_period)
92+
start_yr = int(m.group(1))
93+
end_yr = int(m.group(2))
94+
num_years = end_yr - start_yr + 1
95+
viewer = "{}/viewer".format(os.path.join(time_periods_dir,time_period))
96+
if num_years in viewer_dir.keys():
97+
viewer_dir[num_years].append(viewer)
98+
else:
99+
viewer_dir[num_years] = [viewer]
100+
for num_years in viewer_dir.keys():
101+
viewers = sorted(viewer_dir[num_years])
102+
for viewer in viewers:
103+
print(viewer)
104+
if config['mpas_analysis']['active']:
105+
mpas_dir = os.path.join(analysis_dir, 'mpas_analysis')
106+
pages = os.listdir(mpas_dir)
107+
pages = [os.path.join(mpas_dir, page) for page in pages]
108+
for page in pages:
109+
print(page)
110+
111+
# TODO: create a nice webpage (using Pandoc?) rather than just printing links

0 commit comments

Comments
 (0)