import os
# os.environ['ROOK_URL'] = 'http://rook1.dkrz.de/wps'
os.environ['ROOK_URL'] = 'http://localhost:5000/wps'
from rooki import rooki
rooki.url
'http://localhost:5000/wps'
collection = 'CMIP6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803'
time = '1880-01-01/1900-12-30'
resp = rooki.subset(collection, time=time)
resp.ok
True
resp.download_urls()
['http://localhost:5000/outputs/830087b8-4154-11eb-a5e0-784f435e8862/rlds_Amon_IPSL-CM6A-LR_historical_r1i1p1f1_gr_18800116-19001216.nc']
prov_json_url = resp.provenance()
prov_json_url
'http://localhost:5000/outputs/7cbda732-4154-11eb-a5e0-784f435e8862/provenance.json'
import requests
requests.get(prov_json_url).json()
{'prefix': {'provone': 'http://purl.dataone.org/provone/2015/01/15/ontology#', 'dcterms': 'http://purl.org/dc/terms/', 'default': 'http://purl.org/roocs/prov#'}, 'agent': {'copernicus_CDS': {'prov:type': 'prov:Organization', 'dcterms:title': 'Copernicus Climate Data Store'}, 'rook': {'prov:type': 'prov:SoftwareAgent', 'dcterms:source': 'https://github.com/roocs/rook/releases/tag/v0.2.0'}, 'daops': {'prov:type': 'prov:SoftwareAgent', 'dcterms:source': 'https://github.com/roocs/daops/releases/tag/v0.3.0'}}, 'wasAttributedTo': {'_:id1': {'prov:entity': 'rook', 'prov:agent': 'copernicus_CDS'}}, 'activity': {'subset': {'time': '1880-01-01/1900-12-30', 'apply_fixes': False}}, 'entity': {'CMIP6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803': {}, 'rlds_Amon_IPSL-CM6A-LR_historical_r1i1p1f1_gr_18800116-19001216.nc': {}}, 'wasStartedBy': {'_:id2': {'prov:activity': 'subset', 'prov:trigger': 'rook', 'prov:starter': 'daops'}}, 'wasDerivedFrom': {'_:id3': {'prov:generatedEntity': 'rlds_Amon_IPSL-CM6A-LR_historical_r1i1p1f1_gr_18800116-19001216.nc', 'prov:usedEntity': 'CMIP6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803', 'prov:activity': 'subset'}}}
prov_plot_url = resp.provenance_image()
prov_plot_url
'http://localhost:5000/outputs/7cbda732-4154-11eb-a5e0-784f435e8862/provenance.png'
from IPython.display import Image
Image(prov_plot_url)
from rooki import operators as ops
wf = ops.Subset(
ops.Subset(
ops.Input(
'tas', ['CMIP6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803']
),
time="1860-01-01/1920-12-30",
),
time="1880-01-01/1900-12-30"
)
resp = wf.orchestrate()
resp
Metalink URL: http://localhost:5000/outputs/843346e8-4154-11eb-a5e0-784f435e8862/input.meta4, num files: 1
resp.download_urls()
['http://localhost:5000/outputs/8b9d8ca4-4154-11eb-a5e0-784f435e8862/rlds_Amon_IPSL-CM6A-LR_historical_r1i1p1f1_gr_18800116-19001216.nc']
from IPython.display import Image
Image(resp.provenance_image())