Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 committed Mar 27, 2024
1 parent 16fd68a commit ccc5645
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
7 changes: 3 additions & 4 deletions zppy/templates/coupled_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def add_line(year, var, year1, year2, ax, format="%4.2f", lw=1, color="b"):
i2 = (np.abs(year - year2)).argmin()

tmp = np.average(var[i1 : i2 + 1])
ax.plot((year[i1], year[i2]), (tmp, tmp), lw=lw, color=color)
ax.plot((year[i1], year[i2]), (tmp, tmp), lw=lw, color=color, label="average")
ax.text(ax.get_xlim()[1] + 1, tmp, format % tmp, va="center", color=color)

return
Expand Down Expand Up @@ -87,7 +87,7 @@ def add_trend(
if verbose:
print(fit)
fit_fn = np.poly1d(fit)
ax.plot(x, fit_fn(x), lw=lw, ls="--", c=color)
ax.plot(x, fit_fn(x), lw=lw, ls="--", c=color, label="trend")
if ohc:
# Earth radius 6371229. from MPAS-O output files
heat_uptake = fit[0] / (4.0 * math.pi * (6371229.0) ** 2 * 365.0 * 86400.0)
Expand Down Expand Up @@ -656,8 +656,7 @@ def run(parameters, rgn): # noqa: C901
"PRECC",
"PRECL",
"QFLX",
] # + plots_atm
print(f"AAA: {plot_list} {plots_atm} {plots_lnd} {plots_ocn}")
] + plots_atm
exps = [
{
"atmos": None
Expand Down
31 changes: 16 additions & 15 deletions zppy/templates/global_time_series.bash
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,31 @@ case_dir={{ output }}
global_ts_dir={{ global_time_series_dir }}

# Options
has_atm="false"
has_lnd="false"
has_ocn="false"
if [ -z "{{ plot_names }}" ]; then
plot_names="None"
else
plot_names={{ plot_names }}
has_atm="true"
has_ocn="true"
fi
if [ -z "{{ plots_atm }}" ]; then
plots_atm="None"
has_atm="false"
else
plots_atm={{ plots_atm }}
has_atm="true"
fi

if [ -z "{{ plots_lnd }}" ]; then
plots_lnd="None"
has_lnd="false"
else
plots_lnd={{ plots_lnd }}
has_lnd="true"
fi

if [ -z "{{ plots_ocn }}" ]; then
plots_ocn="None"
has_ocn="false"
else
plots_ocn={{ plots_ocn }}
has_ocn="true"
Expand All @@ -68,9 +74,9 @@ if [[ ${has_atm} == "true" ]]; then
cd ${case_dir}/post/atm/glb/ts/monthly/${ts_num_years}yr
cdscan -x glb.xml *.nc
if [ $? != 0 ]; then
cd {{ scriptDir }}
echo 'ERROR (1)' > {{ prefix }}.status
exit 1
cd {{ scriptDir }}
echo 'ERROR (1)' > {{ prefix }}.status
exit 1
fi
fi

Expand All @@ -79,9 +85,9 @@ if [[ ${has_lnd} == "true" ]]; then
cd ${case_dir}/post/lnd/glb/ts/monthly/${ts_num_years}yr
cdscan -x glb.xml *.nc
if [ $? != 0 ]; then
cd {{ scriptDir }}
echo 'ERROR (1)' > {{ prefix }}.status
exit 1
cd {{ scriptDir }}
echo 'ERROR (1)' > {{ prefix }}.status
exit 1
fi
fi

Expand Down Expand Up @@ -122,11 +128,6 @@ fi

echo 'Update time series figures'
cd ${global_ts_dir}
if [ -z "$plot_names" ]; then
plot_names="None"
else
plot_names={{ plot_names }}
fi
python coupled_global.py ${case_dir} ${experiment_name} ${figstr} ${start_yr} ${end_yr} {{ color }} ${ts_num_years} ${plot_names} ${plots_atm} ${plots_lnd} ${plots_ocn} {{ regions }}
if [ $? != 0 ]; then
cd {{ scriptDir }}
Expand Down

0 comments on commit ccc5645

Please sign in to comment.