{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Polytope time series" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, we retrieve ENS time series data using polytope." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2024-12-18 09:11:07 - INFO - Key read from /Users/cgr/.polytopeapirc\n", "2024-12-18 09:11:07 - INFO - Sending request...\n", "{'request': 'class: od\\n'\n", " 'date: -1\\n'\n", " 'domain: g\\n'\n", " 'expver: 1\\n'\n", " 'feature:\\n'\n", " ' axes: step\\n'\n", " ' points:\\n'\n", " ' - - 38.78655345978706\\n'\n", " ' - -9.109280931080349\\n'\n", " ' type: timeseries\\n'\n", " 'levtype: sfc\\n'\n", " 'number: 1/to/50\\n'\n", " 'param: 164/167/169\\n'\n", " 'step: 0/to/360\\n'\n", " 'stream: enfo\\n'\n", " \"time: '0000'\\n\"\n", " 'type: pf\\n',\n", " 'verb': 'retrieve'}\n", "2024-12-18 09:11:07 - INFO - Polytope user key found in session cache for user cgr\n", "2024-12-18 09:11:07 - INFO - Request accepted. Please poll ./96d99675-364f-45cb-b3f4-e834db746625 for status\n", "2024-12-18 09:11:07 - INFO - Polytope user key found in session cache for user cgr\n", "2024-12-18 09:11:07 - INFO - Checking request status (./96d99675-364f-45cb-b3f4-e834db746625)...\n", "2024-12-18 09:11:07 - INFO - The current status of the request is 'processing'\n", "2024-12-18 09:11:19 - INFO - The current status of the request is 'processed'\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "text/plain": [ "96d99675-364f-45cb-b3f4-e834db746625.covjson: 0%| | 0.00/520k [00:00\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.Dataset> Size: 176kB\n",
       "Dimensions:   (x: 1, y: 1, z: 1, number: 50, datetime: 1, t: 145)\n",
       "Coordinates:\n",
       "  * x         (x) float64 8B 38.77\n",
       "  * y         (y) float64 8B 350.9\n",
       "  * z         (z) int64 8B 0\n",
       "  * number    (number) int64 400B 1 2 3 4 5 6 7 8 9 ... 43 44 45 46 47 48 49 50\n",
       "  * datetime  (datetime) <U20 80B '2024-12-17T00:00:00Z'\n",
       "  * t         (t) datetime64[ns] 1kB 2024-12-17 ... 2025-01-01\n",
       "Data variables:\n",
       "    tcc       (x, y, z, number, datetime, t) float64 58kB 1.0 0.9854 ... 0.999\n",
       "    2t        (x, y, z, number, datetime, t) float64 58kB 286.7 285.8 ... 286.3\n",
       "    ssrd      (x, y, z, number, datetime, t) float64 58kB 0.0 0.0 ... 1.304e+08\n",
       "Attributes:\n",
       "    class:          od\n",
       "    Forecast date:  2024-12-17T00:00:00Z\n",
       "    domain:         g\n",
       "    expver:         0001\n",
       "    levtype:        sfc\n",
       "    number:         1\n",
       "    stream:         enfo\n",
       "    type:           pf
" ], "text/plain": [ " Size: 176kB\n", "Dimensions: (x: 1, y: 1, z: 1, number: 50, datetime: 1, t: 145)\n", "Coordinates:\n", " * x (x) float64 8B 38.77\n", " * y (y) float64 8B 350.9\n", " * z (z) int64 8B 0\n", " * number (number) int64 400B 1 2 3 4 5 6 7 8 9 ... 43 44 45 46 47 48 49 50\n", " * datetime (datetime) = 0 else \"S\"\n", " lon_dir = \"E\" if lon >= 0 else \"W\"\n", " return f\"{abs(lat):.2f}°{lat_dir}, {abs(lon):.2f}°{lon_dir}\"\n", "\n", "TIME_FREQUENCY = \"6h\"\n", "QUANTILES = [0, 0.1, 0.25, 0.5, 0.75, 0.9, 1]\n", "\n", "chart = Chart()\n", "chart.title(f\"ECMWF ensemble meteogram at {location_to_string(location)}\")\n", "chart.box(ds, time_frequency=TIME_FREQUENCY, quantiles=QUANTILES)\n", "chart.line(ds,aggregation='mean', line_color='grey', time_frequency=TIME_FREQUENCY)\n", "chart.show(renderer=\"png\") # Replace with chart.show() in an interactive session!" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "dev_ecc", "language": "python", "name": "dev_ecc" }, "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.10.13" } }, "nbformat": 4, "nbformat_minor": 4 }