{ "cells": [ { "cell_type": "markdown", "id": "minor-throat", "metadata": {}, "source": [ "# Demo with OAuth access token\n", "\n", "ESGF Node at DKRZ: https://esgf-data.dkrz.de/search/cmip6-dkrz/\n", "\n" ] }, { "cell_type": "markdown", "id": "c0667308-7989-40e4-9056-f4d8c8d3b82d", "metadata": {}, "source": [ "## ESGF CMIP6 data at DKRZ" ] }, { "cell_type": "code", "execution_count": null, "id": "south-dayton", "metadata": {}, "outputs": [], "source": [ "download_url = 'http://esgf3.dkrz.de/thredds/fileServer/cmip6/CMIP/MPI-M/MPI-ESM1-2-HR/historical/r1i1p1f1/3hr/pr/gn/v20190710/pr_3hr_MPI-ESM1-2-HR_historical_r1i1p1f1_gn_185001010130-185412312230.nc'" ] }, { "cell_type": "markdown", "id": "palestinian-prison", "metadata": {}, "source": [ "Map to file path at DKRZ" ] }, { "cell_type": "code", "execution_count": null, "id": "amateur-investor", "metadata": {}, "outputs": [], "source": [ "file_url = download_url.replace(\n", " \"http://esgf3.dkrz.de/thredds/fileServer/cmip6/\",\n", " \"/mnt/lustre02/work/ik1017/CMIP6/data/CMIP6/\"\n", ")\n", "file_url" ] }, { "cell_type": "markdown", "id": "063ff8c1-5a41-4280-a257-f7dc58794fd6", "metadata": {}, "source": [ "## Use OAuth Access Token\n", "\n", "Get an access token from here:\n", "https://demo-phoenix.cloud.dkrz.de/" ] }, { "cell_type": "code", "execution_count": null, "id": "27f17265-7e81-4084-808e-7332b4a554bc", "metadata": {}, "outputs": [], "source": [ "access_token = \"\"" ] }, { "cell_type": "markdown", "id": "continuous-turner", "metadata": {}, "source": [ "## Use Rook to run subset" ] }, { "cell_type": "code", "execution_count": null, "id": "4a3f1049-8707-47bc-80fc-3d74c7ad6a58", "metadata": {}, "outputs": [], "source": [ "import os\n", "from rooki import operators as ops" ] }, { "cell_type": "code", "execution_count": null, "id": "d0e543ef-3e50-42d3-ae45-9bf67725e329", "metadata": {}, "outputs": [], "source": [ "# os.environ['ROOK_URL'] = 'http://rook.dkrz.de/wps'\n", "# os.environ['ROOK_URL'] = 'http://demo-twitcher.cloud.dkrz.de/ows/proxy/rook'\n", "os.environ['ROOK_URL'] = \"http://demo-auth.cloud.dkrz.de/rook\"\n", "os.environ['ROOK_MODE'] = 'async'\n", "os.environ['ACCESS_TOKEN'] = access_token\n" ] }, { "cell_type": "code", "execution_count": null, "id": "3289378b-ec63-4d88-a5cf-70ef3a593165", "metadata": {}, "outputs": [], "source": [ "wf = ops.Subset(\n", " ops.Input(\n", " 'tas', [file_url]\n", " ),\n", " time=\"1850-01-01/1850-01-31\",\n", ")\n", "resp = wf.orchestrate()\n", "resp.ok" ] }, { "cell_type": "code", "execution_count": null, "id": "725754a3-9527-455d-bae7-ebddc47698cd", "metadata": {}, "outputs": [], "source": [ "ops.rooki.url" ] }, { "cell_type": "code", "execution_count": null, "id": "legendary-pacific", "metadata": {}, "outputs": [], "source": [ "resp.download_urls()" ] }, { "cell_type": "code", "execution_count": null, "id": "specific-visibility", "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.6" } }, "nbformat": 4, "nbformat_minor": 5 }