{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Run average by dim 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 average operation**" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "rooki.average?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## average by dim" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "resp = rooki.average(\n", " collection='c3s-cmip6.ScenarioMIP.INM.INM-CM5-0.ssp245.r1i1p1f1.day.tas.gr1.v20190619',\n", " dims=['latitude', 'longitude'],\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": [ "## workflow: subset + average \n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from rooki import operators as ops" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tas = ops.Input(\n", " 'tas', ['c3s-cmip6.ScenarioMIP.INM.INM-CM5-0.ssp245.r1i1p1f1.day.tas.gr1.v20190619']\n", ")\n", "\n", "sub = ops.Subset(tas, time=\"2016/2016\")\n", "\n", "#wf = ops.Average(sub, dims=[\"latitude\", \"longitude\"])\n", "wf = ops.Average(sub, dims=\"time\")" ] }, { "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.11.0" } }, "nbformat": 4, "nbformat_minor": 4 }