Skip to content

Commit

Permalink
update regrid parameters (#234)
Browse files Browse the repository at this point in the history
* update regrid parameters

* pep8
  • Loading branch information
cehbrecht committed Sep 29, 2023
1 parent 9a333f6 commit 7399fac
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
21 changes: 16 additions & 5 deletions rook/processes/wps_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,28 @@ def __init__(self):
data_type="string",
min_occurs=1,
max_occurs=1,
allowed_values=["conservative", "patch", "nearest_s2d", "bilinear"],
allowed_values=["nearest_s2d", "bilinear", "conservative", "patch"],
default="nearest_s2d",
),
LiteralInput(
"grid",
"Regrid target grid",
abstract="Please specify output grid resolution for regridding. Default: 1deg",
abstract="Please specify output grid resolution for regridding. Default: auto",
data_type="string",
min_occurs=1,
max_occurs=1,
allowed_values=["1deg", "2deg_lsm", "0pt25deg_era5_lsm"],
default="1deg",
allowed_values=[
"auto",
"0pt25deg",
"0pt25deg_era5",
"0pt5deg_lsm",
"0pt625x0pt5deg",
"0pt75deg",
"1deg",
"1pt25deg",
"2pt5deg"
],
default="auto",
),
]
outputs = [
Expand Down Expand Up @@ -100,7 +110,8 @@ def _handler(self, request, response):
"apply_fixes": False,
"pre_checked": False,
"method": parse_wps_input(request.inputs, "method", default="nearest_s2d"),
"grid": parse_wps_input(request.inputs, "grid", default="1deg"),
"grid": parse_wps_input(request.inputs, "grid", default="auto"),
"adaptive_masking_threshold": 0.5,
}
# print(inputs)

Expand Down
1 change: 1 addition & 0 deletions rook/provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def add_operator(self, operator, parameters, collection, output):
"freq",
"method",
"grid",
"adaptive_masking_threshold",
"apply_fixes",
"apply_average",
]:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_wps_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@


def test_wps_regrid_cmip6():
# test the case where the inventory is used
client = client_for(Service(processes=[Regrid()], cfgfiles=[PYWPS_CFG]))
datainputs = "collection=c3s-cmip6.ScenarioMIP.INM.INM-CM5-0.ssp245.r1i1p1f1.Amon.rlds.gr1.v20190619"
datainputs += ";method=nearest_s2d"
datainputs += ";grid=1deg"
datainputs += ";grid=auto"
resp = client.get(
f"?service=WPS&request=Execute&version=1.0.0&identifier=regrid&datainputs={datainputs}"
)
Expand Down

0 comments on commit 7399fac

Please sign in to comment.