diff --git a/post.py b/post.py index 1a4b04bc..b27548ea 100644 --- a/post.py +++ b/post.py @@ -3,6 +3,7 @@ from validate import Validator import errno import os +import re from climo import climo from ts import ts @@ -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