Skip to content

Commit 01d4f7b

Browse files
authored
Merge pull request #651 from E3SM-Project/issue-346-diags-post-refactor
Enable CDAT-migrated E3SM Diags
2 parents 0da5fdf + dadc602 commit 01d4f7b

File tree

1 file changed

+4
-78
lines changed

1 file changed

+4
-78
lines changed

zppy/templates/e3sm_diags.bash

Lines changed: 4 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -67,64 +67,6 @@ create_links_climo_diurnal()
6767
cd ..
6868
}
6969

70-
create_links_ts()
71-
{
72-
ts_dir_source=$1
73-
ts_dir_destination=$2
74-
begin_year=$3
75-
end_year=$4
76-
error_num=$5
77-
# Create xml files for time series variables
78-
mkdir -p ${ts_dir_destination}
79-
cd ${ts_dir_destination}
80-
# https://stackoverflow.com/questions/27702452/loop-through-a-comma-separated-shell-variable
81-
variables="{{ vars }}"
82-
for v in ${variables//,/ }
83-
do
84-
# Go through the time series files for between year1 and year2, using a step size equal to the number of years per time series file
85-
for year in `seq ${begin_year} {{ ts_num_years }} ${end_year}`;
86-
do
87-
YYYY=`printf "%04d" ${year}`
88-
for file in ${ts_dir_source}/${v}_${YYYY}*.nc
89-
do
90-
# Add this time series file to the list of files for cdscan to use
91-
echo ${file} >> ${v}_files.txt
92-
done
93-
done
94-
# xml file will cover the whole period from year1 to year2
95-
xml_name=${v}_${begin_year}01_${end_year}12.xml
96-
export CDMS_NO_MPI=true
97-
cdscan -x ${xml_name} -f ${v}_files.txt
98-
if [ $? != 0 ]; then
99-
cd {{ scriptDir }}
100-
echo "ERROR (${error_num})" > {{ prefix }}.status
101-
exit ${error_num}
102-
fi
103-
done
104-
cd ..
105-
}
106-
107-
create_links_ts_rof()
108-
{
109-
ts_rof_dir_source=$1
110-
ts_rof_dir_destination=$2
111-
begin_year=$3
112-
end_year=$4
113-
error_num=$5
114-
mkdir -p ${ts_rof_dir_destination}
115-
cd ${ts_rof_dir_destination}
116-
v="RIVER_DISCHARGE_OVER_LAND_LIQ"
117-
xml_name=${v}_${begin_year}01_${end_year}12.xml
118-
cdscan -x ${xml_name} ${ts_rof_dir_source}/${v}_*.nc
119-
if [ $? != 0 ]; then
120-
cd {{ scriptDir }}
121-
echo "ERROR (${error_num})" > {{ prefix }}.status
122-
exit ${error_num}
123-
fi
124-
cd ..
125-
}
126-
127-
12870
{%- if ("lat_lon_land" in sets) %}
12971
{% if run_type == "model_vs_obs" %}
13072
climo_dir_primary_land=climo_land
@@ -178,18 +120,10 @@ create_links_climo_diurnal ${climo_diurnal_dir_source} ${climo_diurnal_dir_ref}
178120
{%- endif %}
179121

180122
{%- if ("enso_diags" in sets) or ("qbo" in sets) or ("area_mean_time_series" in sets) %}
181-
{% if run_type == "model_vs_obs" %}
182-
ts_dir_primary=ts
183-
{% elif run_type == "model_vs_model" %}
184-
ts_dir_primary=ts_test
185-
{%- endif %}
186123
# Create xml files for time series variables
187-
ts_dir_source={{ output }}/post/atm/{{ grid }}/ts/monthly/{{ '%dyr' % (ts_num_years) }}
188-
create_links_ts ${ts_dir_source} ${ts_dir_primary} ${Y1} ${Y2} 5
124+
ts_dir_primary={{ output }}/post/atm/{{ grid }}/ts/monthly/{{ '%dyr' % (ts_num_years) }}
189125
{% if run_type == "model_vs_model" %}
190-
ts_dir_source={{ reference_data_path_ts }}/{{ ts_num_years_ref }}yr
191-
ts_dir_ref=ts_ref
192-
create_links_ts ${ts_dir_source} ${ts_dir_ref} ${ref_Y1} ${ref_Y2} 6
126+
ts_dir_ref={{ reference_data_path_ts }}/{{ ts_num_years_ref }}yr
193127
{%- endif %}
194128
{%- endif %}
195129

@@ -201,17 +135,9 @@ ts_daily_dir_ref={{ reference_data_path_ts_daily }}/{{ ts_num_years_ref }}yr
201135
{%- endif %}
202136

203137
{%- if "streamflow" in sets %}
204-
{% if run_type == "model_vs_obs" %}
205-
ts_rof_dir_primary=rof
206-
{% elif run_type == "model_vs_model" %}
207-
ts_rof_dir_primary=rof_test
208-
{%- endif %}
209-
ts_rof_dir_source="{{ output }}/post/rof/native/ts/monthly/{{ ts_num_years }}yr"
210-
create_links_ts_rof ${ts_rof_dir_source} ${ts_rof_dir_primary} ${Y1} ${Y2} 7
138+
ts_rof_dir_primary="{{ output }}/post/rof/native/ts/monthly/{{ ts_num_years }}yr"
211139
{% if run_type == "model_vs_model" %}
212-
ts_rof_dir_source={{ reference_data_path_ts_rof }}/{{ ts_num_years_ref }}yr
213-
ts_rof_dir_ref=ts_rof_ref
214-
create_links_ts_rof ${ts_rof_dir_source} ${ts_rof_dir_ref} ${ref_Y1} ${ref_Y2} 8
140+
ts_rof_dir_ref={{ reference_data_path_ts_rof }}/{{ ts_num_years_ref }}yr
215141
{%- endif %}
216142
{%- endif %}
217143

0 commit comments

Comments
 (0)