Skip to content

Commit 1f1c08f

Browse files
authored
Improve res handling in tc_analysis (#689)
1 parent d9ac3ff commit 1f1c08f

File tree

7 files changed

+109
-4
lines changed

7 files changed

+109
-4
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[default]
2+
case = "v3.LR.historical_0051"
3+
constraint = ""
4+
dry_run = "False"
5+
environment_commands = ""
6+
input = /lcrc/group/e3sm2/ac.wlin//E3SMv3/v3.LR.historical_0051
7+
input_subdir = archive/atm/hist
8+
mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc"
9+
output = "/lcrc/group/e3sm/ac.forsyth2/zppy_min_case_tc_analysis_only_output/unique_id/v3.LR.historical_0051"
10+
partition = "debug"
11+
qos = "regular"
12+
www = "/lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_min_case_tc_analysis_only_www/unique_id"
13+
years = "1985:1987:2",
14+
15+
[tc_analysis]
16+
active = True
17+
walltime = "00:30:00"
18+
# first_file=/lcrc/group/e3sm2/ac.wlin//E3SMv3/v3.LR.historical_0051/archive/atm/hist/v3.LR.historical_0051.eam.h2.1850-01-01-00000.nc
19+
# topography_file=/lcrc/group/e3sm/data/inputdata/atm/cam/topo/USGS-gtopo30_ne30np4pg2_x6t-SGH.c20210614.nc
20+
# grid=ne30np4pg2
21+
# Inferring res from grid
22+
# res=30
23+
# pg2=true
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[default]
2+
case = "v3.LR.historical_0051"
3+
constraint = ""
4+
dry_run = "False"
5+
environment_commands = ""
6+
input = /lcrc/group/e3sm2/ac.wlin//E3SMv3/v3.LR.historical_0051
7+
input_subdir = archive/atm/hist
8+
mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc"
9+
output = "/lcrc/group/e3sm/ac.forsyth2/zppy_min_case_tc_analysis_res_output/unique_id/v3.LR.historical_0051"
10+
partition = "debug"
11+
qos = "regular"
12+
www = "/lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_min_case_tc_analysis_res_www/unique_id"
13+
years = "1985:1987:2",
14+
15+
[tc_analysis]
16+
active = True
17+
res="30"
18+
walltime = "00:30:00"
19+
# first_file=/lcrc/group/e3sm2/ac.wlin//E3SMv3/v3.LR.historical_0051/archive/atm/hist/v3.LR.historical_0051.eam.h2.1850-01-01-00000.nc
20+
# topography_file=/lcrc/group/e3sm/data/inputdata/atm/cam/topo/USGS-gtopo30_ne30np4pg2_x6t-SGH.c20210614.nc
21+
# grid=ne30np4pg2
22+
# res=30
23+
# pg2=true
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[default]
2+
case = "#expand case_name#"
3+
constraint = "#expand constraint#"
4+
dry_run = "#expand dry_run#"
5+
environment_commands = "#expand environment_commands#"
6+
input = #expand user_input_v3#/E3SMv3/#expand case_name#
7+
input_subdir = archive/atm/hist
8+
mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc"
9+
output = "#expand user_output#zppy_min_case_tc_analysis_only_output/#expand unique_id#/#expand case_name#"
10+
partition = "#expand partition_short#"
11+
qos = "#expand qos_short#"
12+
www = "#expand user_www#zppy_min_case_tc_analysis_only_www/#expand unique_id#"
13+
years = "1985:1987:2",
14+
15+
[tc_analysis]
16+
active = True
17+
walltime = "00:30:00"
18+
# first_file=/lcrc/group/e3sm2/ac.wlin//E3SMv3/v3.LR.historical_0051/archive/atm/hist/v3.LR.historical_0051.eam.h2.1850-01-01-00000.nc
19+
# topography_file=/lcrc/group/e3sm/data/inputdata/atm/cam/topo/USGS-gtopo30_ne30np4pg2_x6t-SGH.c20210614.nc
20+
# grid=ne30np4pg2
21+
# Inferring res from grid
22+
# res=30
23+
# pg2=true
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[default]
2+
case = "#expand case_name#"
3+
constraint = "#expand constraint#"
4+
dry_run = "#expand dry_run#"
5+
environment_commands = "#expand environment_commands#"
6+
input = #expand user_input_v3#/E3SMv3/#expand case_name#
7+
input_subdir = archive/atm/hist
8+
mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc"
9+
output = "#expand user_output#zppy_min_case_tc_analysis_res_output/#expand unique_id#/#expand case_name#"
10+
partition = "#expand partition_short#"
11+
qos = "#expand qos_short#"
12+
www = "#expand user_www#zppy_min_case_tc_analysis_res_www/#expand unique_id#"
13+
years = "1985:1987:2",
14+
15+
[tc_analysis]
16+
active = True
17+
res="30"
18+
walltime = "00:30:00"
19+
# first_file=/lcrc/group/e3sm2/ac.wlin//E3SMv3/v3.LR.historical_0051/archive/atm/hist/v3.LR.historical_0051.eam.h2.1850-01-01-00000.nc
20+
# topography_file=/lcrc/group/e3sm/data/inputdata/atm/cam/topo/USGS-gtopo30_ne30np4pg2_x6t-SGH.c20210614.nc
21+
# grid=ne30np4pg2
22+
# res=30
23+
# pg2=true

tests/integration/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ def generate_cfgs(unified_testing=False, dry_run=False):
315315
"min_case_add_dependencies",
316316
"min_case_carryover_dependencies",
317317
"min_case_deprecated_parameters",
318+
"min_case_tc_analysis_only",
319+
"min_case_tc_analysis_res",
318320
"min_case_tc_analysis_simultaneous_1",
319321
"min_case_tc_analysis_simultaneous_2",
320322
"min_case_tc_analysis_v2_simultaneous_1",

zppy/defaults/default.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ input_component = string(default="")
152152
[tc_analysis]
153153
# NOTE: always overrides value in [default]
154154
input_files = string(default="eam.h2")
155+
# Resolution to use for `--res` option.
156+
# If not set, zppy will attempt to infer this value from the topography file.
157+
res = string(default="")
155158

156159
[e3sm_diags]
157160
# See https://e3sm-project.github.io/e3sm_diags/_build/html/master/available-parameters.html

zppy/templates/tc_analysis.bash

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,26 @@ atm_name={{ atm_name }}
2525

2626
# Determine res and pg2
2727
first_file=`echo $(ls ${drc_in}/${caseid}.{{ input_files }}.*.nc | head -n 1)`
28+
echo "first_file=${first_file}"
2829
topography_file=`echo $(ncks --trd -M -m ${first_file} | grep -E -i "^global attribute [0-9]+: topography_file" | cut -f 11- -d ' ' | sort)`
29-
res=""
30+
echo "topography_file=${topography_file}"
31+
res={{ res }}
3032
pg2=false
31-
if [[ $topography_file =~ /.*_(.*)_.*nc ]]; then
33+
if [[ $topography_file =~ /[^_]*_([^_]*)_.*nc ]]; then
3234
grid=${BASH_REMATCH[1]}
33-
if [[ $grid =~ ne([0-9]*) ]]; then
34-
res=${BASH_REMATCH[1]}
35+
echo "grid=${grid}"
36+
if [[ -z "${res}" ]]; then
37+
echo "Inferring res from grid"
38+
if [[ $grid =~ ne([0-9]*) ]]; then
39+
res=${BASH_REMATCH[1]}
40+
fi
3541
fi
3642
if [[ $grid =~ pg2 ]]; then
3743
pg2=true
3844
fi
3945
fi
46+
echo "res=${res}"
47+
echo "pg2=${pg2}"
4048

4149
mkdir -p $result_dir
4250
file_name=${caseid}_${start}_${end}

0 commit comments

Comments
 (0)