-
Notifications
You must be signed in to change notification settings - Fork 15
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
Enable CDAT-migrated E3SM Diags #651
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,64 +67,6 @@ create_links_climo_diurnal() | |
cd .. | ||
} | ||
|
||
create_links_ts() | ||
{ | ||
ts_dir_source=$1 | ||
ts_dir_destination=$2 | ||
begin_year=$3 | ||
end_year=$4 | ||
error_num=$5 | ||
# Create xml files for time series variables | ||
mkdir -p ${ts_dir_destination} | ||
cd ${ts_dir_destination} | ||
# https://stackoverflow.com/questions/27702452/loop-through-a-comma-separated-shell-variable | ||
variables="{{ vars }}" | ||
for v in ${variables//,/ } | ||
do | ||
# 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 | ||
for year in `seq ${begin_year} {{ ts_num_years }} ${end_year}`; | ||
do | ||
YYYY=`printf "%04d" ${year}` | ||
for file in ${ts_dir_source}/${v}_${YYYY}*.nc | ||
do | ||
# Add this time series file to the list of files for cdscan to use | ||
echo ${file} >> ${v}_files.txt | ||
done | ||
done | ||
# xml file will cover the whole period from year1 to year2 | ||
xml_name=${v}_${begin_year}01_${end_year}12.xml | ||
export CDMS_NO_MPI=true | ||
cdscan -x ${xml_name} -f ${v}_files.txt | ||
if [ $? != 0 ]; then | ||
cd {{ scriptDir }} | ||
echo "ERROR (${error_num})" > {{ prefix }}.status | ||
exit ${error_num} | ||
fi | ||
done | ||
cd .. | ||
} | ||
|
||
create_links_ts_rof() | ||
{ | ||
ts_rof_dir_source=$1 | ||
ts_rof_dir_destination=$2 | ||
begin_year=$3 | ||
end_year=$4 | ||
error_num=$5 | ||
mkdir -p ${ts_rof_dir_destination} | ||
cd ${ts_rof_dir_destination} | ||
v="RIVER_DISCHARGE_OVER_LAND_LIQ" | ||
xml_name=${v}_${begin_year}01_${end_year}12.xml | ||
cdscan -x ${xml_name} ${ts_rof_dir_source}/${v}_*.nc | ||
if [ $? != 0 ]; then | ||
cd {{ scriptDir }} | ||
echo "ERROR (${error_num})" > {{ prefix }}.status | ||
exit ${error_num} | ||
fi | ||
cd .. | ||
} | ||
|
||
|
||
{%- if ("lat_lon_land" in sets) %} | ||
{% if run_type == "model_vs_obs" %} | ||
climo_dir_primary_land=climo_land | ||
|
@@ -178,18 +120,10 @@ create_links_climo_diurnal ${climo_diurnal_dir_source} ${climo_diurnal_dir_ref} | |
{%- endif %} | ||
|
||
{%- if ("enso_diags" in sets) or ("qbo" in sets) or ("area_mean_time_series" in sets) %} | ||
{% if run_type == "model_vs_obs" %} | ||
ts_dir_primary=ts | ||
{% elif run_type == "model_vs_model" %} | ||
ts_dir_primary=ts_test | ||
{%- endif %} | ||
# Create xml files for time series variables | ||
ts_dir_source={{ output }}/post/atm/{{ grid }}/ts/monthly/{{ '%dyr' % (ts_num_years) }} | ||
create_links_ts ${ts_dir_source} ${ts_dir_primary} ${Y1} ${Y2} 5 | ||
ts_dir_primary={{ output }}/post/atm/{{ grid }}/ts/monthly/{{ '%dyr' % (ts_num_years) }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{% if run_type == "model_vs_model" %} | ||
ts_dir_source={{ reference_data_path_ts }}/{{ ts_num_years_ref }}yr | ||
ts_dir_ref=ts_ref | ||
create_links_ts ${ts_dir_source} ${ts_dir_ref} ${ref_Y1} ${ref_Y2} 6 | ||
ts_dir_ref={{ reference_data_path_ts }}/{{ ts_num_years_ref }}yr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{%- endif %} | ||
{%- endif %} | ||
|
||
|
@@ -201,17 +135,9 @@ ts_daily_dir_ref={{ reference_data_path_ts_daily }}/{{ ts_num_years_ref }}yr | |
{%- endif %} | ||
|
||
{%- if "streamflow" in sets %} | ||
{% if run_type == "model_vs_obs" %} | ||
ts_rof_dir_primary=rof | ||
{% elif run_type == "model_vs_model" %} | ||
ts_rof_dir_primary=rof_test | ||
{%- endif %} | ||
ts_rof_dir_source="{{ output }}/post/rof/native/ts/monthly/{{ ts_num_years }}yr" | ||
create_links_ts_rof ${ts_rof_dir_source} ${ts_rof_dir_primary} ${Y1} ${Y2} 7 | ||
ts_rof_dir_primary="{{ output }}/post/rof/native/ts/monthly/{{ ts_num_years }}yr" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{% if run_type == "model_vs_model" %} | ||
ts_rof_dir_source={{ reference_data_path_ts_rof }}/{{ ts_num_years_ref }}yr | ||
ts_rof_dir_ref=ts_rof_ref | ||
create_links_ts_rof ${ts_rof_dir_source} ${ts_rof_dir_ref} ${ref_Y1} ${ref_Y2} 8 | ||
ts_rof_dir_ref={{ reference_data_path_ts_rof }}/{{ ts_num_years_ref }}yr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{%- endif %} | ||
{%- endif %} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create_links
functions. No more usingcdscan
to compile a list of files into an xml.