diff --git a/docs/examples/03_polytope_timeseries.ipynb b/docs/examples/03_polytope_timeseries.ipynb new file mode 100644 index 0000000..c8c1eed --- /dev/null +++ b/docs/examples/03_polytope_timeseries.ipynb @@ -0,0 +1,7377 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2024-09-19 15:19:23 - INFO - Key read from /home/maaw/.polytopeapirc\n", + "2024-09-19 15:19:23 - INFO - Sending request...\n", + "{'request': 'class: od\\n'\n", + " \"date: '20240917'\\n\"\n", + " 'domain: g\\n'\n", + " 'expver: 0079\\n'\n", + " 'feature:\\n'\n", + " ' axis: step\\n'\n", + " ' points:\\n'\n", + " ' - - -9.109280931080349\\n'\n", + " ' - 38.78655345978706\\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-09-19 15:19:23 - INFO - Polytope user key found in session cache for user maaw\n", + "2024-09-19 15:19:24 - INFO - Request accepted. Please poll ../requests/93457f02-9fd0-46f7-8a42-0f80bfd80af9 for status\n", + "2024-09-19 15:19:24 - INFO - Polytope user key found in session cache for user maaw\n", + "2024-09-19 15:19:24 - INFO - Checking request status (../requests/93457f02-9fd0-46f7-8a42-0f80bfd80af9)...\n", + "2024-09-19 15:19:24 - INFO - The current status of the request is 'queued'\n", + "2024-09-19 15:19:25 - INFO - The current status of the request is 'processing'\n", + "2024-09-19 15:20:16 - INFO - The current status of the request is 'processed'\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "4016a9b2bc9643a0983e31eeeda091a7", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "93457f02-9fd0-46f7-8a42-0f80bfd80af9.grib: 0%| | 0.00/547k [00:00, ?B/s]" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import earthkit.data\n", + "\n", + "request = {\n", + " \"class\": \"od\",\n", + " \"stream\" : \"enfo\",\n", + " \"type\" : \"pf\",\n", + " \"date\" : \"20240917\",\n", + " \"time\" : \"0000\",\n", + " \"levtype\" : \"sfc\",\n", + " \"expver\" : \"0079\", \n", + " \"domain\" : \"g\",\n", + " \"param\" : \"164/167/169\",\n", + " \"number\" : \"1/to/50\",\n", + " \"step\": \"0/to/360\",\n", + " \"feature\" : {\n", + " \"type\" : \"timeseries\",\n", + " \"points\": [[-9.109280931080349, 38.78655345978706]],\n", + " \"axis\": \"step\",\n", + " },\n", + "}\n", + "\n", + "ds = earthkit.data.from_source(\"polytope\", \"ecmwf-mars\", request, stream=False, address='polytope.ecmwf.int')" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
<xarray.Dataset>\n", + "Dimensions: (x: 1, y: 1, z: 1, number: 50, datetime: 1, t: 145)\n", + "Coordinates:\n", + " * x (x) float64 -9.104\n", + " * y (y) float64 38.81\n", + " * z (z) int64 0\n", + " * number (number) int64 1 2 3 4 5 6 7 8 9 10 ... 42 43 44 45 46 47 48 49 50\n", + " * datetime (datetime) <U20 '2024-09-17T00:00:00Z'\n", + " * t (t) datetime64[ns] 2024-09-17 2024-09-17T01:00:00 ... 2024-10-02\n", + "Data variables:\n", + " tcc (x, y, z, number, datetime, t) float64 0.1876 0.2019 ... 0.9239\n", + " 2t (x, y, z, number, datetime, t) float64 293.0 292.4 ... 296.1 294.5\n", + " ssrd (x, y, z, number, datetime, t) float64 0.0 0.0 ... 3.189e+08\n", + "Attributes:\n", + " class: od\n", + " Forecast date: 2024-09-17T00:00:00Z\n", + " domain: g\n", + " expver: 0079\n", + " levtype: sfc\n", + " number: 1\n", + " stream: enfo\n", + " type: pf
<xarray.Dataset>\n", + "Dimensions: (x: 1, y: 1, t: 1, number: 1, z: 22)\n", + "Coordinates:\n", + " * x (x) float64 38.91\n", + " * y (y) float64 350.9\n", + " * t (t) <U20 '2024-09-18T00:00:00Z'\n", + " * number (number) int64 1\n", + " * z (z) int64 1 2 3 5 7 10 20 30 ... 300 400 500 600 700 850 925 1000\n", + "Data variables:\n", + " q (x, y, t, number, z) float64 4.112e-06 4.091e-06 ... 0.006511\n", + " o3 (x, y, t, number, z) float64 4.657e-06 8.39e-06 ... 7.385e-08\n", + "Attributes:\n", + " class: od\n", + " domain: g\n", + " expver: 0079\n", + " levtype: pl\n", + " number: 1\n", + " stream: enfo\n", + " type: pf
<xarray.Dataset>\n", + "Dimensions: (datetimes: 1, number: 1, steps: 1, points: 1093)\n", + "Coordinates:\n", + " * datetimes (datetimes) <U20 '2024-09-17T12:00:00Z'\n", + " * number (number) int64 1\n", + " * steps (steps) int64 0\n", + " * points (points) int64 0 1 2 3 4 5 6 ... 1087 1088 1089 1090 1091 1092\n", + " x (points) float64 37.08 37.08 37.08 37.15 ... 42.0 42.0 42.0 42.07\n", + " y (points) float64 351.1 351.2 351.3 351.1 ... 351.6 351.7 351.7\n", + " z (points) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", + "Data variables:\n", + " 2t (datetimes, number, steps, points) float64 298.7 298.0 ... 297.4\n", + " ssrd (datetimes, number, steps, points) float64 0.0 0.0 ... 0.0 0.0\n", + "Attributes:\n", + " class: od\n", + " Forecast date: 2024-09-17T12:00:00Z\n", + " domain: g\n", + " expver: 0079\n", + " levtype: sfc\n", + " number: 1\n", + " step: 0\n", + " stream: enfo\n", + " type: pf\n", + " date: 2024-09-17T12:00:00Z" + ], + "text/plain": [ + "