Skip to content

Commit 9453274

Browse files
committed
Create webpage for simulation
1 parent ab6dee5 commit 9453274

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

post.py

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

0 commit comments

Comments
 (0)