Skip to content

Commit

Permalink
Merge branch 'master' into pingudev
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Nov 3, 2021
2 parents 21a2e05 + 036465b commit 120cf2a
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 5 deletions.
2 changes: 1 addition & 1 deletion notebooks/c4i/c4i-access-cmip5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"metadata": {},
"outputs": [],
"source": [
"ctx = conn.new_context(project='CMIP5', data_node='esgf1.dkrz.de', latest=True, replica=False)\n",
"ctx = conn.new_context(project='CMIP5', data_node='esgf1.dkrz.de,esgf3.dkrz.de', latest=True, replica=False)\n",
"ctx.hit_count"
]
},
Expand Down
4 changes: 2 additions & 2 deletions notebooks/c4i/c4i-access-cmip6.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"metadata": {},
"outputs": [],
"source": [
"ctx = conn.new_context(project='CMIP6', data_node='esgf3.dkrz.de', latest=True, replica=False)\n",
"ctx = conn.new_context(project='CMIP6', data_node='esgf1.dkrz.de,esgf3.dkrz.de', latest=True, replica=False)\n",
"ctx.hit_count"
]
},
Expand Down Expand Up @@ -382,7 +382,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
248 changes: 248 additions & 0 deletions notebooks/demo/demo-rooki-subset-by-point.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Run subset by (time) point operation\n",
"\n",
"**Rooki** calls climate data operations on the **rook** processing service."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"os.environ['ROOK_URL'] = 'http://rook.dkrz.de/wps'\n",
"\n",
"from rooki import rooki"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**parameters of subset operation**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rooki.subset?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## subset by time interval"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"resp = rooki.subset(\n",
" collection='c3s-cmip6.ScenarioMIP.INM.INM-CM5-0.ssp245.r1i1p1f1.day.tas.gr1.v20190619',\n",
" time='2016-01-01/2016-12-30',\n",
")\n",
"resp.ok"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds = resp.datasets()[0]\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Image\n",
"Image(resp.provenance_image())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## subset by time series\n",
"\n",
"Use *exact* time points"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"resp = rooki.subset(\n",
" collection='c3s-cmip6.ScenarioMIP.INM.INM-CM5-0.ssp245.r1i1p1f1.day.tas.gr1.v20190619',\n",
" time='2016-01-01T12:00:00, 2016-02-01T12:00:00, 2016-03-01T12:00:00',\n",
")\n",
"resp.ok"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds = resp.datasets()[0]\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Image\n",
"Image(resp.provenance_image())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## subset by time components\n",
"\n",
"TODO: use `time` parameter for pre-selection"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"resp = rooki.subset(\n",
" collection='c3s-cmip6.ScenarioMIP.INM.INM-CM5-0.ssp245.r1i1p1f1.day.tas.gr1.v20190619',\n",
" time='2016/2020',\n",
" time_components='year:2016,2017|month:jan,feb,mar|day:01',\n",
")\n",
"resp.ok"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds = resp.datasets()[0]\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Image\n",
"Image(resp.provenance_image())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## use workflow"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from rooki import operators as ops"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"wf = ops.Subset(\n",
" ops.Input(\n",
" 'tas', ['c3s-cmip6.ScenarioMIP.INM.INM-CM5-0.ssp245.r1i1p1f1.day.tas.gr1.v20190619']\n",
" ),\n",
" time=\"2016/2020\",\n",
" time_components=\"month:jan,feb,mar|day:01\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"resp = wf.orchestrate()\n",
"resp.ok"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds = resp.datasets()[0]\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Image\n",
"Image(resp.provenance_image())"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
4 changes: 2 additions & 2 deletions notebooks/demo/demo-rooki-workflow-subset-chain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -155,7 +155,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.2"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
1 change: 1 addition & 0 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@


@pytest.mark.online
@pytest.mark.xfail(reason="online wps not always available")
def test_workflow_subset_chain():
wf = ops.Subset(
ops.Subset(
Expand Down

0 comments on commit 120cf2a

Please sign in to comment.