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 lat_lon_land from e3sm_diags for land diagnostics #548

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/integration/generated/directions_chrysalis.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NOTE: Actually running the tests (e.g., `python -u -m unittest tests/integration
can not be done from two different branches simultaneously
(since files in the `zppy` directory rather than an external directory get changed).

## Debug your code with test_debug
### Debug your code with test_debug

Follow the directions in the cfg to modify it for your testing needs.

Expand Down
5 changes: 3 additions & 2 deletions tests/integration/generated/test_bundles_chrysalis.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ years = "1850:1854:2", "1850:1854:4",
[ts]
active = True
bundle = "bundle1"
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240223"
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240229"
years = "1850:1854:2",

[[ atm_monthly_180x360_aave ]]
Expand All @@ -60,11 +60,12 @@ years = "1850:1854:2",
years = "1850:1860:5",

[[ land_monthly ]]
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240229"
extra_vars = "landfrac"
frequency = "monthly"
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
vars = "FSH,RH2M"
vars = "LAISHA,LAISUN"
ts_fmt = "cmip"

[[ rof_monthly ]]
Expand Down
50 changes: 45 additions & 5 deletions tests/integration/generated/test_complete_run_chrysalis.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,25 @@ years = "1850:1854:2", "1850:1854:4",

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

[[ atm_monthly_diurnal_8xdaily_180x360_aave ]]
frequency = "diurnal_8xdaily"
input_files = "eam.h4"
input_subdir = "archive/atm/hist"
vars = "PRECT"

[[ land_monthly_climo ]]
frequency = "monthly"
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
vars = ""

[ts]
active = True
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240223"
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240229"
walltime = "00:30:00"
years = "1850:1854:2",

Expand All @@ -45,20 +54,28 @@ years = "1850:1854:2",
vars = "PRECT"

[[ atm_monthly_glb ]]
# Note global average won't work for 3D variables.
frequency = "monthly"
input_files = "eam.h0"
input_subdir = "archive/atm/hist"
mapping_file = "glb"
years = "1850:1860:5",

[[ land_monthly ]]
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240229"
extra_vars = "landfrac"
frequency = "monthly"
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
vars = "FSH,RH2M"
vars = "LAISHA,LAISUN"
ts_fmt = "cmip"

[[ land_monthly_glb ]]
frequency = "monthly"
input_files = "eam.h0"
input_subdir = "archive/atm/hist"
mapping_file = "glb"

[[ rof_monthly ]]
extra_vars = 'areatotal2'
frequency = "monthly"
Expand Down Expand Up @@ -94,7 +111,7 @@ years = "1850:1854:2", "1850:1854:4",
walltime = "5:00:00"

[[ atm_monthly_180x360_aave_environment_commands ]]
environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20240214"
environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20240229"
sets = "qbo",
ts_subsection = "atm_monthly_180x360_aave"

Expand All @@ -115,7 +132,7 @@ years = "1850:1854:2", "1850:1854:4",
ref_name = "v2.LR.historical_0201"
ref_start_yr = 1850
ref_years = "1850-1851",
reference_data_path = "/lcrc/group/e3sm/ac.forsyth2/zppy_test_complete_run_output/v2.LR.historical_0201/post/atm/180x360_aave/clim"
reference_data_path = "/lcrc/group/e3sm/ac.forsyth2/zppy_test_complete_run_output/unique_id/v2.LR.historical_0201/post/atm/180x360_aave/clim"
run_type = "model_vs_model"
short_ref_name = "v2.LR.historical_0201"
swap_test_ref = False
Expand All @@ -125,6 +142,25 @@ years = "1850:1854:2", "1850:1854:4",
walltime = "5:00:00"
years = "1852-1853",

[[ lnd_monthly_mvm_lnd ]]
# Test model-vs-model using the same files as the reference
climo_subsection = "land_monthly_climo"
diff_title = "Difference"
#grid = 'native'
partition = "compute"
qos = "regular"
ref_final_yr = 1851
ref_name = "v2.LR.historical_0201"
ref_start_yr = 1850
ref_years = "1850-1851",
reference_data_path = "/lcrc/group/e3sm/ac.forsyth2/zppy_test_complete_run_output/unique_id/v2.LR.historical_0201/post/lnd/180x360_aave/clim"
run_type = "model_vs_model"
sets = "lat_lon_land",
short_ref_name = "same simulation"
swap_test_ref = False
tag = "model_vs_model"
ts_num_years_ref = 2

[mpas_analysis]
active = True
anomalyRefYear = 1850
Expand All @@ -150,7 +186,11 @@ years = "1850-1860",

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

[[ land_monthly ]]
2 changes: 1 addition & 1 deletion tests/integration/generated/test_debug_chrysalis.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ years = "1850:1854:2",
vars = "PRECT"

[[ land_monthly ]]
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240223"
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240229"
extra_vars = "landfrac"
frequency = "monthly"
input_files = "elm.h0"
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/template_bundles.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ years = "1850:1854:2",
years = "1850:1860:5",

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

[[ rof_monthly ]]
Expand Down
46 changes: 43 additions & 3 deletions tests/integration/template_complete_run.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ years = "1850:1854:2", "1850:1854:4",

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

[[ atm_monthly_diurnal_8xdaily_180x360_aave ]]
frequency = "diurnal_8xdaily"
input_files = "eam.h4"
input_subdir = "archive/atm/hist"
vars = "PRECT"

[[ land_monthly_climo ]]
frequency = "monthly"
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
vars = ""

[ts]
active = True
e3sm_to_cmip_environment_commands = "#expand e3sm_to_cmip_environment_commands#"
Expand All @@ -45,20 +54,28 @@ years = "1850:1854:2",
vars = "PRECT"

[[ atm_monthly_glb ]]
# Note global average won't work for 3D variables.
frequency = "monthly"
input_files = "eam.h0"
input_subdir = "archive/atm/hist"
mapping_file = "glb"
years = "1850:1860:5",

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

[[ land_monthly_glb ]]
frequency = "monthly"
input_files = "eam.h0"
input_subdir = "archive/atm/hist"
mapping_file = "glb"

[[ rof_monthly ]]
extra_vars = 'areatotal2'
frequency = "monthly"
Expand Down Expand Up @@ -115,7 +132,7 @@ years = "1850:1854:2", "1850:1854:4",
ref_name = "v2.LR.historical_0201"
ref_start_yr = 1850
ref_years = "1850-1851",
reference_data_path = "#expand user_output#zppy_test_complete_run_output/v2.LR.historical_0201/post/atm/180x360_aave/clim"
reference_data_path = "#expand user_output#zppy_test_complete_run_output/#expand unique_id#/v2.LR.historical_0201/post/atm/180x360_aave/clim"
run_type = "model_vs_model"
short_ref_name = "v2.LR.historical_0201"
swap_test_ref = False
Expand All @@ -125,6 +142,25 @@ years = "1850:1854:2", "1850:1854:4",
walltime = "#expand diags_walltime#"
years = "1852-1853",

[[ lnd_monthly_mvm_lnd ]]
# Test model-vs-model using the same files as the reference
climo_subsection = "land_monthly_climo"
diff_title = "Difference"
#grid = 'native'
partition = "#expand partition_long#"
qos = "#expand qos_long#"
ref_final_yr = 1851
ref_name = "v2.LR.historical_0201"
ref_start_yr = 1850
ref_years = "1850-1851",
reference_data_path = "#expand user_output#zppy_test_complete_run_output/#expand unique_id#/v2.LR.historical_0201/post/lnd/180x360_aave/clim"
run_type = "model_vs_model"
sets = "lat_lon_land",
short_ref_name = "same simulation"
swap_test_ref = False
tag = "model_vs_model"
ts_num_years_ref = 2

[mpas_analysis]
active = True
anomalyRefYear = 1850
Expand All @@ -150,7 +186,11 @@ years = "1850-1860",

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

[[ land_monthly ]]
2 changes: 1 addition & 1 deletion tests/integration/template_directions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NOTE: Actually running the tests (e.g., `python -u -m unittest tests/integration
can not be done from two different branches simultaneously
(since files in the `zppy` directory rather than an external directory get changed).

## Debug your code with test_debug
### Debug your code with test_debug

Follow the directions in the cfg to modify it for your testing needs.

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def get_chyrsalis_expansions(config):
"bundles_walltime": "07:00:00",
"constraint": "",
# To run this test, replace conda environment with your e3sm_diags dev environment
"diags_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20240214",
"diags_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20240229",
"diags_walltime": "5:00:00",
"e3sm_to_cmip_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240223",
"e3sm_to_cmip_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240229",
"environment_commands_test": "source /lcrc/soft/climate/e3sm-unified/test_e3sm_unified_1.9.0rc16_chrysalis.sh",
"expected_dir": "/lcrc/group/e3sm/public_html/zppy_test_resources/",
"mpas_analysis_walltime": "00:30:00",
Expand Down
43 changes: 43 additions & 0 deletions zppy/templates/e3sm_diags.bash
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,23 @@ create_links_ts_rof()
cd ..
}

{%- if ("lat_lon_land" in sets) %}
{% if run_type == "model_vs_obs" %}
climo_dir_primary_land=climo_land
{% elif run_type == "model_vs_model" %}
climo_dir_primary_land=climo_test_land
{%- endif %}
# Create local links to input climo files
climo_dir_source={{ output }}/post/lnd/{{ grid }}/clim/{{ '%dyr' % (year2-year1+1) }}
create_links_climo ${climo_dir_source} ${climo_dir_primary_land} ${case} ${Y1} ${Y2} 1
{% if run_type == "model_vs_model" %}
# Create local links to input climo files (ref model)
climo_dir_source={{ reference_data_path }}/{{ '%dyr' % (ref_year2-ref_year1+1) }}
climo_dir_ref_land=climo_ref_land
create_links_climo ${climo_dir_source} ${climo_dir_ref_land} {{ ref_name }} ${ref_Y1} ${ref_Y2} 2
{%- endif %}
{%- endif %}

{%- if ("lat_lon" in sets) or ("zonal_mean_xy" in sets) or ("zonal_mean_2d" in sets) or ("polar" in sets) or ("cosp_histogram" in sets) or ("meridional_mean_2d" in sets) or ("annual_cycle_zonal_mean" in sets) or ("zonal_mean_2d_stratosphere" in sets) %}
{% if run_type == "model_vs_obs" %}
climo_dir_primary=climo
Expand All @@ -155,6 +172,7 @@ create_links_climo ${climo_dir_source} ${climo_dir_ref} {{ ref_name }} ${ref_Y1}
{%- endif %}
{%- endif %}


{%- if "diurnal_cycle" in sets %}
{% if run_type == "model_vs_obs" %}
climo_diurnal_dir_primary=climo_{{ climo_diurnal_frequency }}
Expand Down Expand Up @@ -241,6 +259,9 @@ from e3sm_diags.parameter.streamflow_parameter import StreamflowParameter
{%- if "tc_analysis" in sets %}
from e3sm_diags.parameter.tc_analysis_parameter import TCAnalysisParameter
{%- endif %}
{%- if "lat_lon_land" in sets %}
from e3sm_diags.parameter.lat_lon_land_parameter import LatLonLandParameter
{%- endif %}


from e3sm_diags.run import runner
Expand All @@ -263,6 +284,7 @@ param.test_data_path = '${climo_dir_primary}'
param.test_name = '${case}'
param.short_test_name = short_name

# Ref
{%- if ("lat_lon" in sets) or ("zonal_mean_xy" in sets) or ("zonal_mean_2d" in sets) or ("polar" in sets) or ("cosp_histogram" in sets) or ("meridional_mean_2d" in sets) or ("annual_cycle_zonal_mean" in sets) or ("zonal_mean_2d_stratosphere" in sets) %}
{% if run_type == "model_vs_obs" %}
# Obs
Expand Down Expand Up @@ -293,6 +315,27 @@ param.num_workers = {{ num_workers }}
#param.fail_on_incomplete = True
params = [param]

# Model land
{%- if ("lat_lon_land" in sets) %}
land_param = LatLonLandParameter()
land_param.test_data_path = '${climo_dir_primary_land}'
{% if run_type == "model_vs_obs" %}
# Obs
land_param.reference_data_path = '{{ reference_data_path_land }}'
{% elif run_type == "model_vs_model" %}
# Reference
land_param.reference_data_path = '${climo_dir_ref_land}'
land_param.ref_name = '${ref_name}'
land_param.short_ref_name = '{{ short_ref_name }}'
# Optionally, swap test and reference model
if {{ swap_test_ref }}:
land_param.test_data_path, param.reference_data_path = param.reference_data_path, param.test_data_path
land_param.test_name, param.ref_name = param.ref_name, param.test_name
land_param.short_test_name, param.short_ref_name = param.short_ref_name, param.short_test_name
{%- endif %}
params.append(land_param)
{%- endif %}

{%- if "enso_diags" in sets %}
enso_param = EnsoDiagsParameter()
enso_param.test_data_path = test_ts
Expand Down
Loading