Skip to content

Commit

Permalink
Create webpage for simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 committed Apr 21, 2021
1 parent ab6dee5 commit 3a25ac4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions post.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from validate import Validator
import errno
import os
import re

from climo import climo
from ts import ts
Expand Down Expand Up @@ -79,3 +80,32 @@
# mpas_analysis tasks
mpas_analysis(config, scriptDir)

# Create page for the simulation
analysis_dir = os.path.join(config['default']['www'], config['default']['case'])
if config['e3sm_diags']['active'] and config['e3sm_diags']['atm_monthly_180x360_aave']:
viewer_dir = dict()
time_periods_dir = os.path.join(analysis_dir, 'e3sm_diags', config['e3sm_diags']['atm_monthly_180x360_aave']['grid'])
time_periods = os.listdir(time_periods_dir)
# model_vs_obs_0001-0020
for time_period in time_periods:
m = re.search('model_vs_obs_(\d\d\d\d)-(\d\d\d\d)', time_period)
start_yr = int(m.group(1))
end_yr = int(m.group(2))
num_years = end_yr - start_yr + 1
viewer = "{}/viewer".format(os.path.join(time_periods_dir,time_period))
if num_years in viewer_dir.keys():
viewer_dir[num_years].append(viewer)
else:
viewer_dir[num_years] = [viewer]
for num_years in viewer_dir.keys():
viewers = sorted(viewer_dir[num_years])
for viewer in viewers:
print(viewer)
if config['mpas_analysis']['active']:
mpas_dir = os.path.join(analysis_dir, 'mpas_analysis')
pages = os.listdir(mpas_dir)
pages = [os.path.join(mpas_dir, page) for page in pages]
for page in pages:
print(page)

# TODO: create a nice webpage (using Pandoc?) rather than just printing links

0 comments on commit 3a25ac4

Please sign in to comment.