{ "cells": [ { "cell_type": "markdown", "id": "55f1f7bf-9589-4a43-b246-7c4c7880fa2d", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "## Xarray engine: seasonal forecast" ] }, { "cell_type": "code", "execution_count": 1, "id": "7e0be52c-bedb-4ae7-984c-4807bf253d7f", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "653a95e071ca4633aadbe42f597676a9", "version_major": 2, "version_minor": 0 }, "text/plain": [ "seasonal_monthly.grib: 0%| | 0.00/160k [00:00, ?B/s]" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import earthkit.data as ekd\n", "\n", "ds_fl = ekd.from_source(\"sample\", \"seasonal_monthly.grib\")" ] }, { "cell_type": "markdown", "id": "918dec31-6135-458d-a243-7ccd3f5ca3ff", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "The input data contains seasonal monthly forecast. Because the length of a month varies, for this data the ``forecastMonth`` key is better suited for describing the temporal structure than using the ``step*`` keys. \n", "\n", "This is how the first few GRIB messages look like:" ] }, { "cell_type": "code", "execution_count": 2, "id": "78ebb588-85a8-4a67-8f6b-046a536a508a", "metadata": { "editable": true, "scrolled": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
| \n", " | centre | \n", "shortName | \n", "typeOfLevel | \n", "level | \n", "dataDate | \n", "dataTime | \n", "stepRange | \n", "dataType | \n", "number | \n", "gridType | \n", "forecastMonth | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "lfpw | \n", "2t | \n", "surface | \n", "0 | \n", "19931001 | \n", "0 | \n", "744 | \n", "fcmean | \n", "0 | \n", "regular_ll | \n", "1 | \n", "
| 1 | \n", "lfpw | \n", "2t | \n", "surface | \n", "0 | \n", "19931001 | \n", "0 | \n", "744 | \n", "fcmean | \n", "1 | \n", "regular_ll | \n", "1 | \n", "
| 2 | \n", "lfpw | \n", "2t | \n", "surface | \n", "0 | \n", "19931001 | \n", "0 | \n", "744 | \n", "fcmean | \n", "2 | \n", "regular_ll | \n", "1 | \n", "
| 3 | \n", "lfpw | \n", "2t | \n", "surface | \n", "0 | \n", "19931001 | \n", "0 | \n", "1464 | \n", "fcmean | \n", "0 | \n", "regular_ll | \n", "2 | \n", "
<xarray.Dataset> Size: 395kB\n",
"Dimensions: (number: 3, forecast_reference_time: 4, step: 6,\n",
" latitude: 19, longitude: 36)\n",
"Coordinates:\n",
" * number (number) int64 24B 0 1 2\n",
" * forecast_reference_time (forecast_reference_time) datetime64[ns] 32B 199...\n",
" * step (step) int64 48B 1 2 3 4 5 6\n",
" * latitude (latitude) float64 152B 90.0 80.0 ... -80.0 -90.0\n",
" * longitude (longitude) float64 288B 0.0 10.0 ... 340.0 350.0\n",
"Data variables:\n",
" 2t (number, forecast_reference_time, step, latitude, longitude) float64 394kB ...\n",
"Attributes: (12/15)\n",
" param: 2t\n",
" paramId: 167\n",
" class: c3\n",
" stream: msmm\n",
" levtype: sfc\n",
" type: fcmean\n",
" ... ...\n",
" fcmonth: 1\n",
" origin: lfpw\n",
" domain: g\n",
" method: 1\n",
" Conventions: CF-1.8\n",
" institution: ECMWF<xarray.Dataset> Size: 395kB\n",
"Dimensions: (number: 3, forecast_reference_time: 4,\n",
" forecastMonth: 6, latitude: 19, longitude: 36)\n",
"Coordinates:\n",
" * number (number) int64 24B 0 1 2\n",
" * forecast_reference_time (forecast_reference_time) datetime64[ns] 32B 199...\n",
" * forecastMonth (forecastMonth) int64 48B 1 2 3 4 5 6\n",
" * latitude (latitude) float64 152B 90.0 80.0 ... -80.0 -90.0\n",
" * longitude (longitude) float64 288B 0.0 10.0 ... 340.0 350.0\n",
"Data variables:\n",
" 2t (number, forecast_reference_time, forecastMonth, latitude, longitude) float64 394kB ...\n",
"Attributes: (12/15)\n",
" param: 2t\n",
" paramId: 167\n",
" class: c3\n",
" stream: msmm\n",
" levtype: sfc\n",
" type: fcmean\n",
" ... ...\n",
" fcmonth: 1\n",
" origin: lfpw\n",
" domain: g\n",
" method: 1\n",
" Conventions: CF-1.8\n",
" institution: ECMWF