{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Run workfow with subset chain\n", "\n", "**Rooki** calls climate data operations on the **rook** processing service." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## workflow with subset chain" ] }, { "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 operators as ops" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "wf = ops.Subset(\n", " ops.Subset(\n", " ops.Input(\n", " 'tas', ['c3s-cmip6.ScenarioMIP.INM.INM-CM5-0.ssp245.r1i1p1f1.day.tas.gr1.v20190619']\n", " ),\n", " time=\"2016-01-01/2020-12-30\",\n", " ),\n", " time=\"2017-01-01/2017-12-30\",\n", ")\n", " " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "resp = wf.orchestrate()\n", "resp" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**metalink output**" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(resp.xml)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Size in MBytes**" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "resp.size_in_mb" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**URLs in metalink document ...**" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "resp.download_urls()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**... and open with xarray**" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds = resp.datasets()[0]\n", "ds" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**provenance**" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from IPython.display import Image\n", "Image(resp.provenance_image())\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.2" } }, "nbformat": 4, "nbformat_minor": 4 }