In [1]:
from birdy import WPSClient
url = 'https://bovec.dkrz.de/ows/proxy/roocs'
#url = 'http://localhost:5000/wps'
roocs = WPSClient(url)
In [2]:
roocs?
In [3]:
roocs.subset?
In [4]:
resp_subset = roocs.subset(
data_ref='cmip5.output1.MOHC.HadGEM2-ES.rcp85.mon.atmos.Amon.r1i1p1.latest.tas',
time='2085-01-01/2120-12-30',
)
In [5]:
resp_subset.get()
Out[5]:
Show HTTP headers of output
In [6]:
import requests
response = requests.head(resp_subset.get()[0])
response.headers
Out[6]:
In [7]:
roocs.average?
In [8]:
roocs.orchestrate?
Simple Workflow Chain
In [9]:
wf_simple = {
'doc': "simple workflow",
'inputs': {
'data_ref': ['cmip5.output1.MOHC.HadGEM2-ES.rcp85.mon.atmos.Amon.r1i1p1.latest.tas'],
},
'steps': [
{'subset': {"time": "2085-01-01/2120-12-30"}},
{'subset': {"time": "2090-01-01/2100-12-30"}},
{'average': {"axes": "time"}}
]}
In [10]:
import json
wf_simple_json = json.dumps(wf_simple)
wf_simple_json
Out[10]:
In [11]:
resp_wf = roocs.orchestrate(workflow=wf_simple_json, mode='simple')
In [12]:
resp_wf.get()
Out[12]:
Workflow with Function Tree
In [13]:
wf_tree = {
'doc': "tree workflow",
'inputs': {
'tas': ['cmip5.output1.MOHC.HadGEM2-ES.rcp85.mon.atmos.Amon.r1i1p1.latest.tas'],
},
"outputs": {
"output": "average_tas/output"
},
'steps': {
"subset_tas_1": {
"run": "subset",
"in": {
"data_ref": "inputs/tas",
"time": "2085-01-01/2120-12-30"
}
},
"subset_tas_2": {
"run": "subset",
"in": {
"data_ref": "subset_tas_1/output",
"time": "2090-01-01/2100-12-30"
}
},
"average_tas": {
"run": "average",
"in": {
"data_ref": "subset_tas_2/output",
"axes": "time"
}
}
}}
In [14]:
wf_tree_json = json.dumps(wf_tree)
wf_tree_json
Out[14]:
In [15]:
resp_wf = roocs.orchestrate(workflow=wf_tree_json, mode='tree')
In [16]:
resp_wf.get()
Out[16]: