Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #26 from cp4cds/issue-25-rainfarm-desc
Browse files Browse the repository at this point in the history
Added diagnostic description for rainfarm and rmse (#25)
  • Loading branch information
cehbrecht committed Jun 21, 2018
2 parents 4befc42 + 48d1323 commit 61ab40a
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 16 deletions.
15 changes: 10 additions & 5 deletions copernicus/processes/wps_perfmetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 10 additions & 4 deletions copernicus/processes/wps_rainfarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 12 additions & 7 deletions copernicus/processes/wps_rmse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions copernicus/util.py
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
14 changes: 14 additions & 0 deletions docs/source/processes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions tests/test_wps_rainfarm.py
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 17 additions & 0 deletions tests/test_wps_rmse.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 61ab40a

Please sign in to comment.