diff --git a/copernicus/processes/wps_perfmetrics.py b/copernicus/processes/wps_perfmetrics.py index 1d07694..8e12ad6 100644 --- a/copernicus/processes/wps_perfmetrics.py +++ b/copernicus/processes/wps_perfmetrics.py @@ -69,13 +69,18 @@ def __init__(self): " As an additional reference, we consider the Righi et al. (2015) paper.", metadata=[ Metadata('ESMValTool', 'http://www.esmvaltool.org/'), + Metadata('Documentation', + 'https://copernicus-wps-demo.readthedocs.io/en/latest/processes.html#perfmetrics', + role=util.WPS_ROLE_DOC), + Metadata('Media', + util.diagdata_url() + '/perfmetrics/Portait.png', + role=util.WPS_ROLE_MEDIA), Metadata('Diagnostic Description', - util.diagdata_url() + '/perfmetrics/perfmetrics.yml'), - Metadata('Description', util.diagdata_url() + '/perfmetrics/description.md', - role='http://www.opengis.net/spec/wps/2.0/def/process/description/documentation'), # noqa - Metadata('Media', - util.diagdata_url() + '/perfmetrics/Portait.png'), + role=util.MAGIC_ROLE_DOC), + Metadata('Diagnostic Metadata', + util.diagdata_url() + '/perfmetrics/perfmetrics.yml', + role=util.MAGIC_ROLE_METADATA), ], inputs=inputs, outputs=outputs, diff --git a/copernicus/processes/wps_rainfarm.py b/copernicus/processes/wps_rainfarm.py index 8315415..f9f3f4f 100644 --- a/copernicus/processes/wps_rainfarm.py +++ b/copernicus/processes/wps_rainfarm.py @@ -69,12 +69,18 @@ def __init__(self): " precipitation fields from information simulated by climate models at regional scale.", metadata=[ Metadata('ESMValTool', 'http://www.esmvaltool.org/'), + Metadata('Documentation', + 'https://copernicus-wps-demo.readthedocs.io/en/latest/processes.html#rainfarm', + role=util.WPS_ROLE_DOC), + Metadata('Media', + util.diagdata_url() + '/rainfarm/rainfarm_thumbnail.png', + role=util.WPS_ROLE_MEDIA), Metadata('Diagnostic Description', - util.diagdata_url() + '/rainfarm/rainfarm.yml'), - Metadata('Description', util.diagdata_url() + '/rainfarm/description.md', - role='http://www.opengis.net/spec/wps/2.0/def/process/description/documentation'), # noqa - Metadata('Media', util.diagdata_url() + '/rainfarm/rainfarm_thumbnail.png'), + role=util.MAGIC_ROLE_DOC), + Metadata('Diagnostic Metadata', + util.diagdata_url() + '/rainfarm/rainfarm.yml', + role=util.MAGIC_ROLE_METADATA), ], inputs=inputs, outputs=outputs, diff --git a/copernicus/processes/wps_rmse.py b/copernicus/processes/wps_rmse.py index bace851..2fbc5b7 100644 --- a/copernicus/processes/wps_rmse.py +++ b/copernicus/processes/wps_rmse.py @@ -66,17 +66,22 @@ def __init__(self): title="Modes of variability", version=runner.VERSION, abstract="Tool to compute the RMSE between the observed and modelled patterns of variability " - " obtained through classification and their relative relative bias (percentage) " - " in the frequency of occurrence and the persistence of each mode.", + " obtained through classification and their relative relative bias (percentage) " + " in the frequency of occurrence and the persistence of each mode.", metadata=[ Metadata('ESMValTool', 'http://www.esmvaltool.org/'), + Metadata('Documentation', + 'https://copernicus-wps-demo.readthedocs.io/en/latest/processes.html#rmse', + role=util.WPS_ROLE_DOC), + Metadata('Media', + util.diagdata_url() + '/modes_of_variability/era_interim_1990-01-2010-01_clusters.png', + role=util.WPS_ROLE_MEDIA), Metadata('Diagnostic Description', - util.diagdata_url() + '/modes_of_variability/modes_of_variability.yml'), - Metadata('Description', util.diagdata_url() + '/modes_of_variability/description.md', - role='http://www.opengis.net/spec/wps/2.0/def/process/description/documentation'), # noqa - Metadata('Media', - util.diagdata_url() + '/modes_of_variability/era_interim_1990-01-2010-01_clusters.png'), + role=util.MAGIC_ROLE_DOC), + Metadata('Diagnostic Metadata', + util.diagdata_url() + '/modes_of_variability/modes_of_variability.yml', + role=util.MAGIC_ROLE_METADATA), ], inputs=inputs, outputs=outputs, diff --git a/copernicus/util.py b/copernicus/util.py index 4d0458d..e6657ac 100644 --- a/copernicus/util.py +++ b/copernicus/util.py @@ -1,6 +1,16 @@ import os +# wps roles +WPS_ROLE_BASE_URL = 'http://www.opengis.net/spec/wps/2.0/def/process/description' +WPS_ROLE_DOC = WPS_ROLE_BASE_URL + '/documentation' +WPS_ROLE_MEDIA = WPS_ROLE_BASE_URL + '/media' +# magic roles +MAGIC_ROLE_BASE_URL = 'http://c3s-magic.eu/spec/diagnostic/2.0' +MAGIC_ROLE_DOC = MAGIC_ROLE_BASE_URL + '/documentation' +MAGIC_ROLE_METADATA = MAGIC_ROLE_BASE_URL + '/metadata' + + def diagdata_file(filepath): return os.path.join(diagdata_directory(), filepath) diff --git a/docs/source/processes.rst b/docs/source/processes.rst index 839c36e..490a313 100644 --- a/docs/source/processes.rst +++ b/docs/source/processes.rst @@ -48,3 +48,17 @@ PyDemo .. autoprocess:: copernicus.processes.wps_pydemo.PyDemo :docstring: :skiplines: 1 + +RainFarm +-------- + +.. autoprocess:: copernicus.processes.wps_rainfarm.RainFarm + :docstring: + :skiplines: 1 + +RMSE +---- + +.. autoprocess:: copernicus.processes.wps_rmse.RMSE + :docstring: + :skiplines: 1 diff --git a/tests/test_wps_rainfarm.py b/tests/test_wps_rainfarm.py new file mode 100644 index 0000000..2aa61d6 --- /dev/null +++ b/tests/test_wps_rainfarm.py @@ -0,0 +1,17 @@ +import pytest + +from pywps import Service +from pywps.tests import assert_response_success + +from . common import client_for +from copernicus.processes.wps_rainfarm import RainFarm + + +def test_wps_rainfarm(): + client = client_for(Service(processes=[RainFarm()])) + datainputs = "regridding=false;slope=false" + resp = client.get( + service='WPS', request='Execute', version='1.0.0', identifier='rainfarm', + datainputs=datainputs) + print(resp.data) + assert_response_success(resp) diff --git a/tests/test_wps_rmse.py b/tests/test_wps_rmse.py new file mode 100644 index 0000000..baa57db --- /dev/null +++ b/tests/test_wps_rmse.py @@ -0,0 +1,17 @@ +import pytest + +from pywps import Service +from pywps.tests import assert_response_success + +from . common import client_for +from copernicus.processes.wps_rmse import RMSE + + +def test_wps_rmse(): + client = client_for(Service(processes=[RMSE()])) + datainputs = "eofs=false" + resp = client.get( + service='WPS', request='Execute', version='1.0.0', identifier='rmse', + datainputs=datainputs) + print(resp.data) + assert_response_success(resp)