Skip to content

Commit

Permalink
added wps regrid input parameters method and grid
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Sep 28, 2023
1 parent d828644 commit 7acbccb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 22 additions & 1 deletion rook/processes/wps_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ def __init__(self):
min_occurs=1,
max_occurs=1,
),
LiteralInput(
"method",
"Regrid method",
abstract="Regrid method like consevative or bilinear. Default: nearest_s2d",
data_type="string",
min_occurs=0,
max_occurs=1,
allowed_values=["conservative", "patch", "nearest_s2d", "bilinear"],
default="nearest_s2d",
),
LiteralInput(
"grid",
"Regrid target grid",
abstract="Regrid target grid like 1deg. Default: 1deg",
data_type="string",
min_occurs=0,
max_occurs=1,
allowed_values=["1deg", "2deg_lsm", "0pt25deg_era5_lsm"],
default="1deg",
),
]
outputs = [
ComplexOutput(
Expand Down Expand Up @@ -79,7 +99,8 @@ def _handler(self, request, response):
"output_dir": self.workdir,
"apply_fixes": False,
"pre_checked": False,
# "dims": ["latitude", "longitude"],
"method": parse_wps_input(request.inputs, "method", default="nearest_s2d"),
"grid": parse_wps_input(request.inputs, "grid", default="1deg"),
}
# print(inputs)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_wps_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ 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"
resp = client.get(
f"?service=WPS&request=Execute&version=1.0.0&identifier=regrid&datainputs={datainputs}"
)
Expand Down

0 comments on commit 7acbccb

Please sign in to comment.