Skip to content

Commit

Permalink
Merge pull request #861 from PCMDI/763_msa_precip_distribution
Browse files Browse the repository at this point in the history
763 msa precip distribution
  • Loading branch information
lee1043 committed Oct 15, 2022
2 parents e5233a2 + 348e216 commit 35107eb
Show file tree
Hide file tree
Showing 22 changed files with 2,759 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Some installation support for CMIP participating modeling groups is available: p

[PMP versions](https://github.com/PCMDI/pcmdi_metrics/releases)
------------
- [v2.5.0](https://github.com/PCMDI/pcmdi_metrics/releases/tag/v2.5.0) - New metric added: Precipitation Benchmarking -- distribution. Graphics updated
- [v2.4.0](https://github.com/PCMDI/pcmdi_metrics/releases/tag/v2.4.0) - New metric added: AMO in variability modes
- [v2.3.2](https://github.com/PCMDI/pcmdi_metrics/releases/tag/v2.3.2) - CMEC interface updates
- [v2.3.1](https://github.com/PCMDI/pcmdi_metrics/releases/tag/v2.3.1) - Technical update
Expand Down
6 changes: 5 additions & 1 deletion conda-env/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ dependencies:
- eofs=1.4.0
- seaborn=0.11.1
- enso_metrics=1.1.1
- netcdf4=1.6.0
- regionmask=0.9.0
- rasterio=1.2.10
- shapely=1.8.0
# Testing
# ==================
- pre_commit=2.15.0
- pre_commit=2.20.0
- pytest=6.2.5
- pytest-cov=3.0.0
# Developer Tools
Expand Down
28 changes: 28 additions & 0 deletions pcmdi_metrics/precip_distribution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Precip distribution metrics

Reference: Ahn, M.-S., P. A. Ullrich, P. J. Gleckler, J. Lee, A. C. Ordonez, and A. G. Pendergrass, 2022: Evaluating Precipitation Distributions at Regional Scales: A Benchmarking Framework and Application to CMIP5 and CMIP6. Geoscientific Model Development (Submitted)

## Driver code:
- `precip_distribution_driver.py`

## Parameter codes:
- `param/`
- `precip_distribution_params_IMERG.py`
- `precip_distribution_params_TRMM.py`
- `precip_distribution_params_CMORPH.py`
- `precip_distribution_params_GPCP.py`
- `precip_distribution_params_PERSIANN.py`
- `precip_distribution_params_ERA5.py`
- `precip_distribution_params_cmip5.py`
- `precip_distribution_params_cmip6.py`

## Run scripts:
- `scripts_pcmdi/`
- `run_obs.bash`
- `run_parallel.wait.bash`

## Note
- Input data: daily averaged precipitation
- 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.
Empty file.
19 changes: 19 additions & 0 deletions pcmdi_metrics/precip_distribution/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from .argparse_functions import AddParserArgument # noqa
from .lib_precip_distribution import ( # noqa
CalcBinStructure,
CalcMetricsDomain,
CalcMetricsDomain3Clust,
CalcMetricsDomainAR6,
CalcP10P90,
CalcPscore,
CalcRainMetrics,
MakeDists,
MedDomain,
MedDomain3Clust,
MedDomainAR6,
Regrid,
getDailyCalendarMonth,
oneyear,
precip_distribution_cum,
precip_distribution_frq_amt,
)
79 changes: 79 additions & 0 deletions pcmdi_metrics/precip_distribution/lib/argparse_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
def AddParserArgument(P):
P.add_argument(
"--mip", type=str, dest="mip", default=None, help="cmip5, cmip6 or other mip"
)
P.add_argument(
"--exp", type=str, dest="exp", default=None, help="amip, cmip or others"
)
P.add_argument("--mod", type=str, dest="mod", default=None, help="model")
P.add_argument(
"--var", type=str, dest="var", default=None, help="pr or other variable"
)
P.add_argument(
"--frq", type=str, dest="frq", default=None, help="day, 3hr or other frequency"
)
P.add_argument(
"--modpath", type=str, dest="modpath", default=None, help="data directory path"
)
P.add_argument(
"--results_dir",
type=str,
dest="results_dir",
default=None,
help="results directory path",
)
P.add_argument(
"--case_id", type=str, dest="case_id", default=None, help="case_id with date"
)
P.add_argument(
"--prd",
type=int,
dest="prd",
nargs="+",
default=None,
help="start- and end-year for analysis (e.g., 1985 2004)",
)
P.add_argument(
"--fac",
type=str,
dest="fac",
default=None,
help="factor to make unit of [mm/day]",
)
P.add_argument(
"--res",
type=int,
dest="res",
nargs="+",
default=None,
help="list of target horizontal resolution [degree] for interporation (lon, lat)",
)
P.add_argument("--ref", type=str, dest="ref", default=None, help="reference data")
P.add_argument(
"--ref_dir",
type=str,
dest="ref_dir",
default=None,
help="reference directory path",
)
P.add_argument(
"--exp", type=str, dest="exp", default=None, help="e.g., historical or amip"
)
P.add_argument("--ver", type=str, dest="ver", default=None, help="version")
P.add_argument(
"--cmec",
dest="cmec",
default=False,
action="store_true",
help="Use to save CMEC format metrics JSON",
)
P.add_argument(
"--no_cmec",
dest="cmec",
default=False,
action="store_false",
help="Do not save CMEC format metrics JSON",
)
P.set_defaults(cmec=False)

return P
Binary file not shown.

0 comments on commit 35107eb

Please sign in to comment.