Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create webpage for simulation #25

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 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,33 @@
# mpas_analysis tasks
mpas_analysis(config, scriptDir)

# Create page for the simulation
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be useful to add variables for generate_global_time_series_plots.sh to the configuration file, so it can be run automatically from post.py. Then we can also find the global time series link to display.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #26 for the global time series plot generation

analysis_dir = os.path.join(config['default']['www'], config['default']['case'])
analysis_html = os.path.join(config['default']['html_path'], 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('e3sm_diags', config['e3sm_diags']['atm_monthly_180x360_aave']['grid'])
time_periods = os.listdir(os.path.join(analysis_dir, 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(analysis_html, 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)
forsyth2 marked this conversation as resolved.
Show resolved Hide resolved
if config['mpas_analysis']['active']:
mpas_dir = os.path.join(analysis_dir, 'mpas_analysis')
pages = os.listdir(mpas_dir)
pages = ["{}".format(os.path.join(analysis_html, 'mpas_analysis', page)) for page in pages]
for page in pages:
print(page)

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use pandoc (https://pandoc.org/index.html)