diff --git a/docs/requirements.txt b/docs/requirements.txt index 6d4c4b7..06389cc 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,3 +8,10 @@ furo nbsphinx setuptools pyyaml +earthkit-data @ git+https://github.com/ecmwf/earthkit-data@develop +earthkit-geo @ git+https://github.com/ecmwf/earthkit-geo@develop +earthkit-utils @ git+https://github.com/ecmwf/earthkit-utils@develop +earthkit-transforms @ git+https://github.com/ecmwf/earthkit-transforms@develop +earthkit-plots @ git+https://github.com/ecmwf/earthkit-plots@develop +earthkit-hydro @ git+https://github.com/ecmwf/earthkit-hydro@develop +earthkit-meteo @ git+https://github.com/ecmwf/earthkit-meteo@develop diff --git a/docs/tutorials/index.rst b/docs/tutorials/index.rst index 8913411..72c81e3 100644 --- a/docs/tutorials/index.rst +++ b/docs/tutorials/index.rst @@ -11,6 +11,4 @@ Here is a list of small tutorial notebooks to illustrate how to use earthkit. ensemble.ipynb polytope_polygon.ipynb - polytope_polygon_logo.ipynb polytope_timeseries.ipynb - polytope_vertical_profile.ipynb diff --git a/docs/tutorials/polytope_polygon.ipynb b/docs/tutorials/polytope_polygon.ipynb index d040a12..d04759d 100644 --- a/docs/tutorials/polytope_polygon.ipynb +++ b/docs/tutorials/polytope_polygon.ipynb @@ -5,7 +5,35 @@ "id": "66a48622-e440-4057-ac31-82d73dfa6a1f", "metadata": {}, "source": [ - "## Polytope polygon coverages" + "## Polygon coverage explorer" + ] + }, + { + "cell_type": "markdown", + "id": "5639fb87", + "metadata": {}, + "source": [ + "In this notebook you will see how to:\n", + "\n", + "- use Polytope to retrieve a country cut-out of Portugal\n", + "- create a point cloud plot of the retrieved fields\n", + "\n", + "### Components of earthkit\n", + "\n", + "This tutorial uses the following earthkit components - click any logo to open the package documentation:\n", + "\n", + "
\n", + "
\n", + " \n", + " \"earthkit-data\"\n", + " \n", + " \n", + " \"earthkit-geo\"\n", + " \n", + " \n", + " \"earthkit-plots\"\n", + " \n", + "
" ] }, { @@ -13,576 +41,22 @@ "id": "d0ea6d7b-1489-4b17-8c4c-82f98a1bf627", "metadata": {}, "source": [ - "First, we retrieve data within a polygon with polytope. Next, we convert the resulting CoverageJSON to Xarray." + "### 1. Data extraction\n", + "\n", + "We generate the country polygon for Portugal using earthkit-geo, then retrieve data within that polygon with Polytope and convert to xarray." ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "7b9c2b9a-a873-4b8e-abf1-042c8b012a2a", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2024-12-18 09:10:21 - INFO - Key read from /Users/cgr/.polytopeapirc\n", - "2024-12-18 09:10:21 - INFO - Sending request...\n", - "{'request': 'class: od\\n'\n", - " 'date: -1\\n'\n", - " 'domain: g\\n'\n", - " 'expver: 1\\n'\n", - " 'feature:\\n'\n", - " ' shape:\\n'\n", - " ' - - 41.870881288\\n'\n", - " ' - -8.879136\\n'\n", - " ' - - 41.694339317422646\\n'\n", - " ' - -8.824238614026456\\n'\n", - " ' - - 40.171924585721314\\n'\n", - " ' - -8.902386975546364\\n'\n", - " ' - - 38.75694209400925\\n'\n", - " ' - -9.493088042617785\\n'\n", - " ' - - 38.42424252381525\\n'\n", - " ' - -9.171674240710018\\n'\n", - " ' - - 38.49907333213173\\n'\n", - " ' - -8.676525850529856\\n'\n", - " ' - - 37.057269459205145\\n'\n", - " ' - -8.971873318897366\\n'\n", - " ' - - 37.162874354643776\\n'\n", - " ' - -7.406745406502978\\n'\n", - " ' - - 38.19776118392036\\n'\n", - " ' - -6.931663452624974\\n'\n", - " ' - - 38.4280922170291\\n'\n", - " ' - -7.321584397020473\\n'\n", - " ' - - 39.011852875635526\\n'\n", - " ' - -6.9787177479519755\\n'\n", - " ' - - 39.66227871551288\\n'\n", - " ' - -7.5393956904523804\\n'\n", - " ' - - 39.66568774825791\\n'\n", - " ' - -7.03915852435145\\n'\n", - " ' - - 40.0019453234905\\n'\n", - " ' - -6.883203763416162\\n'\n", - " ' - - 40.20373392742229\\n'\n", - " ' - -7.035724907677206\\n'\n", - " ' - - 40.350463990828985\\n'\n", - " ' - -6.8135246275213035\\n'\n", - " ' - - 41.030499770212515\\n'\n", - " ' - -6.905947651233703\\n'\n", - " ' - - 41.593647729084154\\n'\n", - " ' - -6.22847017956974\\n'\n", - " ' - - 41.67712153119277\\n'\n", - " ' - -6.544984134823352\\n'\n", - " ' - - 41.949682257268876\\n'\n", - " ' - -6.567927092516641\\n'\n", - " ' - - 41.96960294343674\\n'\n", - " ' - -7.1747800681640115\\n'\n", - " ' - - 41.88337981339092\\n'\n", - " ' - -7.196871678410446\\n'\n", - " ' - - 41.81334515396762\\n'\n", - " ' - -8.156666519264604\\n'\n", - " ' - - 42.14242723772878\\n'\n", - " ' - -8.205142297350534\\n'\n", - " ' - - 41.870881288\\n'\n", - " ' - -8.879136\\n'\n", - " ' type: polygon\\n'\n", - " 'levtype: sfc\\n'\n", - " \"number: '1'\\n\"\n", - " 'param: 167/169\\n'\n", - " \"step: '0'\\n\"\n", - " 'stream: enfo\\n'\n", - " \"time: '1200'\\n\"\n", - " 'type: pf\\n',\n", - " 'verb': 'retrieve'}\n", - "2024-12-18 09:10:21 - INFO - Polytope user key found in session cache for user cgr\n", - "2024-12-18 09:10:21 - INFO - Request accepted. Please poll ./49adba5d-a694-4045-89da-19b07902acd8 for status\n", - "2024-12-18 09:10:21 - INFO - Polytope user key found in session cache for user cgr\n", - "2024-12-18 09:10:21 - INFO - Checking request status (./49adba5d-a694-4045-89da-19b07902acd8)...\n", - "2024-12-18 09:10:21 - INFO - The current status of the request is 'queued'\n", - "2024-12-18 09:10:22 - INFO - The current status of the request is 'processing'\n", - "2024-12-18 09:10:24 - 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": [ - "49adba5d-a694-4045-89da-19b07902acd8.covjson: 0%| | 0.00/71.2k [00:00\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset> Size: 53kB\n",
-       "Dimensions:    (datetimes: 1, number: 1, steps: 1, points: 1093)\n",
-       "Coordinates:\n",
-       "  * datetimes  (datetimes) <U20 80B '2024-12-17T12:00:00Z'\n",
-       "  * number     (number) int64 8B 1\n",
-       "  * steps      (steps) int64 8B 0\n",
-       "  * points     (points) int64 9kB 0 1 2 3 4 5 ... 1087 1088 1089 1090 1091 1092\n",
-       "    x          (points) float64 9kB 37.08 37.08 37.08 37.15 ... 42.0 42.0 42.07\n",
-       "    y          (points) float64 9kB 351.1 351.2 351.3 ... 351.6 351.7 351.7\n",
-       "    z          (points) float64 9kB 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 9kB 290.9 ... 289.0\n",
-       "    ssrd       (datetimes, number, steps, points) float64 9kB 0.0 0.0 ... 0.0\n",
-       "Attributes:\n",
-       "    class:          od\n",
-       "    Forecast date:  2024-12-17T12:00:00Z\n",
-       "    domain:         g\n",
-       "    expver:         0001\n",
-       "    levtype:        sfc\n",
-       "    number:         1\n",
-       "    step:           0\n",
-       "    stream:         enfo\n",
-       "    type:           pf\n",
-       "    date:           2024-12-17T12:00:00Z
" - ], - "text/plain": [ - " Size: 53kB\n", - "Dimensions: (datetimes: 1, number: 1, steps: 1, points: 1093)\n", - "Coordinates:\n", - " * datetimes (datetimes) " - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "import earthkit.plots as ekp\n", "\n", "chart = ekp.Map(domain=\"Portugal\")\n", - "chart.point_cloud(da['2t'], x=\"y\", y=\"x\")\n", + "chart.point_cloud(ds['2t'])\n", "\n", "chart.coastlines()\n", "chart.borders()\n", @@ -652,9 +116,9 @@ ], "metadata": { "kernelspec": { - "display_name": "dev_ecc", + "display_name": "ek", "language": "python", - "name": "dev_ecc" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -666,7 +130,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.10.18" } }, "nbformat": 4, diff --git a/docs/tutorials/polytope_polygon_logo.ipynb b/docs/tutorials/polytope_polygon_logo.ipynb deleted file mode 100644 index 01eb1aa..0000000 --- a/docs/tutorials/polytope_polygon_logo.ipynb +++ /dev/null @@ -1,2131 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "9ca99456-817b-4669-aead-8c7d7435b0dc", - "metadata": {}, - "source": [ - "## Polytope polygons forming a word" - ] - }, - { - "cell_type": "markdown", - "id": "36b3cbce-657d-415d-a669-7f1eaeefa7d2", - "metadata": {}, - "source": [ - "This example retrieves polygon coverages forming the word \"POLYTOPE\" from polytope and plots it onto a map." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "bfc4e565-98cb-4e96-8deb-95e98bc6465e", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2024-12-18 09:10:11 - INFO - Key read from /Users/cgr/.polytopeapirc\n", - "2024-12-18 09:10:11 - INFO - Sending request...\n", - "{'request': 'class: od\\n'\n", - " 'date: -1\\n'\n", - " 'domain: g\\n'\n", - " 'expver: 1\\n'\n", - " 'feature:\\n'\n", - " ' shape:\\n'\n", - " ' - - - 7.258763811234218\\n'\n", - " ' - 48.793723130601535\\n'\n", - " ' - - 7.168488316250347\\n'\n", - " ' - 49.83398497089428\\n'\n", - " ' - - 8.21596726115746\\n'\n", - " ' - 49.850900108140536\\n'\n", - " ' - - 8.22477419294512\\n'\n", - " ' - 49.63238869079714\\n'\n", - " ' - - 7.425045773152021\\n'\n", - " ' - 49.6375037902404\\n'\n", - " ' - - 7.488604743081794\\n'\n", - " ' - 48.76751542040529\\n'\n", - " ' - - 7.262985428883866\\n'\n", - " ' - 48.762974824632806\\n'\n", - " ' type: polygon\\n'\n", - " 'levtype: sfc\\n'\n", - " \"number: '1'\\n\"\n", - " \"param: '167'\\n\"\n", - " \"step: '0'\\n\"\n", - " 'stream: enfo\\n'\n", - " \"time: '1200'\\n\"\n", - " 'type: pf\\n',\n", - " 'verb': 'retrieve'}\n", - "2024-12-18 09:10:11 - INFO - Polytope user key found in session cache for user cgr\n", - "2024-12-18 09:10:12 - INFO - Request accepted. Please poll ./cdcfe067-f976-47d3-8015-437dffe0d2f8 for status\n", - "2024-12-18 09:10:12 - INFO - Polytope user key found in session cache for user cgr\n", - "2024-12-18 09:10:12 - INFO - Checking request status (./cdcfe067-f976-47d3-8015-437dffe0d2f8)...\n", - "2024-12-18 09:10:12 - INFO - The current status of the request is 'queued'\n", - "2024-12-18 09:10:13 - INFO - The current status of the request is 'processing'\n", - "2024-12-18 09:10:15 - 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": [ - "cdcfe067-f976-47d3-8015-437dffe0d2f8.covjson: 0%| | 0.00/5.91k [00:00" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "import earthkit.data as ekd\n", - "import earthkit.plots as ekp\n", - "\n", - "# define the polygons\n", - "shape1 = [\n", - " [7.258763811234218, 48.793723130601535],\n", - " [7.168488316250347, 49.83398497089428],\n", - " [8.21596726115746, 49.850900108140536],\n", - " [8.22477419294512, 49.63238869079714],\n", - " [7.425045773152021, 49.6375037902404],\n", - " [7.488604743081794, 48.76751542040529],\n", - " [7.262985428883866, 48.762974824632806],\n", - "],\n", - "\n", - "shape2 = [\n", - " [8.228175484385758, 49.62363905618946],\n", - " [8.2383404847414, 49.30577331470633],\n", - " [7.468517996271913, 49.29035950951544],\n", - " [7.442698254298165, 49.394063349552624],\n", - " [8.0965165757963, 49.41322522398369],\n", - " [8.09028856771124, 49.63518066374158],\n", - "]\n", - "\n", - "shape3 = [\n", - " [8.778584932744309, 49.86954658650521],\n", - " [8.862295524771469, 48.766918864990714],\n", - " [10.061878585703141, 48.80521538773752],\n", - " [10.05189374814043, 49.02912712169905],\n", - " [9.126374708842917, 49.035317308040874],\n", - " [9.054787898083248, 49.85647839775169],\n", - " [8.79447274483195, 49.8646339236731],\n", - "]\n", - "\n", - "shape4 = [\n", - " [9.088892121315212, 49.68396293291025],\n", - " [9.819571610135483, 49.684014501470756],\n", - " [9.85505960658449, 49.03116952568445],\n", - " [10.060153571012052, 49.027505122195635],\n", - " [10.072160282281033, 49.86449197101945],\n", - " [9.05948442169526, 49.85694532601448],\n", - " [9.071912795654185, 49.68014004987609],\n", - "]\n", - "\n", - "shape5 = [\n", - " [10.598471035757996, 49.82012849229719],\n", - " [10.623393389597027, 48.824858944891844],\n", - " [12.04024144738159, 48.83198005307881],\n", - " [12.006769966371252, 49.16097358155085],\n", - " [10.989756517888907, 49.16815641449875],\n", - " [10.948052430339942, 49.88592726422476],\n", - " [10.596882802957197, 49.86398061258498],\n", - "]\n", - "\n", - "shape6 = [\n", - " [13.29197987307927, 49.97728585641272],\n", - " [12.57111275146977, 49.97104094778115],\n", - " [13.222322323273431, 49.37725327518439],\n", - " [13.202971158951414, 48.903129615084254],\n", - " [13.827804957331438, 48.88340416595227],\n", - " [13.874384556433938, 49.40358865952578],\n", - " [14.605299546055448, 49.93197478940584],\n", - " [14.102062445091747, 49.98001098000407],\n", - " [13.624487089218775, 49.55461007587729],\n", - " [13.3099890365134, 49.97739580806973],\n", - "]\n", - "\n", - "shape7 = [\n", - " [15.228965549991614, 49.730373613580525],\n", - " [15.230125323821682, 50.090633313563075],\n", - " [17.660387372585035, 50.06822116337625],\n", - " [17.577939895914568, 49.59398017760927],\n", - " [16.752386182433355, 49.64920447268295],\n", - " [16.58109059401943, 48.772986118860814],\n", - " [16.094304206428518, 48.79160176954642],\n", - " [16.185638387834643, 49.640410835320694],\n", - " [15.250602552532541, 49.68736034043533],\n", - "]\n", - "\n", - "shape8 = [\n", - " [18.006103810711153, 49.874817453680265],\n", - " [17.872892800864577, 48.7751276419595],\n", - " [19.231045390320162, 48.68751356669205],\n", - " [19.286273043798417, 48.9720484447422],\n", - " [18.331513679782546, 49.02466456647059],\n", - " [18.4410677556115, 49.91883884509102],\n", - " [17.990407455442124, 49.9284320053506],\n", - "]\n", - "\n", - "shape9 = [\n", - " [18.523099688262818, 49.91693240270905],\n", - " [19.571993355132093, 49.88820196224816],\n", - " [19.269541055964595, 48.99870007380369],\n", - " [18.989650825560034, 49.00717933216285],\n", - " [19.1721361339051, 49.67352579852684],\n", - " [18.42049036941708, 49.71965669030075],\n", - " [18.436899591803154, 49.93131406908293],\n", - "]\n", - "\n", - "shape10 = [\n", - " [20.369665233263703, 48.68540724766882],\n", - " [20.390795716706066, 49.82142033684306],\n", - " [21.66474097162009, 49.77219361759094],\n", - " [21.599781134603887, 49.45580574399338],\n", - " [20.770239556798373, 49.481617120321545],\n", - " [20.773898383565665, 48.68594678666463],\n", - " [20.369665233263703, 48.68540724766882],\n", - "]\n", - "\n", - "shape11 = [\n", - " [20.779400086097894, 49.266396683614516],\n", - " [21.291684316951347, 49.25582141560005],\n", - " [21.29255644055283, 49.462413633894414],\n", - " [21.60241816111113, 49.44412952745972],\n", - " [21.577574878322366, 49.16620350494162],\n", - " [20.792010318248543, 49.16233120403493],\n", - " [20.768637193550887, 49.273598233154075],\n", - "]\n", - "\n", - "shape12 = [\n", - " [23.208137901360374, 49.651584260796994],\n", - " [22.09658437133257, 49.752545184049126],\n", - " [21.91802865423628, 48.67264127283525],\n", - " [23.391185304246818, 48.62884428299256],\n", - " [23.420678366377672, 48.95370738548149],\n", - " [22.47620509293023, 48.948108124274114],\n", - " [22.504379835652145, 49.154931298807696],\n", - " [23.380718740911448, 49.134280180441834],\n", - " [23.347965550435475, 49.36007407350195],\n", - " [22.508043914644247, 49.34861103718032],\n", - " [22.552065252592882, 49.49663569230876],\n", - " [23.44022825068265, 49.49121931651345],\n", - " [23.257411122842967, 49.664632737235905],\n", - "]\n", - "\n", - "\n", - "request_pattern = {\n", - " \"class\": \"od\",\n", - " \"stream\" : \"enfo\",\n", - " \"type\" : \"pf\",\n", - " \"date\" : -1,\n", - " \"time\" : \"1200\",\n", - " \"levtype\" : \"sfc\",\n", - " \"expver\" : 1,\n", - " \"domain\" : \"g\",\n", - " \"param\" : \"167\",\n", - " \"number\" : \"1\",\n", - " \"step\": \"0\",\n", - "}\n", - "\n", - "chart = ekp.Map(domain=\"Europe\")\n", - "\n", - "for shape in [shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8, shape9, shape10, shape11, shape12]:\n", - "\n", - " # retrive the given coverage from polytope and convert into Xarray\n", - " request = dict(**request_pattern)\n", - " request[\"feature\"] = {\"type\": \"polygon\", \"shape\": shape}\n", - "\n", - " ds = ekd.from_source(\"polytope\", \"ecmwf-mars\", request, stream=False, \n", - " address='polytope.ecmwf.int').to_xarray()\n", - "\n", - " # add the Xarray dataset to the plot\n", - " chart.point_cloud(ds['2t'], x=\"x\", y=\"y\",s=0.1)\n", - "\n", - "# generate the plot\n", - "chart.coastlines()\n", - "chart.borders()\n", - "chart.gridlines()\n", - " \n", - "chart.title(\"{variable_name} (number={number})\")\n", - " \n", - "chart.show()" - ] - } - ], - "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": 5 -} diff --git a/docs/tutorials/polytope_timeseries.ipynb b/docs/tutorials/polytope_timeseries.ipynb index f9d9ddc..b4f9343 100644 --- a/docs/tutorials/polytope_timeseries.ipynb +++ b/docs/tutorials/polytope_timeseries.ipynb @@ -11,63 +11,46 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "First, we retrieve ENS time series data using polytope." + "In this notebook you will see how to:\n", + "\n", + "- use Polytope to retrieve a timeseries at a specific location of interest\n", + "- aggregate the data over the ensemble and create a simple timeseries plot\n", + "- create a meteogram\n", + "\n", + "### Components of earthkit\n", + "\n", + "This tutorial uses the following earthkit components - click any logo to open the package documentation:\n", + "\n", + "
\n", + "
\n", + " \n", + " \"earthkit-data\"\n", + " \n", + " \n", + " \"earthkit-transforms\"\n", + " \n", + " \n", + " \"earthkit-plots\"\n", + " \n", + "
" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1. Data retrieval\n", + "\n", + "First, retrieve ENS time series data using Polytope." ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "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!" + "xr_ds = ds.to_xarray()\n", + "\n", + "ekp.timeseries.multiboxplot(xr_ds, resample=TIME_FREQUENCY, quantiles=QUANTILES).line(\n", + " xr_ds.mean(dim=\"number\")\n", + ")" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { "kernelspec": { - "display_name": "dev_ecc", + "display_name": "ek", "language": "python", - "name": "dev_ecc" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -745,7 +148,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.10.18" } }, "nbformat": 4, diff --git a/docs/tutorials/polytope_vertical_profile.ipynb b/docs/tutorials/polytope_vertical_profile.ipynb index fb0161f..00dbd0e 100644 --- a/docs/tutorials/polytope_vertical_profile.ipynb +++ b/docs/tutorials/polytope_vertical_profile.ipynb @@ -4,7 +4,27 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Polytope vertical profile" + "## Vertical profile explorer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this notebook you will see how to:\n", + "\n", + "- extract a vertical profile using Polytope\n", + "\n", + "### Components of earthkit\n", + "\n", + "This tutorial uses the following earthkit components - click any logo to open the package documentation:\n", + "\n", + "
\n", + "
\n", + " \n", + " \"earthkit-data\"\n", + " \n", + "
" ] }, { @@ -16,498 +36,9 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2024-12-18 09:10:29 - INFO - Key read from /Users/cgr/.polytopeapirc\n", - "2024-12-18 09:10:29 - INFO - Sending request...\n", - "{'request': 'class: od\\n'\n", - " 'date: -1\\n'\n", - " 'domain: g\\n'\n", - " 'expver: 1\\n'\n", - " 'feature:\\n'\n", - " ' points:\\n'\n", - " ' - - 38.9\\n'\n", - " ' - -9.1\\n'\n", - " ' type: verticalprofile\\n'\n", - " 'levelist: 1/to/1000\\n'\n", - " 'levtype: pl\\n'\n", - " \"number: '1'\\n\"\n", - " 'param: 203/133\\n'\n", - " \"step: '0'\\n\"\n", - " 'stream: enfo\\n'\n", - " \"time: '0000'\\n\"\n", - " 'type: pf\\n',\n", - " 'verb': 'retrieve'}\n", - "2024-12-18 09:10:29 - INFO - Polytope user key found in session cache for user cgr\n", - "2024-12-18 09:10:30 - INFO - Request accepted. Please poll ./76f67d4d-f386-43ff-b11c-39e6ea9c404f for status\n", - "2024-12-18 09:10:30 - INFO - Polytope user key found in session cache for user cgr\n", - "2024-12-18 09:10:30 - INFO - Checking request status (./76f67d4d-f386-43ff-b11c-39e6ea9c404f)...\n", - "2024-12-18 09:10:30 - INFO - The current status of the request is 'queued'\n", - "2024-12-18 09:10:30 - INFO - The current status of the request is 'processing'\n", - "2024-12-18 09:10:33 - 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": [ - "76f67d4d-f386-43ff-b11c-39e6ea9c404f.covjson: 0%| | 0.00/3.38k [00:00\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset> Size: 640B\n",
-       "Dimensions:   (x: 1, y: 1, number: 1, datetime: 1, t: 1, z: 22)\n",
-       "Coordinates:\n",
-       "  * x         (x) float64 8B 38.91\n",
-       "  * y         (y) float64 8B 350.9\n",
-       "  * number    (number) int64 8B 1\n",
-       "  * datetime  (datetime) <U20 80B '2024-12-17T00:00:00Z'\n",
-       "  * t         (t) int64 8B 0\n",
-       "  * z         (z) int64 176B 1 2 3 5 7 10 20 30 ... 400 500 600 700 850 925 1000\n",
-       "Data variables:\n",
-       "    q         (x, y, number, datetime, t, z) float64 176B 4.254e-06 ... 0.005184\n",
-       "    o3        (x, y, number, datetime, t, z) float64 176B 4.228e-06 ... 6.039...\n",
-       "Attributes:\n",
-       "    class:          od\n",
-       "    Forecast date:  2024-12-17T00:00:00Z\n",
-       "    domain:         g\n",
-       "    expver:         0001\n",
-       "    levelist:       1\n",
-       "    levtype:        pl\n",
-       "    number:         1\n",
-       "    stream:         enfo\n",
-       "    type:           pf
" - ], - "text/plain": [ - " Size: 640B\n", - "Dimensions: (x: 1, y: 1, number: 1, datetime: 1, t: 1, z: 22)\n", - "Coordinates:\n", - " * x (x) float64 8B 38.91\n", - " * y (y) float64 8B 350.9\n", - " * number (number) int64 8B 1\n", - " * datetime (datetime)