Skip to content

Commit

Permalink
Merge pull request #338 from justin-richling/aerosol-gas-tables
Browse files Browse the repository at this point in the history
Add aerosol and gas tables
  • Loading branch information
justin-richling authored Oct 29, 2024
2 parents 95918f4 + 4f2cfa7 commit 69d74d6
Show file tree
Hide file tree
Showing 5 changed files with 1,350 additions and 13 deletions.
1 change: 1 addition & 0 deletions config_amwg_default_plots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ regridding_scripts:
#These scripts must be located in "scripts/analysis":
analysis_scripts:
- amwg_table
#- aerosol_gas_tables

#List of plotting scripts being used.
#These scripts must be located in "scripts/plotting":
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 @@ -468,6 +468,7 @@ regridding_scripts:
#These scripts must be located in "scripts/analysis":
analysis_scripts:
- amwg_table
#- aerosol_gas_tables

#List of plotting scripts being used.
#These scripts must be located in "scripts/plotting":
Expand Down
60 changes: 60 additions & 0 deletions lib/adf_variable_defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1194,5 +1194,65 @@ utendwtem:
obs_name: "ERA5"
obs_var_name: "utendwtem"



# Plot Specific formatting
##########################

# Chemistry and Aerosol Budget Tables
#------------------------------------
budget_tables:
# INPUTS
#list of the gaseous variables to be caculated.
GAS_VARIABLES: ['CH4','CH3CCL3', 'CO', 'O3', 'ISOP', 'MTERP', 'CH3OH', 'CH3COCH3']

# list of the aerosol variables to be caculated.
AEROSOL_VARIABLES: ['AOD','SOA', 'SALT', 'DUST', 'POM', 'BC', 'SO4']

# The variables in the list below must be aerosols - do not add AOD and DAOD
# WARNING: no need to change this list, unless for a specific need!
AEROSOLS: ['SOA', 'SALT', 'DUST', 'POM', 'BC', 'SO4']

# For the case that outputs are saved for a specific region.
# i.e., when using fincllonlat in user_nl_cam
ext1_SE: ''

# Tropospheric Values
# -------------------
# if True, calculate only Tropospheric values
# if False, all layers
# tropopause is defiend as o3>150ppb. If needed, change accordingly.
Tropospheric: True

### NOT WORKING FOR NOW
# To calculate the budgets only for a region
# Lat/Lon extent
limit: (20,20,40,120)
regional: False # DO NOT CHANGE

#Dictionary for Molecular weights. Keys must be consistent with variable name
# For aerosols, the MW is used only for chemical loss, chemical production, and elevated emission calculations
# For SO4, we report everything in terms of Sulfur, so we use Sulfur MW here
MW: {'O3':48,
'CH4':16,
'CO':28,
'ISOP':68,
'MTERP':136,
'SOA':144.132,
'SALT':58.4412,
'SO4':32.066,
'POM':12.011,
'BC':12.011 ,
'DUST':168.0456,
'CH3CCL3':133.4042,
'CH3OH':32,
'CH3COCH3':58}

# Avogadro's Number
AVO: 6.022e23
# gravity
gr: 9.80616
# Mw air
Mwair: 28.97
#-----------
#End of File
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
Loading

0 comments on commit 69d74d6

Please sign in to comment.