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

Regional capabilities for precip variability #980

Merged
merged 73 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
d8605e1
Update calendar
acordonez Jul 19, 2023
5c0f295
Add resolution
acordonez Aug 22, 2023
1bbeef4
Add resolution
acordonez Aug 22, 2023
e4e59c4
Add res to arguments
acordonez Aug 22, 2023
434a202
update file names
acordonez Aug 22, 2023
aedfbdc
add bounding box
acordonez Aug 22, 2023
4af3b02
Add regions specs
acordonez Aug 22, 2023
c20e975
Use regions specs for region
acordonez Aug 22, 2023
93ecfaf
add import
acordonez Aug 22, 2023
b66ff65
add regions_specs
acordonez Aug 22, 2023
90177ed
Add new functions
acordonez Aug 22, 2023
30f08c5
add import for regions_specs
acordonez Aug 22, 2023
da35fe9
address xesmf zeros issue
acordonez Aug 23, 2023
924aa9d
Merge pull request #963 from PCMDI/961_precip_patches
acordonez Aug 23, 2023
74cd627
handle change in lon axis
acordonez Aug 23, 2023
cc58283
update call
acordonez Aug 23, 2023
38ee1d8
Use unmapped_to_nan in regridding
acordonez Sep 11, 2023
c79d7ee
Keep dataset for cropping
acordonez Sep 11, 2023
9bd3f0c
Regridder needs var
acordonez Sep 11, 2023
686e515
add var call
acordonez Sep 11, 2023
d007ffa
Use rgtmp_ds variable
acordonez Sep 11, 2023
4538694
Regional metrics in JSON
acordonez Sep 11, 2023
de031f3
Add regions_specs to function call
acordonez Sep 11, 2023
dd37085
not a list
acordonez Sep 11, 2023
d6ea6d6
Fix region metrics selection
acordonez Sep 11, 2023
7e9ee74
Merge branch 'main' into ao_update_precip_var
acordonez Sep 12, 2023
dcc9fa2
Add region cropping
acordonez Sep 18, 2023
617c4d0
Add params for shpfile crop
acordonez Sep 18, 2023
d22b6cb
Add args for region from shpfile
acordonez Sep 18, 2023
370d6b2
add import statement
acordonez Sep 18, 2023
c320b30
Fix commas
acordonez Sep 18, 2023
14a61f2
add cal
acordonez Aug 14, 2023
454e05e
tests
acordonez Sep 25, 2023
9d721ac
tests
acordonez Sep 25, 2023
255db29
Merge branch 'main' into ao_update_precip_var
acordonez Sep 26, 2023
978e680
Merge branch 'main' into ao_update_precip_var
acordonez Oct 6, 2023
f11756e
Remove region cropping into regridding func
acordonez Oct 6, 2023
fbed732
fix calendar
acordonez Feb 20, 2024
f8a953c
Merge branch 'ao_update_precip_var' into 1064_precip_var_ao
acordonez Mar 1, 2024
ce2ffb1
Merge pull request #1065 from PCMDI/1064_precip_var_ao
acordonez Mar 1, 2024
5ad5eb1
Merge branch 'main' into ao_update_precip_var
acordonez Mar 1, 2024
214a10e
clean up and precommit
acordonez Mar 1, 2024
e37bafd
remove timing
acordonez Mar 1, 2024
157adea
fix white space
acordonez Mar 1, 2024
4df78fa
add figure scripts
acordonez Mar 12, 2024
029e843
run precommit
acordonez Mar 12, 2024
9d35ceb
Merge branch 'main' into ao_update_precip_var
acordonez Apr 23, 2024
b987211
Merge branch 'main' into ao_update_precip_var
acordonez Jun 4, 2024
b0ca905
Update __init__.py
acordonez Jun 4, 2024
69daa46
Merge branch 'main' into ao_update_precip_var
acordonez Jun 17, 2024
807dab9
update lat lon vars
acordonez Jun 17, 2024
5974cca
move check
acordonez Jun 17, 2024
6510a26
run precommit
acordonez Jun 17, 2024
6630229
fix regino
acordonez Jun 17, 2024
5b197c2
fix lon issues
acordonez Jun 25, 2024
43f8de5
fix lon
acordonez Jun 25, 2024
cd1327f
update syntax
acordonez Aug 1, 2024
970faf9
Merge branch 'main' into ao_update_precip_var
acordonez Aug 1, 2024
a81c785
Update params
acordonez Aug 1, 2024
172d8f2
remove files
acordonez Aug 1, 2024
7f70a0c
Add res
acordonez Aug 1, 2024
b0b7634
Merge branch 'main' into ao_update_precip_var
acordonez Aug 14, 2024
b0d64aa
Merge branch 'main' into ao_update_precip_var
acordonez Aug 14, 2024
f2b6709
Merge branch 'main' into ao_update_precip_var
acordonez Aug 23, 2024
bacb891
fix regionspsecs
acordonez Aug 26, 2024
1fc32fd
Merge branch 'main' into ao_update_precip_var
acordonez Aug 26, 2024
e094b86
bug fixes
acordonez Aug 26, 2024
7b60bb7
bug fixes
acordonez Aug 28, 2024
9a6f284
Merge branch 'main' into ao_update_precip_var
acordonez Sep 18, 2024
017fedc
add example
acordonez Sep 18, 2024
d56d373
update region ex
Sep 18, 2024
92631c4
Merge branch 'main' into ao_update_precip_var
acordonez Sep 23, 2024
04d805a
Merge branch 'main' into ao_update_precip_var
lee1043 Sep 24, 2024
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
591 changes: 348 additions & 243 deletions doc/jupyter/Demo/Demo_7_precip_variability.ipynb

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/metrics_precip-variability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ Options available to set in the parameter file include:
* **nperseg**: Length of segment in power spectra.
* **noverlap**: Length of overlap between segments in power spectra.
* **ref**: Reference data path.
* **res**: Target resolution in degrees.
* **regions_specs**: Dictionary containing region bounding box. Uses format {"your region name": {"domain": {"latitude": (min, max), "longitude": (min, max)}}}. Min and max should be replaced with the values that define the region.
* **region_file**: Path to a shapefile containing vector region outline. Must use with **attr** and **feature** parameters.
* **attr**: Attribute used to identify region in shapefile (eg, column of attribute table). For example, "COUNTRY" in a shapefile of countries.
* **feature**: Unique feature value of the region that occurs in the attribute given by "--attr". Must match only one geometry in the shapefile. An example is a feature called "USA" under the attribute "COUNTRY".
* **cmec**: Set to True to output CMEC formatted JSON.

Metric
Expand Down
1 change: 1 addition & 0 deletions pcmdi_metrics/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .string_constructor import StringConstructor, fill_template # noqa # isort:skip
from . import base # noqa
from .base import MV2Json # noqa

from .xcdat_dataset_io import ( # noqa # isort:skip
da_to_ds,
get_axis_list,
Expand Down
3 changes: 2 additions & 1 deletion pcmdi_metrics/precip_variability/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
ClimAnom,
Powerspectrum,
RedNoiseSignificanceLevel,
Regrid2deg,
RegridHoriz,
CropLatLon,
lag1_autocorrelation,
prdday_to_frqidx,
precip_variability_across_timescale,
Expand Down
33 changes: 33 additions & 0 deletions pcmdi_metrics/precip_variability/lib/argparse_functions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import ast


def AddParserArgument(P):
P.add_argument(
"--mip", type=str, dest="mip", default=None, help="cmip5, cmip6 or other mip"
Expand Down Expand Up @@ -57,6 +60,21 @@ def AddParserArgument(P):
P.add_argument(
"--ref", type=str, dest="ref", default=None, help="reference data path"
)
P.add_argument(
"--res",
type=int,
dest="res",
default=2,
help="Horizontal resolution [degree] for interpolation (lon, lat)",
)
P.add_argument(
"--regions_specs",
type=ast.literal_eval,
dest="regions_specs",
help="Provide a single custom region",
default=None,
required=False,
)
P.add_argument(
"--cmec",
dest="cmec",
Expand All @@ -71,6 +89,21 @@ def AddParserArgument(P):
action="store_false",
help="Do not save CMEC format metrics JSON",
)
P.add_argument(
"--region_file",
dest="region_file",
help="File containing vector region of interest.",
default=None,
)
P.add_argument(
"--feature", dest="feature", help="Feature in vectorized region.", default=None
)
P.add_argument(
"--attr",
dest="attr",
help="Attribute containing feature in vectorized region.",
default=None,
)
P.set_defaults(cmec=False)

return P
Loading
Loading