{ "cells": [ { "cell_type": "markdown", "id": "7ec282fb-fdf9-45ba-b3f7-3d46ef212e98", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "## Retrieving data from the ADS" ] }, { "cell_type": "raw", "id": "fdb1ce5a-2f75-44e4-85fb-6bd47084cadd", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "The :ref:`ads ` data source provides access to the `Copernicus Atmosphere Data Store (ADS) `_." ] }, { "cell_type": "code", "execution_count": 1, "id": "f24509e0-dd8c-4032-9a3c-5a963ad544d9", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "import earthkit.data as ekd" ] }, { "cell_type": "markdown", "id": "9f4ce2c9-aaa3-4b76-aacb-1f597df3e338", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "### Getting GRIB data" ] }, { "cell_type": "code", "execution_count": 2, "id": "be1b53fd-4871-4ebf-ae6c-a62fd1117082", "metadata": {}, "outputs": [], "source": [ "ds = ekd.from_source(\n", " \"ads\",\n", " \"cams-global-reanalysis-eac4\",\n", " request=dict(\n", " variable=[\"particulate_matter_10um\", \"particulate_matter_1um\"],\n", " area=[50, -50, 20, 50], # N,W,S,E\n", " date=\"2012-05-10\",\n", " time=\"12:00\",\n", " ),\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "id": "09210614-fad6-46cf-915d-aae4a592d2d5", "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", "
centreshortNametypeOfLevelleveldataDatedataTimestepRangedataTypenumbergridType
0ecmfpm10surface02012051012000an0regular_ll
1ecmfpm1surface02012051012000an0regular_ll
\n", "
" ], "text/plain": [ " centre shortName typeOfLevel level dataDate dataTime stepRange dataType \\\n", "0 ecmf pm10 surface 0 20120510 1200 0 an \n", "1 ecmf pm1 surface 0 20120510 1200 0 an \n", "\n", " number gridType \n", "0 0 regular_ll \n", "1 0 regular_ll " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.ls()" ] }, { "cell_type": "markdown", "id": "eed0bfe1-eb81-4c26-a48b-5150f67bbb79", "metadata": {}, "source": [ "### Getting NetCDF data" ] }, { "cell_type": "code", "execution_count": 4, "id": "47f368bd-64c7-4268-bacf-7f3f1aad1b24", "metadata": {}, "outputs": [], "source": [ "ds1 = ekd.from_source(\n", " \"ads\",\n", " \"cams-global-reanalysis-eac4\",\n", " request=dict(\n", " variable=[\"particulate_matter_10um\", \"particulate_matter_1um\"],\n", " area=[50, -50, 20, 50], # N,W,S,E\n", " date=\"2012-05-10\",\n", " time=\"12:00\",\n", " format=\"netcdf\",\n", " ),\n", ")" ] }, { "cell_type": "code", "execution_count": 5, "id": "5514f18a-0441-4995-8451-4f4fdd54d60f", "metadata": {}, "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", "
variablelevelvalid_datetimeunits
0pm10None2012-05-10T12:00:00kg m**-3
1pm1None2012-05-10T12:00:00kg m**-3
\n", "
" ], "text/plain": [ " variable level valid_datetime units\n", "0 pm10 None 2012-05-10T12:00:00 kg m**-3\n", "1 pm1 None 2012-05-10T12:00:00 kg m**-3" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds1.ls()" ] }, { "cell_type": "code", "execution_count": null, "id": "31bd40f8-5700-478c-961f-40f6babefd33", "metadata": {}, "outputs": [], "source": [] } ], "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" } }, "nbformat": 4, "nbformat_minor": 5 }