{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "!test -f syn_new.bufr || wget https://get.ecmwf.int/repository/test-data/pdbufr/test-data/syn_new.bufr" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# Generic: synop data" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "import pdbufr" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "The input BUFR data contains three SYNOP observations.\n", "\n", "In this notebook we read this data with the :ref:`generic reader `, which is the default reader." ] }, { "cell_type": "markdown", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "#### Example 1\n", "\n", "Extract all \"2m\" temperature and dewpoint observations together with the measurement height." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
latitudelongitudeheightOfSensorAboveLocalGroundOrDeckOfMarinePlatformairTemperaturedewpointTemperaturedata_datetimeWMO_station_id
0-23.13017-134.965331.5300.45295.152020-03-1591948
149.7772217.541942.0269.25263.552020-03-1511766
230.00000100.270001.5276.35263.052020-03-1556257
\n", "
" ], "text/plain": [ " latitude longitude heightOfSensorAboveLocalGroundOrDeckOfMarinePlatform \\\n", "0 -23.13017 -134.96533 1.5 \n", "1 49.77722 17.54194 2.0 \n", "2 30.00000 100.27000 1.5 \n", "\n", " airTemperature dewpointTemperature data_datetime WMO_station_id \n", "0 300.45 295.15 2020-03-15 91948 \n", "1 269.25 263.55 2020-03-15 11766 \n", "2 276.35 263.05 2020-03-15 56257 " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = pdbufr.read_bufr(\"syn_new.bufr\", \n", " columns=(\"WMO_station_id\", \"data_datetime\", \"latitude\", \"longitude\", \"heightOfSensorAboveLocalGroundOrDeckOfMarinePlatform\", \"airTemperature\", \"dewpointTemperature\"))\n", "df" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "#### Example 2\n", "\n", "Getting low level cloud data from the message with a given \"dataSubCategory\":" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
cloudAmountheightOfBaseOfCloudcloudTypedata_datetimeWMO_station_id
02600.0322020-03-1591948
12600.0202020-03-1591948
22600.0102020-03-1591948
\n", "
" ], "text/plain": [ " cloudAmount heightOfBaseOfCloud cloudType data_datetime WMO_station_id\n", "0 2 600.0 32 2020-03-15 91948\n", "1 2 600.0 20 2020-03-15 91948\n", "2 2 600.0 10 2020-03-15 91948" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = pdbufr.read_bufr(\"syn_new.bufr\", \n", " columns=(\"data_datetime\", \"WMO_station_id\", \"cloudAmount\", \"heightOfBaseOfCloud\", \"cloudType\"),\n", " filters={\"dataSubCategory\": 172, \"verticalSignificanceSurfaceObservations\": 7})\n", "df" ] } ], "metadata": { "kernelspec": { "display_name": "dev", "language": "python", "name": "dev" }, "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.11.12" }, "vscode": { "interpreter": { "hash": "22dc05efe0944894879e71a134ce5db002aedecbcd8b98acee6e3c2217e44519" } } }, "nbformat": 4, "nbformat_minor": 4 }