Skip to content

Commit

Permalink
Add categories
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 committed Aug 1, 2024
1 parent 307e322 commit cd5b100
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 8 deletions.
57 changes: 57 additions & 0 deletions tests/integration/generated/test_debug_chrysalis.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Use this cfg to test a pull request before merging.
# 1. Copy over the contents of template_complete_run.cfg.
# 2. Delete parts that aren't needed. `output` and `www` should include `zppy_test_debug` rather than `zppy_test_complete_run`.
# 3. Iteratively debug/develop with this cfg.
# 4. Once it's working as expected, copy important changes to template_complete_run.cfg.

[default]
case = v2.LR.historical_0201
constraint = ""
dry_run = "False"
environment_commands = ""
input = "/lcrc/group/e3sm/ac.forsyth2//E3SMv2/v2.LR.historical_0201"
input_subdir = archive/atm/hist
mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc"
# To run this test, edit `output` and `www` in this file, along with `actual_images_dir` in test_complete_run.py
output = "/lcrc/group/e3sm/ac.forsyth2/zppy_test_debug_output/test-601-output-viewer-v3/v2.LR.historical_0201"
partition = "debug"
qos = "regular"
www = "/lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_debug_www/test-601-output-viewer-v3"

[ts]
active = True
walltime = "00:30:00"
years = "1850:1854:2",

[[ atm_monthly_180x360_aave ]]
frequency = "monthly"
input_files = "eam.h0"
input_subdir = "archive/atm/hist"
ts_fmt = "cmip"

[[ atm_daily_180x360_aave ]]
frequency = "daily"
input_files = "eam.h1"
input_subdir = "archive/atm/hist"
vars = "PRECT"

[[ land_monthly ]]
e3sm_to_cmip_environment_commands = ""
extra_vars = "landfrac"
frequency = "monthly"
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
vars = "LAISHA,LAISUN"
#vars = "FSH,RH2M"
ts_fmt = "cmip"

[ilamb]
active = True
grid = '180x360_aave'
nodes = 8
partition = "compute"
short_name = 'v2.LR.historical_0201'
ts_num_years = 2
years = "1850:1854:2",

[[ land_monthly ]]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ years = "1985:1995:5",
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
mapping_file = "glb"
vars = "FSH,RH2M,LAISHA"
vars = "FSH,RH2M,LAISHA,LAISUN,QINTR,QOVER,QRUNOFF,QSOIL,QVEGE,QVEGT,SOILWATER_10CM,TSA,H2OSNO,TOTLITC,CWDC,SOIL1C,SOIL2C,SOIL3C,SOIL4C,WOOD_HARVESTC,TOTVEGC,NBP,GPP,AR,HR"

[global_time_series]
active = True
Expand All @@ -40,7 +40,7 @@ ncols = 1
nrows = 1
plots_original=""
plots_atm = "TREFHT"
plots_lnd = "FSH,RH2M,LAISHA"
plots_lnd = "FSH,RH2M,LAISHA,LAISUN,QINTR,QOVER,QRUNOFF,QSOIL,QVEGE,QVEGT,SOILWATER_10CM,TSA,H2OSNO,TOTLITC,CWDC,SOIL1C,SOIL2C,SOIL3C,SOIL4C,WOOD_HARVESTC,TOTVEGC,NBP,GPP,AR,HR"
ts_num_years = 5
walltime = "00:30:00"
years = "1985-1995",
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Run this script to update expected files for test_bundles.py
# Run from the top level of the zppy repo
# Run as `./tests/integration/generated/update_bundles_expected_files.sh`

# Remove old expected files.
rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
# Your output will now become the new expectation.
# Copy output so you don't have to rerun zppy to generate the output.
cp -r /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_test_bundles_www/test-601-output-viewer-v3/v2.LR.historical_0201 /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
mkdir -p /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles/bundle_files
cp -r /lcrc/group/e3sm/ac.forsyth2/zppy_test_bundles_output/test-601-output-viewer-v3/v2.LR.historical_0201/post/scripts/bundle*.bash /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles/bundle_files
zppy_top_level=$(pwd)
cd /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
# Remove the image check failures, so they don't end up in the expected files.
rm -rf image_check_failures_bundles
# This file will list all the expected images.
find . -type f -name '*.png' > ../image_list_expected_bundles.txt
cd ${zppy_top_level}
# Rerun test
python -u -m unittest tests/integration/test_bundles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Run this script to update expected files for test_complete_run.py
# Run from the top level of the zppy repo
# Run as `./tests/integration/generated/update_complete_run_expected_files.sh`

# Remove old expected files.
rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/expected_complete_run
# Your output will now become the new expectation.
# Copy output so you don't have to rerun zppy to generate the output.
cp -r /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_test_complete_run_www/test-601-output-viewer-v3/v2.LR.historical_0201 /lcrc/group/e3sm/public_html/zppy_test_resources/expected_complete_run
zppy_top_level=$(pwd)
cd /lcrc/group/e3sm/public_html/zppy_test_resources/expected_complete_run
# Remove the image check failures, so they don't end up in the expected files.
rm -rf image_check_failures_complete_run
# This file will list all the expected images.
find . -type f -name '*.png' > ../image_list_expected_complete_run.txt
cd ${zppy_top_level}
# Rerun test
python -u -m unittest tests/integration/test_complete_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ years = "1985:1995:5",
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
mapping_file = "glb"
vars = "FSH,RH2M,LAISHA"
vars = "FSH,RH2M,LAISHA,LAISUN,QINTR,QOVER,QRUNOFF,QSOIL,QVEGE,QVEGT,SOILWATER_10CM,TSA,H2OSNO,TOTLITC,CWDC,SOIL1C,SOIL2C,SOIL3C,SOIL4C,WOOD_HARVESTC,TOTVEGC,NBP,GPP,AR,HR"

[global_time_series]
active = True
Expand All @@ -40,7 +40,7 @@ ncols = 1
nrows = 1
plots_original=""
plots_atm = "TREFHT"
plots_lnd = "FSH,RH2M,LAISHA"
plots_lnd = "FSH,RH2M,LAISHA,LAISUN,QINTR,QOVER,QRUNOFF,QSOIL,QVEGE,QVEGT,SOILWATER_10CM,TSA,H2OSNO,TOTLITC,CWDC,SOIL1C,SOIL2C,SOIL3C,SOIL4C,WOOD_HARVESTC,TOTVEGC,NBP,GPP,AR,HR"
ts_num_years = 5
walltime = "00:30:00"
years = "1985-1995",
47 changes: 43 additions & 4 deletions zppy/templates/coupled_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,17 +1027,18 @@ def create_viewer(figstr, regions, component_to_plots_dict):
# just has css, js
viewer = OutputViewer(path=".")
viewer.add_page("Table", regions)
viewer.add_group("Summary Table")
components = component_to_plots_dict.keys()
for component in components:
viewer.add_group(component)
plot_names = component_to_plots_dict[component]
for plot_name in plot_names:
viewer.add_row(plot_name)
for rgn in regions:
component_short = component[0:3]
viewer.add_col(
f"{figstr}_{rgn}_{component}_{plot_name}.png",
f"{figstr}_{rgn}_{component_short}_{plot_name}.png",
is_file=True,
title="title",
title=f"{rgn}_{component_short}_{plot_name}",
)

url = viewer.generate_page()
Expand All @@ -1058,7 +1059,45 @@ def run_by_region(parameters):
raise RuntimeError(f"Invalid rgn={rgn}")
run(parameters, rgn)
figstr = parameters[3]
component_to_plots_dict = {"atm": ["TREFHT"], "lnd": ["FSH", "LAISHA", "RH2M"]}
# Going by zppy/templates/ilamb/ilamb.cfg
component_to_plots_dict = {
"atm": ["TREFHT"],
"lnd > Ecosystem and Carbon Cycle > Biomass": [
"QVEGE",
"QVEGT",
"TOTVEGC",
], # biomass/cVeg
"lnd > Ecosystem and Carbon Cycle > Gross Primary Productivity": ["GPP"], # gpp
"lnd > Ecosystem and Carbon Cycle > Leaf Area Index": [
"LAISHA",
"LAISUN",
], # lai
"lnd > Ecosystem and Carbon Cycle > Global Net Ecosystem Carbon Balance": [
"NBP"
], # nbp
"lnd > Ecosystem and Carbon Cycle > Soil Carbon": [
"QSOIL",
"SOIL1C",
"SOIL2C",
"SOIL3C",
"SOIL4C",
], # cSoil/soilc
"lnd > Hyrdology Cycle > Runoff": ["QRUNOFF"], # runoff/mrro
"lnd > Hyrdology Cycle > Sensible Heat": ["FSH"], # hfss/sh
"lnd > Hyrdology Cycle > Terrestial Water Storage Anomaly": ["TSA"], # twsa/tws
"lnd > Hyrdology Cycle > Snow Water Equivalent": ["H2OSNO"], # swe/snw
"lnd > Forcings > Surface Relative Humidity": ["RH2M"], # rhums/hurs
"lnd > Other": [
"QINTR",
"QOVER",
"SOILWATER_10CM",
"TOTLITC",
"CWDC",
"WOOD_HARVESTC",
"AR",
"HR",
],
}
url = create_viewer(figstr, regions, component_to_plots_dict)
print(url)

Expand Down

0 comments on commit cd5b100

Please sign in to comment.