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

Update MJO EWR calculation #983

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Next Next commit
update
  • Loading branch information
lee1043 committed Sep 22, 2023
commit 53419708d324ff77e42e307656a744748830cf5d
6 changes: 3 additions & 3 deletions pcmdi_metrics/mean_climate/mean_climate_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@

if debug:
print('ds_test_tmp:', ds_test_tmp)
ds_test_dict[region].to_netcdf('_'.join([var, 'model', model, run, region + '.nc']))
ds_test_dict[region].to_netcdf('_'.join([var, 'model', model, run, region, case_id + '.nc']))
if model == test_data_set[0] and run == realizations[0]:
ds_ref_dict[region].to_netcdf('_'.join([var, 'ref', region + '.nc']))

Expand All @@ -297,7 +297,7 @@

# write individual JSON
# --- single simulation, obs (need to accumulate later) / single variable
json_filename_tmp = "_".join([var, model, run, target_grid, regrid_tool, "metrics", ref])
json_filename_tmp = "_".join([var, model, run, target_grid, regrid_tool, "metrics", ref, case_id])
mean_climate_metrics_to_json(
os.path.join(metrics_output_path, var),
json_filename_tmp,
Expand All @@ -319,7 +319,7 @@
# ------------------------------------------------------------------------
if not parallel:
# write collective JSON --- all models / all obs / single variable
json_filename = "_".join([var, target_grid, regrid_tool, "metrics"])
json_filename = "_".join([var, target_grid, regrid_tool, "metrics", case_id])
mean_climate_metrics_to_json(
metrics_output_path,
json_filename,
Expand Down
44 changes: 29 additions & 15 deletions pcmdi_metrics/mjo/lib/mjo_metric_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,35 @@ def mjo_metric_ewr_calculation(
if plot:
os.makedirs(outdir(output_type="graphics"), exist_ok=True)
fout = os.path.join(outdir(output_type="graphics"), output_filename)
title = (
mip.upper()
+ ": "
+ model
+ " ("
+ run
+ ") \n"
+ var.capitalize()
+ ", "
+ season
+ " "
+ str(startYear)
+ "-"
+ str(endYear)
)
if model == 'obs':
title = (
" OBS ("
+ run
+ ") \n"
+ var.capitalize()
+ ", "
+ season
+ " "
+ str(startYear)
+ "-"
+ str(endYear)
)
else:
title = (
mip.upper()
+ ": "
+ model
+ " ("
+ run
+ ") \n"
+ var.capitalize()
+ ", "
+ season
+ " "
+ str(startYear)
+ "-"
+ str(endYear)
)
if cmmGrid:
title += ", common grid (2.5x2.5deg)"
plot_power(OEE, title, fout, ewr)
Expand Down
2 changes: 1 addition & 1 deletion pcmdi_metrics/mjo/param/myParam_mjo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def find_latest(path):
# Observation
# -------------------------------------------------
reference_data_name = "GPCP-1-3"
reference_data_path = "/p/user_pub/PCMDIobs/PCMDIobs2/atmos/day/pr/GPCP-1-3/gn/v20200707/pr_day_GPCP-1-3_BE_gn_v20200707_19961002-20170101.nc" # noqa
reference_data_path = "/p/user_pub/PCMDIobs/obs4MIPs_legacy/PCMDIobs2/atmos/day/pr/GPCP-1-3/gn/v20200924/pr_day_GPCP-1-3_BE_gn_v20200924_19961002-20170101.nc" # noqa

varOBS = "pr"
ObsUnitsAdjust = (True, "multiply", 86400.0, "mm d-1") # kg m-2 s-1 to mm day-1
Expand Down
4 changes: 2 additions & 2 deletions pcmdi_metrics/mjo/scripts/parallel_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
# =================================================
# Generates list of command
# -------------------------------------------------
param_file = "../doc/myParam_mjo.py"
param_file = "../param/myParam_mjo.py"

if debug:
param_file = "../doc/myParam_test.py"
param_file = "../param/myParam_test.py"
print("number of models (debug mode):", len(models))

cmds_list = list()
Expand Down
7 changes: 2 additions & 5 deletions pcmdi_metrics/mjo/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/sh
set -a

# grim: pmp_nightly_20190628
# gates: cdat82_20191107_py37, pmp_nightly_20190912

#parallel=no
parallel=yes

Expand All @@ -17,15 +14,15 @@ mkdir -p log
if [ $parallel == no ]; then
echo 'parallel no'
for mip in $mips; do
python -u mjo_metrics_driver.py -p ../doc/myParam_mjo.py --mip ${mip} >& log/log.${mip}.txt &
mjo_metrics_driver.py -p ../param/myParam_mjo.py --mip ${mip} >& log/log.${mip}.txt &
disown
done
elif [ $parallel == yes ]; then
echo 'parallel yes'
modnames="all"
realization="all"
for mip in $mips; do
python -u ./parallel_driver.py -p ../doc/myParam_mjo.py --mip ${mip} --num_workers $num_workers --modnames $modnames --realization $realization >& log/log.parallel.${mip}.txt &
python -u ./parallel_driver.py -p ../param/myParam_mjo.py --mip ${mip} --num_workers $num_workers --modnames $modnames --realization $realization >& log/log.parallel.${mip}.txt &
disown
done
fi
2 changes: 1 addition & 1 deletion share/DefArgsCIA.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@
],
"help":"A list of variables to be processed"
}
}
}