Skip to content

Commit

Permalink
fixed regrid test
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Nov 17, 2023
1 parent 99f890e commit 00353c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rook/director/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def _resolve(self):
if self.inputs.get("apply_fixes") and self.requires_fixes():
return

# TODO: quick fix for average and concat. Don't use original files for these operators.
if "dims" in self.inputs or "freq" in self.inputs:
# TODO: quick fix for average, regrid and concat. Don't use original files for these operators.
if "dims" in self.inputs or "freq" in self.inputs or "grid" in self.inputs:
return

# Finally, check if the subset requirements can align with whole datasets
Expand Down
16 changes: 14 additions & 2 deletions tests/test_wps_regrid.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import pytest

import xarray as xr

from pywps import Service
from pywps.tests import assert_response_success, client_for

from rook.processes.wps_regrid import Regrid

from .common import PYWPS_CFG, get_output
from .common import PYWPS_CFG, get_output, extract_paths_from_metalink


def assert_regrid(path):
assert "meta4" in path
paths = extract_paths_from_metalink(path)
assert len(paths) > 0
print(paths)
ds = xr.open_dataset(paths[0])
assert "time" in ds.coords


def test_wps_regrid_cmip6():
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 = "collection=CMIP6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803"
datainputs += ";method=nearest_s2d"
datainputs += ";grid=auto"
resp = client.get(
Expand All @@ -19,3 +30,4 @@ def test_wps_regrid_cmip6():
print(resp)
assert_response_success(resp)
assert "output" in get_output(resp.xml)
assert_regrid(path=get_output(resp.xml)["output"])

0 comments on commit 00353c2

Please sign in to comment.