{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Run workfow with diff operator\n", "\n", "**Rooki** calls climate data operations on the **rook** processing service." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## \"diff\" workflow with subset\n", "\n", "**WARNING**: used cmip5 demo data instead of c3s-cmip5." ] }, { "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.Diff(\n", " ops.Subset(\n", " ops.Input(\n", " 'inm', ['cmip5.output1.INM.inmcm4.rcp45.mon.ocean.Omon.r1i1p1.latest.zostoga']\n", " ),\n", " time=\"2085-01-01/2120-12-30\",\n", " ),\n", " ops.Subset(\n", " ops.Input(\n", " 'mpi', ['cmip5.output1.MPI-M.MPI-ESM-LR.rcp45.mon.ocean.Omon.r1i1p1.latest.zostoga']\n", " ),\n", " time=\"2085-01-01/2120-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": [ "**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" ] } ], "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 }