Skip to content

Commit

Permalink
Merge branch 'main' into 534_ao_extremes
Browse files Browse the repository at this point in the history
  • Loading branch information
acordonez authored Oct 26, 2023
2 parents 7d6831d + 26bf28a commit 221b830
Show file tree
Hide file tree
Showing 21 changed files with 1,770 additions and 63,244 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/build_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

workflow_dispatch:

env:
CANCEL_OTHERS: true
PATHS_IGNORE: '["**/README.rst", "**/docs/**", "**/ISSUE_TEMPLATE/**", "**/pull_request_template.md", "**/.vscode/**"]'

jobs:
check-jobs-to-skip:
runs-on: ubuntu-latest
Expand All @@ -27,25 +31,16 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Checkout Code Repository
uses: actions/checkout@v3
with:
node-version: '16'

- name: Set up Python
uses: actions/setup-python@v4
with:
node-version: '16'
python-version: '3.10'
# Run all pre-commit hooks on all the files.
# Getting only staged files can be tricky in case a new PR is opened
# since the action is run on a branch in detached head state

- name: Install and Run Pre-commit
uses: pre-commit/action@v3.0.0
with:
node-version: '16'

build:
needs: check-jobs-to-skip
Expand All @@ -56,9 +51,6 @@ jobs:
shell: bash -l {0}
timeout-minutes: 10
steps:
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: actions/checkout@v3

- name: Set up Conda Environment
Expand All @@ -82,7 +74,6 @@ jobs:
- name: Cache Conda
uses: actions/cache@v3
with:
node-version: '16'
path: ${{ env.CONDA }}/envs
key:
conda-${{ runner.os }}--${{ runner.arch }}--${{
Expand Down
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration file for `pre-commit` tool.
# Source: https://pre-commit.com/#pre-commit-configyaml---top-level
exclude: "docs|node_modules|migrations|.git|.tox|.md|sample_setups/(external-setups|jsons)|tests/deprecated"
exclude: "docs|node_modules|migrations|.git|.tox|README.md|sample_setups/(external-setups|jsons)|tests/deprecated"
default_stages: [commit]
fail_fast: true

Expand All @@ -20,16 +20,15 @@ repos:
# Python code formatters
# =======================
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
hooks:
- id: isort


# =======================
# Python linting
# =======================
Expand Down
19 changes: 15 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ regional monsoons, and high frequency characteristics of simulated precipitation

`PCMDI`_ uses the PMP to produce `quick-look simulation summaries across generations of CMIP <https://pcmdi.llnl.gov/metrics>`_.

The PMP expects model data to be `CF-compliant <http://cfconventions.org/>`_, otherwise,
to successfully use the package may require some input data conditioning.
It is also strongly suggested to work with observation datasets following the `CF-compliant <http://cfconventions.org/>`_,
such as datasets from the `obs4MIPs`_ project.
.. raw:: html

<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 80%; height: auto; margin-left: auto; margin-right: auto">
<iframe src="https://www.youtube.com/embed/STfCq5Biqf0" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
</div>


Getting Started
Expand All @@ -31,6 +32,16 @@ are summarized with interactive Jupyter notebooks in the :ref:`metrics` page

Some installation support for CMIP participating modeling groups is available: pcmdi-metrics@llnl.gov

The PMP expects model data to be `CF-compliant <http://cfconventions.org/>`_, otherwise,
to successfully use the package may require some input data conditioning.
It is also strongly suggested to work with observation datasets following the `CF-compliant <http://cfconventions.org/>`_,
such as datasets from the `obs4MIPs`_ project.

References
==========
Lee et al. (in prep, to be submitted soon), Objective Evaluation of Earth System Models: PCMDI Metrics Package (PMP) version 3, Geoscientific Model Development

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>`_.

Acknowledgement
===============
Expand Down
6 changes: 6 additions & 0 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ The primary application of the PMP is to evaluate simulations from the `Coupled
It can also be used to provide objective performance summaries during the model development process as well as selected research purposes.
The notes below provide a brief summary of some of the key aspects of the PMP design.

.. raw:: html

<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 80%; height: auto; margin-left: auto; margin-right: auto">
<iframe src="https://www.youtube.com/embed/STfCq5Biqf0" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
</div>

Software framework and dependencies
-----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/team.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ Core developers
* Peter Gleckler (LLNL)
* Min-Seop Ahn (NASA)

pcmdi-metrics@llnl.gov
Contact: pcmdi-metrics@llnl.gov
15 changes: 4 additions & 11 deletions pcmdi_metrics/cloud_feedback/cloud_feedback_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
version = param.version
input_files_json = param.input_files_json
path = param.path
xml_path = param.xml_path
data_path = param.data_path
figure_path = param.figure_path
output_path = param.output_path
Expand All @@ -45,7 +44,6 @@
print("version:", version)
print("path:", path)
print("input_files_json:", input_files_json)
print("xml_path:", xml_path)
print("figure_path:", figure_path)
print("output_path:", output_path)
print("output_json_filename:", output_json_filename)
Expand All @@ -57,9 +55,6 @@
else:
exps = ["amip", "amip-p4K"]

# generate xmls pointing to the cmorized netcdf files
os.makedirs(xml_path, exist_ok=True)

filenames = dict()

if input_files_json is not None:
Expand Down Expand Up @@ -108,9 +103,7 @@
searchstring = os.path.join(
ncfiles[exp][field]["path"], ncfiles[exp][field]["file"]
)
xmlname = os.path.join(xml_path, ".".join([exp, model, variant, field, "xml"]))
os.system("cdscan -x " + xmlname + " " + searchstring)
filenames[exp][field] = xmlname
filenames[exp][field] = searchstring

if debug:
with open(os.path.join(output_path, "filenames.json"), "w") as f:
Expand All @@ -123,17 +116,17 @@

# add this model's results to the pre-existing json file containing other models' results:
updated_fbk_dict, updated_obsc_fbk_dict = organize_fbk_jsons(
fbk_dict, obsc_fbk_dict, model, variant, datadir=data_path
fbk_dict, obsc_fbk_dict, model, variant
)
updated_err_dict = organize_err_jsons(err_dict, model, variant, datadir=data_path)
updated_err_dict = organize_err_jsons(err_dict, model, variant)

ecs = None
if get_ecs:
# calculate ECS and add it to the pre-existing json file containing other models' results:
ecs = compute_ECS(filenames)
print("calc ECS done")
print("ecs: ", ecs)
updated_ecs_dict = organize_ecs_jsons(ecs, model, variant, datadir=data_path)
updated_ecs_dict = organize_ecs_jsons(ecs, model, variant)

os.makedirs(output_path, exist_ok=True)
if debug:
Expand Down
Loading

0 comments on commit 221b830

Please sign in to comment.