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

Add precip variability and distribution to docs #966

Merged
merged 32 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
238dab7
add version
Jan 13, 2021
7c4d089
Merge branch 'master' of https://github.com/PCMDI/pcmdi_metrics
Jan 13, 2021
a708613
resolve conflicts
Mar 12, 2021
2505ed1
Merge branch 'master' of https://github.com/PCMDI/pcmdi_metrics
Apr 27, 2021
fa3d8f7
Merge branch 'master' of https://github.com/PCMDI/pcmdi_metrics
May 4, 2021
718e4e9
Merge branch 'master' of https://github.com/PCMDI/pcmdi_metrics
May 25, 2021
8d829f7
Merge branch 'master' of https://github.com/PCMDI/pcmdi_metrics
Aug 31, 2021
1232d0d
Merge branch 'main' of https://github.com/PCMDI/pcmdi_metrics into main
Jul 19, 2022
74f1380
Merge branch 'main' of https://github.com/PCMDI/pcmdi_metrics into main
Oct 19, 2022
1517414
Merge branch 'main' of https://github.com/PCMDI/pcmdi_metrics into main
Oct 20, 2022
3dc0c54
Merge branch 'main' of https://github.com/PCMDI/pcmdi_metrics into main
Feb 16, 2023
cd5c94e
Merge branch 'main' of https://github.com/PCMDI/pcmdi_metrics into main
Feb 28, 2023
9b54465
Merge branch 'main' of https://github.com/PCMDI/pcmdi_metrics into main
Apr 26, 2023
803fbe1
Merge branch 'main' of https://github.com/PCMDI/pcmdi_metrics into main
Jul 18, 2023
ccf8095
add page
Jul 28, 2023
54248bf
fix formatting
Jul 28, 2023
4198e46
fix formatting
Jul 28, 2023
e14aa15
fix formatting
Jul 28, 2023
dddc7c2
add link
Jul 28, 2023
ec83ae9
fix link
Jul 28, 2023
8e68247
add title
Jul 28, 2023
aa71f3c
add precip distribution page
Jul 29, 2023
b6cfe1f
Add details from readme
acordonez Jul 31, 2023
9aa1371
Add calc_ratio
acordonez Jul 31, 2023
95e0a42
Add obs note
acordonez Aug 24, 2023
20e1b4e
Merge branch 'main' into ao_965_update_docs
lee1043 Aug 30, 2023
68594fb
Merge branch 'main' into ao_965_update_docs
lee1043 Sep 18, 2023
25d550b
Merge branch 'main' into ao_965_update_docs
acordonez Sep 26, 2023
5fc6c0f
Merge branch 'main' into ao_965_update_docs
lee1043 Nov 9, 2023
cc9316f
Merge branch 'main' into ao_965_update_docs
lee1043 Nov 28, 2023
11abb82
Update metrics_precip-distribution.rst
lee1043 Nov 30, 2023
38c89a3
Update metrics_precip-distribution.rst
lee1043 Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ A suite of demo scripts and interactive Jupyter notebooks are provided with `thi
metrics_enso
metrics_mjo
metrics_monsoon
metrics_precip-variability
metrics_precip-distribution


73 changes: 73 additions & 0 deletions docs/metrics_precip-distribution.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
.. _metrics_precip-distribution:

**************************
Precipitation Distribution
**************************

Overview
========
With the global domain partitioned into 62 regions, including 46 land and 16 ocean regions, we apply 10 established precipitation distribution metrics. The collection includes metrics focused on the maximum peak, lower 10th percentile, and upper 90th percentile in precipitation amount and frequency distributions; the similarity between observed and modeled frequency distributions; an unevenness measure based on cumulative amount; average total intensity on all days with precipitation; and number of precipitating days each year.

Demo
====
In preparation

Exampe parameter files
======================
A set of example parameter files for models and observations can be viewed at `this link`_.

Required data sets
==================

This driver expects daily averaged precipitation.

Input files must use the following name convention: ::

variable_frequency_model_experiment_ensemble_startdate-enddate.nc

Because underscores are used to separate these elements, they may not be used anywhere else in the file name.

Start and end dates must use the YYYYMMDD format.

For example, these are valid input file names: ::

pr_day_bcc-csm1-1_historical_r1i1p1_19800101-19841231.nc
pr_3hr_IMERG-v06B-Final_PCMDI_2x2_20100401-20100430.nc

If the time series for a single data set is spread across multiple files, those files must be located in a single directory.

Usage
=====
Users will set up a parameter file and run the precipitation variability driver on the command line.
To run the driver, use: ::

precip_distribution_driver.py -p parameter_file

This code should be run for a reference observation initially as some metrics (e.g., Perkins score) need a reference.

After completing calculation for a reference observation, this code can work for multiple datasets at once.

This benchmarking framework provides three tiers of area averaged outputs for i) large scale domain (Tropics and Extratropics with separated land and ocean) commonly used in the PMP , ii) large scale domain with clustered precipitation characteristics (Tropics and Extratropics with separated land and ocean, and separated heavy, moderate, and light precipitation regions), and iii) modified IPCC AR6 regions shown in the reference paper.

Options available to set in the parameter file include:

* **mip**: Name of MIP.
* **var**: Name of data set variable, e.g. "pr".
* **frq**: Frequency of data set, either "day" or "3hr".
* **modpath**: Path to directory containing input data files.
* **mod**: Name of model file or wildcard "*" to use all files in directory. Symlinks may be used.
* **results_dir**: Results directory path.
* **case_id**: Case id.
* **prd**: Start and end years for analysis as list, e.g. [start_year, end_year].
* **fac**: Factor to convert from data set units to mm/day. Set to 1 for no conversion.
* **res**: List of target horizontal resolutions in degrees for interporation.
* **ref**: Reference data path.
* **ref_dir**: Reference directory path.
* **cmec**: Set to True to output CMEC formatted JSON.


.. _this link: https://github.com/PCMDI/pcmdi_metrics/tree/main/pcmdi_metrics/precip_distribution/param

Reference
=========
Ahn, M.-S., P. A. Ullrich, P. J. Gleckler, J. Lee, A. C. Ordonez, and A. G. Pendergrass, 2023: Evaluating Precipitation Distributions at Regional Scales: A Benchmarking Framework and Application to CMIP5 and CMIP6. Geoscientific Model Development, 16, 3927–3951, https://doi.org/10.5194/gmd-16-3927-2023
92 changes: 92 additions & 0 deletions docs/metrics_precip-variability.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
.. _metrics_precip-variability:

*******************************************
Precipitation Variability Across Timescales
*******************************************

Overview
========
This set of metrics is designed to measure precipitation variabilty across multiple timescales, including subdaily.

Demo
====
* `PMP demo Jupyter notebook`_

Exampe parameter files
======================
A set of example parameter files for models and observations can be viewed at `this link`_.

Required data sets
==================

Input files must use the following name convention: ::

variable_frequency_model_experiment_ensemble_startdate-enddate.nc

Because underscores are used to separate these elements, they may not be used anywhere else in the file name.

Start and end dates must use the YYYYMMDD or YYYYMMDDHHHH format.

For example, these are valid input file names: ::

pr_day_bcc-csm1-1_historical_r1i1p1_19800101-19841231.nc
pr_3hr_IMERG-v06B-Final_PCMDI_2x2_201004010000-201004302100.nc

If the time series for a single data set is spread across multiple files, those files must be located in a single directory.

Usage
=====

Spectral averages
*****************

Users will set up a parameter file and run the precipitation variability driver on the command line.
To run the driver, use: ::

variability_across_timescales_PS_driver.py -p parameter_file

Results are reported on a 2x2 degree latitude/longitude world grid.

Options available to set in the parameter file include:

* **mip**: Name of MIP. Use "obs" for reference datasets.
* **exp**: Name of experiment.
* **var**: Name of data set variable, e.g. "pr".
* **frq**: Frequency of data set, either "day" or "3hr".
* **modpath**: Path to directory containing input data files.
* **mod**: Name of model file or wildcard "*" to use all files in directory. Symlinks may be used.
* **results_dir**: Results directory path.
* **case_id**: Case id.
* **prd**: Start and end years for analysis as list, e.g. [start_year, end_year].
* **fac**: Factor to convert from data set units to mm/day. Set to 1 for no conversion.
* **nperseg**: Length of segment in power spectra.
* **noverlap**: Length of overlap between segments in power spectra.
* **ref**: Reference data path.
* **cmec**: Set to True to output CMEC formatted JSON.

Metric
******

The precipitation variability metric can be generated after model and observational spectral averages are made.

A script called `calc_ratio.py`_ is provided in the precip_variability codebase. This script can be called with three arguments to generate the ratio.

* **ref**: path to obs results JSON
* **modpath**: directory containing model results JSONS (not CMEC formatted JSONs)
* **results_dir**: directory for calc_ratio.py results

The calc_ratio.py script must be called with python directly. For example, to run this script using files from a directory called "results": ::

python pcmdi_metrics/pcmdi_metrics/precip_variability/scripts_pcmdi/calc_ratio.py \
--ref results/precip_variability/GPCP-1-3/PS_pr.day_regrid.180x90_area.freq.mean_GPCP-1-3.json \
--modpath results/precip_variability/GISS-E2-H/ \
--results_dir results/precip_variability/ratio/

Reference
==========
Ahn, M.-S., P. J. Gleckler, J. Lee, A. G. Pendergrass, and C. Jakob, 2022: Benchmarking Simulated Precipitation Variability Amplitude across Timescales. Journal of Climate. https://doi.org/10.1175/JCLI-D-21-0542.1


.. _PMP demo Jupyter notebook: https://github.com/PCMDI/pcmdi_metrics/blob/main/doc/jupyter/Demo/Demo_7_precip_variability.ipynb
.. _this link: https://github.com/PCMDI/pcmdi_metrics/tree/main/pcmdi_metrics/precip_variability/param
.. _calc_ratio.py: https://github.com/PCMDI/pcmdi_metrics/blob/main/pcmdi_metrics/precip_variability/scripts_pcmdi/calc_ratio.py
Loading