Skip to content

Commit

Permalink
Merge branch 'main' into feature/1084_lee1043_MJO-xcdat
Browse files Browse the repository at this point in the history
  • Loading branch information
lee1043 committed Jun 6, 2024
2 parents 177f616 + d2d7f4e commit e9e3be0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ such as datasets from the `obs4MIPs`_ project.

References
==========
Lee, J., P. J. Gleckler, M.-S. Ahn, A. Ordonez, P. Ullrich, K. R. Sperber, K. E. Taylor, Y. Y. Planton, E. Guilyardi, P. Durack, C. Bonfils, M. D. Zelinka, L.-W. Chao, B. Dong, C. Doutriaux, C. Zhang, T. Vo, J. Boutte, M. F. Wehner, A. G. Pendergrass, D. Kim, Z. Xue, A. T. Wittenberg, and J. Krasting, 2024: Systematic and Objective Evaluation of Earth System Models: PCMDI Metrics Package (PMP) version 3. Geoscientific Model Development (accepted, publication in progress) [`preprint<https://egusphere.copernicus.org/preprints/2023/egusphere-2023-2720/>`_].
Lee, J., P. J. Gleckler, M.-S. Ahn, A. Ordonez, P. Ullrich, K. R. Sperber, K. E. Taylor, Y. Y. Planton, E. Guilyardi, P. Durack, C. Bonfils, M. D. Zelinka, L.-W. Chao, B. Dong, C. Doutriaux, C. Zhang, T. Vo, J. Boutte, M. F. Wehner, A. G. Pendergrass, D. Kim, Z. Xue, A. T. Wittenberg, and J. Krasting, 2024: Systematic and Objective Evaluation of Earth System Models: PCMDI Metrics Package (PMP) version 3. Geoscientific Model Development, 17, 3919–3948, https://doi.org/10.5194/gmd-17-3919-2024.

Gleckler et al. (2016), A more powerful reality test for climate models, Eos, 97, `doi:10.1029/2016EO051663 <https://eos.org/science-updates/a-more-powerful-reality-test-for-climate-models>`_.

Expand Down
1 change: 1 addition & 0 deletions docs/metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ A suite of demo scripts and interactive Jupyter notebooks are provided with `thi
metrics_precip-distribution
metrics_subdaily-precipitation
metrics_sea_ice
Cloud Feedbacks <https://github.com/PCMDI/pcmdi_metrics/blob/main/pcmdi_metrics/cloud_feedback/README.md>
45 changes: 22 additions & 23 deletions pcmdi_metrics/sea_ice/sea_ice_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@
end_year = meyear

real_clim = {
"arctic": {"model_mean": None},
"ca": {"model_mean": None},
"na": {"model_mean": None},
"np": {"model_mean": None},
"antarctic": {"model_mean": None},
"sp": {"model_mean": None},
"sa": {"model_mean": None},
"io": {"model_mean": None},
"arctic": {"model_mean": {}},
"ca": {"model_mean": {}},
"na": {"model_mean": {}},
"np": {"model_mean": {}},
"antarctic": {"model_mean": {}},
"sp": {"model_mean": {}},
"sa": {"model_mean": {}},
"io": {"model_mean": {}},
}
real_mean = {
"arctic": {"model_mean": 0},
Expand Down Expand Up @@ -309,7 +309,15 @@
"%(model_version)": model,
"%(realization)": run,
}
test_data_full_path = os.path.join(test_data_path, filename_template)
test_data_tmp = lib.replace_multi(test_data_path, tags)
if "*" in test_data_tmp:
# Get the most recent version for last wildcard
ind = test_data_tmp.split("/")[::-1].index("*")
tmp1 = "/".join(test_data_tmp.split("/")[0:-ind])
globbed = glob.glob(tmp1)
globbed.sort()
test_data_tmp = globbed[-1]
test_data_full_path = os.path.join(test_data_tmp, filename_template)
test_data_full_path = lib.replace_multi(test_data_full_path, tags)
test_data_full_path = glob.glob(test_data_full_path)
test_data_full_path.sort()
Expand Down Expand Up @@ -365,29 +373,20 @@
# Running sum of all realizations
for rgn in clims:
real_clim[rgn][run] = clims[rgn]
if real_clim[rgn]["model_mean"] is None:
real_clim[rgn]["model_mean"] = clims[rgn]
else:
real_clim[rgn]["model_mean"][var] = (
real_clim[rgn]["model_mean"][var] + clims[rgn][var]
)
real_mean[rgn][run] = means[rgn]
real_mean[rgn]["model_mean"] = (
real_mean[rgn]["model_mean"] + means[rgn]
)

print("\n-------------------------------------------")
print("Calculating model regional average metrics \nfor ", model)
print("--------------------------------------------")
for rgn in real_clim:
print(rgn)
# Get model mean
real_clim[rgn]["model_mean"][var] = real_clim[rgn]["model_mean"][
var
] / len(list_of_runs)
real_mean[rgn]["model_mean"] = real_mean[rgn]["model_mean"] / len(
list_of_runs
datalist = [real_clim[rgn][r][var].data for r in list_of_runs]
real_clim[rgn]["model_mean"][var] = np.nanmean(
np.array(datalist), axis=0
)
datalist = [real_mean[rgn][r] for r in list_of_runs]
real_mean[rgn]["model_mean"] = np.nanmean(np.array(datalist))

for run in real_clim[rgn]:
# Set up metrics dictionary
Expand Down

0 comments on commit e9e3be0

Please sign in to comment.