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

CMEC Driver support #743

Merged
merged 40 commits into from
Jul 16, 2021
Merged

CMEC Driver support #743

merged 40 commits into from
Jul 16, 2021

Conversation

acordonez
Copy link
Collaborator

@acordonez acordonez commented May 20, 2021

These changes add support to run PMP metrics via cmec-driver. By default, this set-up will use the PMP demo data to run the metrics out-of-the-box. To run with different data, make changes in cmec-driver/config/cmec.json.

Along with the settings JSONs and driver scripts required by cmec-driver (in the "cmec" folder), I made small changes to a few other scripts. In pcmdi_metrics/pcmdi/scripts/pcmdi_compute_climatologies.py there is a fix for the case where the start and end years are not provided. In the Base write_cmec function I removed the "indices" key from under "statistics" since this convention was copied from ILAMB, which generates indices as metrics, but doesn't apply to PMP. In Monsoon (Sperber) I added support for generating a CMEC-compliant results JSON.

Instructions for testing:

PCMDI Metrics

  1. Pull PMP branch 742_ao_cmec_driver and run python setup.py install (needed to get AC fix and monsoon_sperber cmec option)
  2. Download the PMP demo data if you do not already have it.
  3. Install the cmec pcmdi metrics environment: Inside the pcmdi_metrics parent directory, do conda env create --file cmec/cmec_pcmdi_metrics.yml

Cmec-driver

Setup:

  1. Clone cmec-driver (https://github.com/cmecmetrics/cmec-driver)
  2. Enter cmec-driver parent directory
  3. Create an output directory: mkdir output
  4. (first-time use) Register conda env info with cmec-driver:
    `python cmec-driver.py setup -conda_source -env_root
  5. Register the PMP: python cmec-driver.py register <path_to_pcmdi_metrics>
  6. Check that module is registered: python cmec-driver.py list -all
  7. Once module is registered, the default settings are populated in config/cmec.json. These settings can be edited in this file before running the metrics.

Test Run

Generic command: python cmec-driver.py run -obs <obs_dir> <model_dir> <output_dir> Module/configuration
Example: python cmec-driver.py run -obs demo_data/ demo_data/ output/ PMP/monsoon_wang (demo data path is provided twice - once for obs, and once for model).
Results for this run are located in output/PMP/monsoon_sperber.
Note for mean_climate: When using the demo data, include the PCMDIobs2_clims folder name in your obs directory.

Metrics Names (Configurations)

mean_climate
diurnal_cycle
monsoon_wang
monsoon_sperber
variability_modes
mjo

Future improvements

As noted in Issue 742, there are a few remaining changes for CMEC compliance and ease of use that are not included in this PR.

@acordonez
Copy link
Collaborator Author

@gleckler1 @lee1043 Here's what I have so far for the PMP CMEC driver support. All the metrics are set up to run using the demo data out-of-the-box.

@acordonez acordonez marked this pull request as ready for review July 14, 2021 20:23
@acordonez
Copy link
Collaborator Author

@gleckler1 @lee1043 I've updated this branch and it is ready to merge once CircleCi finishes. I see under the "Merge pull request" button (down arrow on right) that there is an option to "Squash and Merge" - since I have a pretty messy commit history, can we use this option?

@acordonez acordonez requested a review from lee1043 July 14, 2021 20:41
@acordonez acordonez linked an issue Jul 14, 2021 that may be closed by this pull request
9 tasks
@lee1043
Copy link
Contributor

lee1043 commented Jul 14, 2021

@acordonez I never knew about the "Squash and Merge" option for merging, so it's good to learn about it -- thanks! I have no prob with using that option.

Copy link
Contributor

@lee1043 lee1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed a very nice and important accomplishment. Thank you, @acordonez, for your hard work!

@gleckler1 gleckler1 merged commit e66938d into master Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CMEC driver compatible metrics
3 participants