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

Add Tape Recorder plots for Q #268

Merged
merged 11 commits into from
Jan 9, 2024
1 change: 1 addition & 0 deletions config_amwg_default_plots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ plotting_scripts:
- zonal_mean
- polar_map
- cam_taylor_diagram
#- tape_recorder
#- tem #To plot TEM, please un-comment fill-out
#the "tem_info" section below
#- regional_map_multicase #To use this please un-comment and fill-out
Expand Down
1 change: 1 addition & 0 deletions config_cam_baseline_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ plotting_scripts:
- polar_map
- cam_taylor_diagram
- qbo
#- tape_recorder
#- tem #To plot TEM, please un-comment fill-out
#the "tem_info" section below
#- regional_map_multicase #To use this please un-comment and fill-out
Expand Down
15 changes: 8 additions & 7 deletions lib/adf_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ def create_website(self):
#Set main title for website:
main_title = "CAM Diagnostics"

#List of seasons
seasons = ["ANN","DJF","MAM","JJA","SON"]

#Determine local directory:
adf_lib_dir = Path(__file__).parent

Expand Down Expand Up @@ -589,7 +592,6 @@ def create_website(self):
#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')
mean_table_rndr = mean_table_tmpl.render(title=main_title,
Expand All @@ -613,7 +615,6 @@ def create_website(self):
img_pages_dir = self.__case_web_paths[web_data.case]['img_pages_dir']
img_data = [os.path.relpath(web_data.asset_path, start=img_pages_dir),
web_data.asset_path.stem]

#Check if plot image already handles multiple cases:
if web_data.multi_case:
case1 = "Listed in plots."
Expand All @@ -622,7 +623,6 @@ def create_website(self):
case1 = web_data.case
plot_types = plot_type_html
#End if

tmpl = jinenv.get_template('template.html') #Set template
rndr = tmpl.render(title=main_title,
var_title=web_data.name,
Expand All @@ -634,7 +634,8 @@ def create_website(self):
case_yrs=case_yrs,
baseline_yrs=baseline_yrs,
mydata=mean_html_info[web_data.plot_type],
plot_types=plot_types) #The template rendered
plot_types=plot_types,
seasons=seasons) #The template rendered

#Write HTML file:
with open(web_data.html_file, 'w', encoding='utf-8') as ofil:
Expand All @@ -644,7 +645,6 @@ def create_website(self):
#Check if the mean plot type page exists for this case:
mean_ptype_file = img_pages_dir / f"mean_diag_{web_data.plot_type}.html"
if not mean_ptype_file.exists():

#Construct individual plot type mean_diag html files, if they don't
#already exist:
mean_tmpl = jinenv.get_template('template_mean_diag.html')
Expand Down Expand Up @@ -680,7 +680,8 @@ def create_website(self):
baseline_yrs=baseline_yrs,
mydata=mean_html_info[web_data.plot_type],
curr_type=web_data.plot_type,
plot_types=plot_types)
plot_types=plot_types,
seasons=seasons)

#Write mean diagnostic plots HTML file:
with open(mean_ptype_plot_page,'w', encoding='utf-8') as ofil:
Expand Down Expand Up @@ -764,4 +765,4 @@ def create_website(self):
print(" ...Webpages have been generated successfully.")
#++++++++++++++++++++
#End Class definition
#++++++++++++++++++++
#++++++++++++++++++++
12 changes: 12 additions & 0 deletions lib/website_templates/adf_diag.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ a {
text-decoration: none;
color: navy;
}
a-blocked {
text-decoration: none;
color: black;
}
a:visited {
color: rgb(77, 6, 18);
}
Expand Down Expand Up @@ -149,6 +153,14 @@ table.dataframe td {
text-align: center;
}

.grid-item-blocked {
background-color: rgba(192, 192, 192, 0.6);
border: 1px solid rgba(0, 0, 0, 0.8);
padding: 10px;
font-size: 16px;
text-align: center;
}

.grid-item-diag {
background-color: rgba(255, 255, 255, 0.6);
border: 1px solid rgba(0, 0, 0, 0.8);
Expand Down
18 changes: 12 additions & 6 deletions lib/website_templates/template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -55,11 +53,19 @@ <h2 style="display:inline; color:black;"> Baseline Case: </h2><h2 style="display
{% for category, var_seas in mydata.items() %}
{% for var_name, seas_files in var_seas.items() %}
{% if var_name == var_title %}
{% for season_name, file_name in seas_files.items() %}
{% for season in seasons %}

{% if season in seas_files.keys() %}
<div class="grid-item">
<a href="../html_img/{{ file_name }}">{{ season_name }}</a>
<a href="../html_img/{{ seas_files[season] }}">{{ season }}</a>
</div><!--grid-item-->
{% endfor %}
{% else %}
<div class="grid-item-blocked">
<a-blocked>{{ season }}</a-blocked>
</div><!--grid-item-blocked-->
{% endif %}

{% endfor %}<!--seasons-->
{% endif %}
{% endfor %}
{% endfor %}
Expand All @@ -75,4 +81,4 @@ <h2 style="display:inline; color:black;"> Baseline Case: </h2><h2 style="display
</div> <!-- end main div -->

</body>
</html>
</html>
16 changes: 12 additions & 4 deletions lib/website_templates/template_var.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,24 @@ <h2 style="display:inline; color:black;"> Baseline Case: </h2><h2 style="display
{% for category, var_seas in mydata.items() %}
{% for var_name, seas_files in var_seas.items() %}
{% if var_name == var_title %}
{% for season_name, file_name in seas_files.items() %}
{% for season in seasons %}

{% if season in seas_files.keys() %}
<div class="grid-item">
<a href="../html_img/{{ file_name }}">{{ season_name }}</a>
<a href="../html_img/{{ seas_files[season] }}">{{ season }}</a>
</div><!--grid-item-->
{% endfor %}
{% else %}
<div class="grid-item-blocked ">
<a-blocked>{{ season }}</a-blocked>
</div><!--grid-item-blocked-->
{% endif %}

{% endfor %}<!--seasons-->
{% endif %}
{% endfor %}
{% endfor %}
</div><!--grid-container-->
</div><!--main div-->

</body>
</html>
</html>
2 changes: 1 addition & 1 deletion scripts/plotting/qbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def qbo(adfobj):
Isla Simpson (islas@ucar.edu) 22nd March 2022

"""
#Notify user that script has started:
#Notify user that script has started:
print("\n Generating qbo plots...")

#Extract relevant info from the ADF:
Expand Down
Loading