Skip to content

Commit

Permalink
Update adf_web.py
Browse files Browse the repository at this point in the history
Remove check for existing table file, just remake every time.

Also update test case name call for page headers.
  • Loading branch information
justin-richling committed Oct 28, 2024
1 parent 272220a commit 6efa81d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/adf_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,18 +619,16 @@ def jinja_list(seas_list):

#Check if the mean plot type page exists for this case (or for multi-case):
mean_table_file = table_pages_dir / "mean_tables.html"
if not mean_table_file.exists():
#Construct mean_table.html
mean_table_tmpl = jinenv.get_template('template_mean_tables.html')
#Reuse the rend_kwarg_dict, but ignore certain keys
#since all others are the same
new_dict = {k: rend_kwarg_dict[k] for k in rend_kwarg_dict.keys() - {'table_name', 'table_html'}}
mean_table_rndr = mean_table_tmpl.render(new_dict)
#Write mean diagnostic tables HTML file:
with open(mean_table_file, 'w', encoding='utf-8') as ofil:
ofil.write(mean_table_rndr)
#End with
#End if
#Construct mean_table.html
mean_table_tmpl = jinenv.get_template('template_mean_tables.html')
#Reuse the rend_kwarg_dict, but ignore certain keys
#since all others are the same
new_dict = {k: rend_kwarg_dict[k] for k in rend_kwarg_dict.keys() - {'table_name', 'table_html'}}
mean_table_rndr = mean_table_tmpl.render(new_dict)
#Write mean diagnostic tables HTML file:
with open(mean_table_file, 'w', encoding='utf-8') as ofil:
ofil.write(mean_table_rndr)
#End with
#End if (tables)

else: #Plot image
Expand Down Expand Up @@ -716,7 +714,7 @@ def jinja_list(seas_list):
index_title = "AMP Diagnostics Prototype"
index_tmpl = jinenv.get_template('template_index.html')
index_rndr = index_tmpl.render(title=index_title,
case_name=web_data.case,
case_name=case1,
base_name=data_name,
case_yrs=case_yrs,
baseline_yrs=baseline_yrs,
Expand Down

0 comments on commit 6efa81d

Please sign in to comment.