{ "cells": [ { "cell_type": "markdown", "id": "dde8b5d5-5bba-4266-8521-3e3e163bef3a", "metadata": {}, "source": [ "# Handling multi-dimensional arrays with xarray" ] }, { "cell_type": "markdown", "id": "a0d36cd0-7cdc-4e5e-922b-a1979a1c9e7b", "metadata": {}, "source": [ "## Authors & Contributors\n", "\n", "### Authors\n", "\n", "- Pier Lorenzo Marasco, Ispra (Italy), [@pl-marasco](https://github.com/pl-marasco)\n", "- Anne Fouilloux, Simula Research Laboratory (Norway), [@annefou](https://github.com/annefou)\n", "\n", "### Contributors\n", "\n", "- Alejandro Coca-Castro, The Alan Turing Institute (United Kingdom), [@acocac](https://github.com/acocac)\n", "- Guillaume Eynard-Bontemps, CNES (France), [@guillaumeeb](https://github.com/guillaumeeb)" ] }, { "cell_type": "markdown", "id": "ec37ef0f-da32-40c7-8320-467c46bfab6a", "metadata": {}, "source": [ "
\n", "\n", "Comment: Remark\n", "This tutorial uses data on a regular latitude-longitude grid. More complex and irregular grids are not discussed in this tutorial. In addition,\n", "this tutorial is not meant to cover all the different possibilities offered by Xarrays but shows functionalities we find useful for day to day\n", "analysis.
\n", "
\n", "" ] }, { "cell_type": "markdown", "id": "c341348a-77e3-47bb-aa1a-86982f930c79", "metadata": {}, "source": [ "## Setup\n", "\n", "This episode uses the following main Python packages:\n", "\n", "- xarray {cite:ps}`a-xarray-hoyer2017` with [`netCDF4`](https://pypi.org/project/h5netcdf/) and [`h5netcdf`](https://pypi.org/project/h5netcdf/) engines\n", "- pooch {cite:ps}`a-pooch-Uieda2020`\n", "- numpy {cite:ps}`a-numpy-harris2020`\n", "- cmcrameri {cite:ps}`a-cmcrameri-crameri2018`\n", "\n", "Please install these packages if they are not already available in your Python environment (see info [here](https://github.com/pangeo-data/geo-open-hack-2024/tree/main)).\n", "\n", "### Packages\n", "\n", "In this episode, Python packages are imported when we start to use them. However, for best software practices, we recommend that you install and import all the necessary libraries at the top of your Jupyter notebook." ] }, { "cell_type": "code", "execution_count": 1, "id": "dfb32910-f236-4d50-88e0-70871bba51e6", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "hide-output" ] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: cmcrameri in /srv/conda/envs/notebook/lib/python3.11/site-packages (1.9)\n", "Requirement already satisfied: matplotlib in /srv/conda/envs/notebook/lib/python3.11/site-packages (from cmcrameri) (3.8.2)\n", "Requirement already satisfied: numpy in /srv/conda/envs/notebook/lib/python3.11/site-packages (from cmcrameri) (1.26.2)\n", "Requirement already satisfied: packaging in /srv/conda/envs/notebook/lib/python3.11/site-packages (from cmcrameri) (23.2)\n", "Requirement already satisfied: contourpy>=1.0.1 in /srv/conda/envs/notebook/lib/python3.11/site-packages (from matplotlib->cmcrameri) (1.2.0)\n", "Requirement already satisfied: cycler>=0.10 in /srv/conda/envs/notebook/lib/python3.11/site-packages (from matplotlib->cmcrameri) (0.12.1)\n", "Requirement already satisfied: fonttools>=4.22.0 in /srv/conda/envs/notebook/lib/python3.11/site-packages (from matplotlib->cmcrameri) (4.46.0)\n", "Requirement already satisfied: kiwisolver>=1.3.1 in /srv/conda/envs/notebook/lib/python3.11/site-packages (from matplotlib->cmcrameri) (1.4.5)\n", "Requirement already satisfied: pillow>=8 in /srv/conda/envs/notebook/lib/python3.11/site-packages (from matplotlib->cmcrameri) (10.1.0)\n", "Requirement already satisfied: pyparsing>=2.3.1 in /srv/conda/envs/notebook/lib/python3.11/site-packages (from matplotlib->cmcrameri) (3.1.1)\n", "Requirement already satisfied: python-dateutil>=2.7 in /srv/conda/envs/notebook/lib/python3.11/site-packages (from matplotlib->cmcrameri) (2.8.2)\n", "Requirement already satisfied: six>=1.5 in /srv/conda/envs/notebook/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib->cmcrameri) (1.16.0)\n", "Note: you may need to restart the kernel to use updated packages.\n" ] } ], "source": [ "pip install cmcrameri" ] }, { "cell_type": "code", "execution_count": 2, "id": "51c76db6-f5aa-40eb-97f1-2df7cde50e83", "metadata": {}, "outputs": [], "source": [ "import xarray as xr" ] }, { "cell_type": "markdown", "id": "2d9c40c3-44c9-451f-b8ad-fec067c05932", "metadata": {}, "source": [ "### Fetch Data\n", "\n", "- For now we will fetch a netCDF file containing the near-surface temperature from one single CMIP6 model CESM2.\n", "- The file is available in a Zenodo repository. We will download it using using `pooch`, a very handy Python-based library to download and cache your data files locally (see further info [here](https://www.fatiando.org/pooch/latest/index.html))\n", "- In the [Data access and discovery](https://pangeo-data.github.io/escience-2022/pangeo101/data_discovery.html) episode, we will learn about different ways to access data, including access to remote data." ] }, { "cell_type": "code", "execution_count": 3, "id": "08ba3f1d-71ea-42ec-904f-dc2452640590", "metadata": {}, "outputs": [], "source": [ "import pooch" ] }, { "cell_type": "code", "execution_count": 4, "id": "f247c3cd-7f19-43c8-b721-6b159f401379", "metadata": { "tags": [ "hide-output" ] }, "outputs": [], "source": [ "cams_file = pooch.retrieve(\n", " url=\"https://zenodo.org/record/5805953/files/CAMS-PM2_5-20211222.netcdf\",\n", " known_hash=\"md5:c4a6bb0a5a5640fc8de2ae6f377932fc\",\n", " path=f\".\",\n", ")" ] }, { "cell_type": "markdown", "id": "3a1db255-b521-4465-9ffd-0113c48f1fd1", "metadata": {}, "source": [ "## Open and read metadata through Xarray" ] }, { "cell_type": "code", "execution_count": 5, "id": "6974bdbf-f874-4b0d-bb9b-13a0161af3b0", "metadata": {}, "outputs": [], "source": [ "cams = xr.open_dataset(cams_file)" ] }, { "cell_type": "markdown", "id": "711acf54", "metadata": {}, "source": [ "As the dataset is in the NetCDF format, Xarray automatically selects the correct engine (this happens in the background because engine='netcdf' has been automatically specified). Other common options are \"h5netcdf\" or \"zarr\".\n", "GeoTiff data can also be read, but to access it requires rioxarray, which will be quickly covered later.\n", "Supposing that you have a dataset in an unrecognised format, you can always create your own reader as a subclass of the backend entry point and pass it through the engine parameter." ] }, { "cell_type": "markdown", "id": "fac7ac28", "metadata": {}, "source": [ ":::{tip}\n", "If you get an error with the previous command, first check the location of the input file some_hash-CAMS-PM2_5-20211222.netcdf: it should have been downloaded in the same directory as your Jupyter Notebook.\n", ":::" ] }, { "cell_type": "code", "execution_count": 6, "id": "098a2be0", "metadata": {}, "outputs": [ { "data": { "text/html": [ "Agenda\n", "In this tutorial, we will cover:
\n", "\n", "
\n", "- Analysis
\n", "\n", "
\n", "- Import Python packages
\n", "
<xarray.Dataset>\n", "Dimensions: (longitude: 700, latitude: 400, level: 1, time: 97)\n", "Coordinates:\n", " * longitude (longitude) float32 335.0 335.1 335.2 ... 44.75 44.85 44.95\n", " * latitude (latitude) float32 69.95 69.85 69.75 69.65 ... 30.25 30.15 30.05\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", "Data variables:\n", " pm2p5_conc (time, level, latitude, longitude) float32 ...\n", "Attributes:\n", " title: PM25 Air Pollutant FORECAST at the Surface\n", " institution: Data produced by Meteo France\n", " source: Data from ENSEMBLE model\n", " history: Model ENSEMBLE FORECAST\n", " FORECAST: Europe, 20211222+[0H_96H]\n", " summary: ENSEMBLE model hourly FORECAST of PM25 concentration at the...\n", " project: MACC-RAQ (http://macc-raq.gmes-atmosphere.eu)
<xarray.DataArray 'time' (time: 97)>\n", "array([ 0, 3600000000000, 7200000000000, 10800000000000,\n", " 14400000000000, 18000000000000, 21600000000000, 25200000000000,\n", " 28800000000000, 32400000000000, 36000000000000, 39600000000000,\n", " 43200000000000, 46800000000000, 50400000000000, 54000000000000,\n", " 57600000000000, 61200000000000, 64800000000000, 68400000000000,\n", " 72000000000000, 75600000000000, 79200000000000, 82800000000000,\n", " 86400000000000, 90000000000000, 93600000000000, 97200000000000,\n", " 100800000000000, 104400000000000, 108000000000000, 111600000000000,\n", " 115200000000000, 118800000000000, 122400000000000, 126000000000000,\n", " 129600000000000, 133200000000000, 136800000000000, 140400000000000,\n", " 144000000000000, 147600000000000, 151200000000000, 154800000000000,\n", " 158400000000000, 162000000000000, 165600000000000, 169200000000000,\n", " 172800000000000, 176400000000000, 180000000000000, 183600000000000,\n", " 187200000000000, 190800000000000, 194400000000000, 198000000000000,\n", " 201600000000000, 205200000000000, 208800000000000, 212400000000000,\n", " 216000000000000, 219600000000000, 223200000000000, 226800000000000,\n", " 230400000000000, 234000000000000, 237600000000000, 241200000000000,\n", " 244800000000000, 248400000000000, 252000000000000, 255600000000000,\n", " 259200000000000, 262800000000000, 266400000000000, 270000000000000,\n", " 273600000000000, 277200000000000, 280800000000000, 284400000000000,\n", " 288000000000000, 291600000000000, 295200000000000, 298800000000000,\n", " 302400000000000, 306000000000000, 309600000000000, 313200000000000,\n", " 316800000000000, 320400000000000, 324000000000000, 327600000000000,\n", " 331200000000000, 334800000000000, 338400000000000, 342000000000000,\n", " 345600000000000], dtype='timedelta64[ns]')\n", "Coordinates:\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", "Attributes:\n", " long_name: FORECAST time from 20211222
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, latitude: 400,\n", " longitude: 700)>\n", "[27160000 values with dtype=float32]\n", "Coordinates:\n", " * longitude (longitude) float32 335.0 335.1 335.2 335.4 ... 44.75 44.85 44.95\n", " * latitude (latitude) float32 69.95 69.85 69.75 69.65 ... 30.25 30.15 30.05\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, latitude: 400,\n", " longitude: 700)>\n", "[27160000 values with dtype=float32]\n", "Coordinates:\n", " * longitude (longitude) float32 335.0 335.1 335.2 335.4 ... 44.75 44.85 44.95\n", " * latitude (latitude) float32 69.95 69.85 69.75 69.65 ... 30.25 30.15 30.05\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.Dataset>\n", "Dimensions: (lon: 700, lat: 400, level: 1, time: 97)\n", "Coordinates:\n", " * lon (lon) float32 335.0 335.1 335.2 335.4 ... 44.75 44.85 44.95\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 30.25 30.15 30.05\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", "Data variables:\n", " pm2p5_conc (time, level, lat, lon) float32 0.4202 0.4331 ... 7.329 7.501\n", "Attributes:\n", " title: PM25 Air Pollutant FORECAST at the Surface\n", " institution: Data produced by Meteo France\n", " source: Data from ENSEMBLE model\n", " history: Model ENSEMBLE FORECAST\n", " FORECAST: Europe, 20211222+[0H_96H]\n", " summary: ENSEMBLE model hourly FORECAST of PM25 concentration at the...\n", " project: MACC-RAQ (http://macc-raq.gmes-atmosphere.eu)
<xarray.DataArray 'pm2p5_conc' ()>\n", "array(2.396931, dtype=float32)\n", "Coordinates:\n", " lat float32 59.95\n", " level float32 0.0\n", " time timedelta64[ns] 00:00:00\n", " lon float32 -14.95\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' (lat: 10, lon: 10)>\n", "array([[2.396931, 2.40307 , 2.406154, 2.408797, 2.415234, 2.418361, 2.414907,\n", " 2.408982, 2.398707, 2.388873],\n", " [2.175199, 2.175696, 2.172883, 2.173877, 2.177146, 2.17976 , 2.219366,\n", " 2.337629, 2.281311, 2.306678],\n", " [2.153712, 2.11665 , 2.083326, 2.175028, 2.317506, 2.509566, 2.59864 ,\n", " 2.742937, 2.716505, 2.692815],\n", " [2.673005, 2.624574, 2.577082, 2.55173 , 2.527671, 2.507051, 2.495241,\n", " 2.491348, 2.499505, 2.51255 ],\n", " [3.034373, 3.064997, 3.083713, 3.099743, 3.114579, 3.122835, 3.130595,\n", " 3.134872, 3.066902, 3.080857],\n", " [2.827477, 2.889905, 2.940652, 3.008623, 3.070142, 3.122423, 3.16949 ,\n", " 3.204718, 3.228834, 3.248346],\n", " [2.72496 , 2.726921, 2.744543, 2.776133, 2.823825, 2.872682, 2.926299,\n", " 3.074007, 3.489817, 3.465331],\n", " [2.830262, 2.818837, 2.809443, 2.803788, 2.796654, 3.25818 , 3.697267,\n", " 3.924114, 3.825889, 3.679787],\n", " [4.127571, 3.362629, 3.57602 , 3.699882, 3.674302, 3.445621, 3.212406,\n", " 3.258507, 3.308671, 3.361635],\n", " [4.588827, 4.447983, 4.203201, 3.700336, 3.73332 , 3.784365, 3.837968,\n", " 3.880246, 3.91303 , 3.947676]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 59.95 59.85 59.75 59.65 ... 59.35 59.25 59.15 59.05\n", " level float32 0.0\n", " time timedelta64[ns] 00:00:00\n", " * lon (lon) float32 -14.95 -14.85 -14.75 -14.65 ... -14.25 -14.15 -14.05\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' ()>\n", "array(2.396931, dtype=float32)\n", "Coordinates:\n", " lat float32 59.95\n", " level float32 0.0\n", " time timedelta64[ns] 00:00:00\n", " lon float32 -14.95\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' (level: 1, lat: 400, lon: 700)>\n", "array([[[0.500001, 0.500001, ..., 1.419116, 1.425483],\n", " [0.500001, 0.500001, ..., 1.238894, 1.257112],\n", " ...,\n", " [2.416178, 2.482116, ..., 9.897312, 9.944606],\n", " [2.588073, 2.540324, ..., 9.613549, 9.609912]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 30.35 30.25 30.15 30.05\n", " * level (level) float32 0.0\n", " time timedelta64[ns] 2 days\n", " * lon (lon) float32 -24.95 -24.85 -24.75 -24.65 ... 44.75 44.85 44.95\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.Dataset>\n", "Dimensions: (level: 1, time: 97)\n", "Coordinates:\n", " lat float32 46.35\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", " lon float32 8.75\n", "Data variables:\n", " pm2p5_conc (time, level) float32 5.469 5.207 5.003 ... 4.19 4.119 4.017\n", "Attributes:\n", " title: PM25 Air Pollutant FORECAST at the Surface\n", " institution: Data produced by Meteo France\n", " source: Data from ENSEMBLE model\n", " history: Model ENSEMBLE FORECAST\n", " FORECAST: Europe, 20211222+[0H_96H]\n", " summary: ENSEMBLE model hourly FORECAST of PM25 concentration at the...\n", " project: MACC-RAQ (http://macc-raq.gmes-atmosphere.eu)
<xarray.Dataset>\n", "Dimensions: (level: 1, time: 97)\n", "Coordinates:\n", " lat float32 59.95\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", " lon float32 -14.95\n", "Data variables:\n", " pm2p5_conc (time, level) float32 2.397 2.281 2.223 ... 2.175 2.192 2.274\n", "Attributes:\n", " title: PM25 Air Pollutant FORECAST at the Surface\n", " institution: Data produced by Meteo France\n", " source: Data from ENSEMBLE model\n", " history: Model ENSEMBLE FORECAST\n", " FORECAST: Europe, 20211222+[0H_96H]\n", " summary: ENSEMBLE model hourly FORECAST of PM25 concentration at the...\n", " project: MACC-RAQ (http://macc-raq.gmes-atmosphere.eu)
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, lat: 155, lon: 450)>\n", "array([[[[ 0.855664, ..., 0.865896],\n", " ...,\n", " [14.878069, ..., 7.30256 ]]],\n", "\n", "\n", " ...,\n", "\n", "\n", " [[[ 1.36206 , ..., 2.526661],\n", " ...,\n", " [ 1.954816, ..., 6.040956]]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, lat: 155, lon: 450)>\n", "array([[[[ 855.6641 , 852.48096, 833.32465, ..., 879.8937 ,\n", " 902.90106, 865.896 ],\n", " [ 885.7343 , 891.02075, 878.97 , ..., 971.65314,\n", " 1061.4657 , 1015.5647 ],\n", " [ 893.89136, 828.7204 , 800.25604, ..., 1032.3335 ,\n", " 990.852 , 982.55286],\n", " ...,\n", " [10043.194 , 10672.565 , 11238.228 , ..., 7507.282 ,\n", " 7414.5137 , 7444.7827 ],\n", " [13826.692 , 14108.494 , 14563.739 , ..., 7519.0063 ,\n", " 7214.311 , 7085.4043 ],\n", " [14878.069 , 14873.55 , 14858.358 , ..., 7069.7866 ,\n", " 7237.475 , 7302.5605 ]]],\n", "\n", "\n", " [[[ 868.89185, 899.5873 , 930.3964 , ..., 936.80554,\n", " 839.1485 , 772.7412 ],\n", " [ 858.319 , 891.28815, 934.2618 , ..., 772.7412 ,\n", " 733.67554, 716.23883],\n", " [ 873.09827, 925.96265, 940.6993 , ..., 729.8386 ,\n", "...\n", " 6790.51 , 6748.986 ],\n", " [ 1623.8978 , 1855.4778 , 2173.332 , ..., 5969.662 ,\n", " 6049.47 , 6131.5386 ],\n", " [ 2051.7156 , 2147.7383 , 1941.084 , ..., 5981.9263 ,\n", " 5846.8096 , 5826.9146 ]]],\n", "\n", "\n", " [[[ 1362.0598 , 1371.5527 , 1349.8243 , ..., 2480.518 ,\n", " 2496.761 , 2526.6606 ],\n", " [ 1398.2976 , 1351.3591 , 1315.5477 , ..., 2294.1143 ,\n", " 2327.9363 , 2370.2136 ],\n", " [ 1287.1544 , 1304.108 , 1268.4387 , ..., 2281.4312 ,\n", " 2239.3528 , 2212.153 ],\n", " ...,\n", " [ 1829.8173 , 1892.3165 , 1997.889 , ..., 6986.432 ,\n", " 6914.4253 , 6935.685 ],\n", " [ 1650.3838 , 1853.0875 , 2025.124 , ..., 6504.3003 ,\n", " 6350.027 , 6176.655 ],\n", " [ 1954.8159 , 2019.9797 , 1916.7521 , ..., 5647.4995 ,\n", " 5836.5464 , 6040.9556 ]]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, lat: 155, lon: 450)>\n", "array([[[[ 855.6641 , 852.48096, 833.32465, ..., 879.8937 ,\n", " 902.90106, 865.896 ],\n", " [ 885.7343 , 891.02075, 878.97 , ..., 971.65314,\n", " 1061.4657 , 1015.5647 ],\n", " [ 893.89136, 828.7204 , 800.25604, ..., 1032.3335 ,\n", " 990.852 , 982.55286],\n", " ...,\n", " [10043.194 , 10672.565 , 11238.228 , ..., 7507.282 ,\n", " 7414.5137 , 7444.7827 ],\n", " [13826.692 , 14108.494 , 14563.739 , ..., 7519.0063 ,\n", " 7214.311 , 7085.4043 ],\n", " [14878.069 , 14873.55 , 14858.358 , ..., 7069.7866 ,\n", " 7237.475 , 7302.5605 ]]],\n", "\n", "\n", " [[[ 868.89185, 899.5873 , 930.3964 , ..., 936.80554,\n", " 839.1485 , 772.7412 ],\n", " [ 858.319 , 891.28815, 934.2618 , ..., 772.7412 ,\n", " 733.67554, 716.23883],\n", " [ 873.09827, 925.96265, 940.6993 , ..., 729.8386 ,\n", "...\n", " 6790.51 , 6748.986 ],\n", " [ 1623.8978 , 1855.4778 , 2173.332 , ..., 5969.662 ,\n", " 6049.47 , 6131.5386 ],\n", " [ 2051.7156 , 2147.7383 , 1941.084 , ..., 5981.9263 ,\n", " 5846.8096 , 5826.9146 ]]],\n", "\n", "\n", " [[[ 1362.0598 , 1371.5527 , 1349.8243 , ..., 2480.518 ,\n", " 2496.761 , 2526.6606 ],\n", " [ 1398.2976 , 1351.3591 , 1315.5477 , ..., 2294.1143 ,\n", " 2327.9363 , 2370.2136 ],\n", " [ 1287.1544 , 1304.108 , 1268.4387 , ..., 2281.4312 ,\n", " 2239.3528 , 2212.153 ],\n", " ...,\n", " [ 1829.8173 , 1892.3165 , 1997.889 , ..., 6986.432 ,\n", " 6914.4253 , 6935.685 ],\n", " [ 1650.3838 , 1853.0875 , 2025.124 , ..., 6504.3003 ,\n", " 6350.027 , 6176.655 ],\n", " [ 1954.8159 , 2019.9797 , 1916.7521 , ..., 5647.4995 ,\n", " 5836.5464 , 6040.9556 ]]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, lat: 155, lon: 450)>\n", "array([[[[ 855.6641 , 852.48096, 833.32465, ..., 879.8937 ,\n", " 902.90106, 865.896 ],\n", " [ 885.7343 , 891.02075, 878.97 , ..., 971.65314,\n", " 1061.4657 , 1015.5647 ],\n", " [ 893.89136, 828.7204 , 800.25604, ..., 1032.3335 ,\n", " 990.852 , 982.55286],\n", " ...,\n", " [10043.194 , 10672.565 , 11238.228 , ..., 7507.282 ,\n", " 7414.5137 , 7444.7827 ],\n", " [13826.692 , 14108.494 , 14563.739 , ..., 7519.0063 ,\n", " 7214.311 , 7085.4043 ],\n", " [14878.069 , 14873.55 , 14858.358 , ..., 7069.7866 ,\n", " 7237.475 , 7302.5605 ]]],\n", "\n", "\n", " [[[ 868.89185, 899.5873 , 930.3964 , ..., 936.80554,\n", " 839.1485 , 772.7412 ],\n", " [ 858.319 , 891.28815, 934.2618 , ..., 772.7412 ,\n", " 733.67554, 716.23883],\n", " [ 873.09827, 925.96265, 940.6993 , ..., 729.8386 ,\n", "...\n", " 6790.51 , 6748.986 ],\n", " [ 1623.8978 , 1855.4778 , 2173.332 , ..., 5969.662 ,\n", " 6049.47 , 6131.5386 ],\n", " [ 2051.7156 , 2147.7383 , 1941.084 , ..., 5981.9263 ,\n", " 5846.8096 , 5826.9146 ]]],\n", "\n", "\n", " [[[ 1362.0598 , 1371.5527 , 1349.8243 , ..., 2480.518 ,\n", " 2496.761 , 2526.6606 ],\n", " [ 1398.2976 , 1351.3591 , 1315.5477 , ..., 2294.1143 ,\n", " 2327.9363 , 2370.2136 ],\n", " [ 1287.1544 , 1304.108 , 1268.4387 , ..., 2281.4312 ,\n", " 2239.3528 , 2212.153 ],\n", " ...,\n", " [ 1829.8173 , 1892.3165 , 1997.889 , ..., 6986.432 ,\n", " 6914.4253 , 6935.685 ],\n", " [ 1650.3838 , 1853.0875 , 2025.124 , ..., 6504.3003 ,\n", " 6350.027 , 6176.655 ],\n", " [ 1954.8159 , 2019.9797 , 1916.7521 , ..., 5647.4995 ,\n", " 5836.5464 , 6040.9556 ]]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, lat: 155, lon: 450)>\n", "array([[[[ 855.6641 , 852.48096, 833.32465, ..., 879.8937 ,\n", " 902.90106, 865.896 ],\n", " [ 885.7343 , 891.02075, 878.97 , ..., 971.65314,\n", " 1061.4657 , 1015.5647 ],\n", " [ 893.89136, 828.7204 , 800.25604, ..., 1032.3335 ,\n", " 990.852 , 982.55286],\n", " ...,\n", " [10043.194 , 10672.565 , 11238.228 , ..., 7507.282 ,\n", " 7414.5137 , 7444.7827 ],\n", " [13826.692 , 14108.494 , 14563.739 , ..., 7519.0063 ,\n", " 7214.311 , 7085.4043 ],\n", " [14878.069 , 14873.55 , 14858.358 , ..., 7069.7866 ,\n", " 7237.475 , 7302.5605 ]]],\n", "\n", "\n", " [[[ 868.89185, 899.5873 , 930.3964 , ..., 936.80554,\n", " 839.1485 , 772.7412 ],\n", " [ 858.319 , 891.28815, 934.2618 , ..., 772.7412 ,\n", " 733.67554, 716.23883],\n", " [ 873.09827, 925.96265, 940.6993 , ..., 729.8386 ,\n", "...\n", " 6790.51 , 6748.986 ],\n", " [ 1623.8978 , 1855.4778 , 2173.332 , ..., 5969.662 ,\n", " 6049.47 , 6131.5386 ],\n", " [ 2051.7156 , 2147.7383 , 1941.084 , ..., 5981.9263 ,\n", " 5846.8096 , 5826.9146 ]]],\n", "\n", "\n", " [[[ 1362.0598 , 1371.5527 , 1349.8243 , ..., 2480.518 ,\n", " 2496.761 , 2526.6606 ],\n", " [ 1398.2976 , 1351.3591 , 1315.5477 , ..., 2294.1143 ,\n", " 2327.9363 , 2370.2136 ],\n", " [ 1287.1544 , 1304.108 , 1268.4387 , ..., 2281.4312 ,\n", " 2239.3528 , 2212.153 ],\n", " ...,\n", " [ 1829.8173 , 1892.3165 , 1997.889 , ..., 6986.432 ,\n", " 6914.4253 , 6935.685 ],\n", " [ 1650.3838 , 1853.0875 , 2025.124 , ..., 6504.3003 ,\n", " 6350.027 , 6176.655 ],\n", " [ 1954.8159 , 2019.9797 , 1916.7521 , ..., 5647.4995 ,\n", " 5836.5464 , 6040.9556 ]]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: µg/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, lat: 155, lon: 450)>\n", "array([[[[ 855.6641 , 852.48096, 833.32465, ..., 879.8937 ,\n", " 902.90106, 865.896 ],\n", " [ 885.7343 , 891.02075, 878.97 , ..., 971.65314,\n", " 1061.4657 , 1015.5647 ],\n", " [ 893.89136, 828.7204 , 800.25604, ..., 1032.3335 ,\n", " 990.852 , 982.55286],\n", " ...,\n", " [10043.194 , 10672.565 , 11238.228 , ..., 7507.282 ,\n", " 7414.5137 , 7444.7827 ],\n", " [13826.692 , 14108.494 , 14563.739 , ..., 7519.0063 ,\n", " 7214.311 , 7085.4043 ],\n", " [14878.069 , 14873.55 , 14858.358 , ..., 7069.7866 ,\n", " 7237.475 , 7302.5605 ]]],\n", "\n", "\n", " [[[ 868.89185, 899.5873 , 930.3964 , ..., 936.80554,\n", " 839.1485 , 772.7412 ],\n", " [ 858.319 , 891.28815, 934.2618 , ..., 772.7412 ,\n", " 733.67554, 716.23883],\n", " [ 873.09827, 925.96265, 940.6993 , ..., 729.8386 ,\n", "...\n", " 6790.51 , 6748.986 ],\n", " [ 1623.8978 , 1855.4778 , 2173.332 , ..., 5969.662 ,\n", " 6049.47 , 6131.5386 ],\n", " [ 2051.7156 , 2147.7383 , 1941.084 , ..., 5981.9263 ,\n", " 5846.8096 , 5826.9146 ]]],\n", "\n", "\n", " [[[ 1362.0598 , 1371.5527 , 1349.8243 , ..., 2480.518 ,\n", " 2496.761 , 2526.6606 ],\n", " [ 1398.2976 , 1351.3591 , 1315.5477 , ..., 2294.1143 ,\n", " 2327.9363 , 2370.2136 ],\n", " [ 1287.1544 , 1304.108 , 1268.4387 , ..., 2281.4312 ,\n", " 2239.3528 , 2212.153 ],\n", " ...,\n", " [ 1829.8173 , 1892.3165 , 1997.889 , ..., 6986.432 ,\n", " 6914.4253 , 6935.685 ],\n", " [ 1650.3838 , 1853.0875 , 2025.124 , ..., 6504.3003 ,\n", " 6350.027 , 6176.655 ],\n", " [ 1954.8159 , 2019.9797 , 1916.7521 , ..., 5647.4995 ,\n", " 5836.5464 , 6040.9556 ]]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * time (time) timedelta64[ns] 00:00:00 01:00:00 ... 4 days 00:00:00\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: ng/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' ()>\n", "array(375.96038818)
<xarray.DataArray 'pm2p5_conc' (level: 1, lat: 155, lon: 450)>\n", "array([[[ 2121.0813, 2219.4773, 2217.5305, ..., 3652.913 ,\n", " 3473.7568, 3577.1978],\n", " [ 2229.2544, 2233.2195, 2240.6362, ..., 4046.014 ,\n", " 3602.7063, 3208.9517],\n", " [ 2284.292 , 2295.2058, 2309.7578, ..., 4741.6777,\n", " 4632.1265, 4161.8325],\n", " ...,\n", " [13408.843 , 13095.977 , 14038.214 , ..., 18508.65 ,\n", " 18356.64 , 17824.658 ],\n", " [17083.7 , 16497.771 , 16912.217 , ..., 19211.908 ,\n", " 19491.762 , 18477.52 ],\n", " [19680.336 , 19178.678 , 18560.22 , ..., 18558.336 ,\n", " 18246.791 , 18232.215 ]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45
<xarray.DataArray 'pm2p5_conc' (time: 97, level: 1, lat: 155, lon: 450)>\n", "array([[[[ 855.6641 , 852.48096, 833.32465, ..., 879.8937 ,\n", " 902.90106, 865.896 ],\n", " [ 885.7343 , 891.02075, 878.97 , ..., 971.65314,\n", " 1061.4657 , 1015.5647 ],\n", " [ 893.89136, 828.7204 , 800.25604, ..., 1032.3335 ,\n", " 990.852 , 982.55286],\n", " ...,\n", " [10043.194 , 10672.565 , 11238.228 , ..., 7507.282 ,\n", " 7414.5137 , 7444.7827 ],\n", " [13826.692 , 14108.494 , 14563.739 , ..., 7519.0063 ,\n", " 7214.311 , 7085.4043 ],\n", " [14878.069 , 14873.55 , 14858.358 , ..., 7069.7866 ,\n", " 7237.475 , 7302.5605 ]]],\n", "\n", "\n", " [[[ 868.89185, 899.5873 , 930.3964 , ..., 936.80554,\n", " 839.1485 , 772.7412 ],\n", " [ 858.319 , 891.28815, 934.2618 , ..., 772.7412 ,\n", " 733.67554, 716.23883],\n", " [ 873.09827, 925.96265, 940.6993 , ..., 729.8386 ,\n", "...\n", " 6790.51 , 6748.986 ],\n", " [ 1623.8978 , 1855.4778 , 2173.332 , ..., 5969.662 ,\n", " 6049.47 , 6131.5386 ],\n", " [ 2051.7156 , 2147.7383 , 1941.084 , ..., 5981.9263 ,\n", " 5846.8096 , 5826.9146 ]]],\n", "\n", "\n", " [[[ 1362.0598 , 1371.5527 , 1349.8243 , ..., 2480.518 ,\n", " 2496.761 , 2526.6606 ],\n", " [ 1398.2976 , 1351.3591 , 1315.5477 , ..., 2294.1143 ,\n", " 2327.9363 , 2370.2136 ],\n", " [ 1287.1544 , 1304.108 , 1268.4387 , ..., 2281.4312 ,\n", " 2239.3528 , 2212.153 ],\n", " ...,\n", " [ 1829.8173 , 1892.3165 , 1997.889 , ..., 6986.432 ,\n", " 6914.4253 , 6935.685 ],\n", " [ 1650.3838 , 1853.0875 , 2025.124 , ..., 6504.3003 ,\n", " 6350.027 , 6176.655 ],\n", " [ 1954.8159 , 2019.9797 , 1916.7521 , ..., 5647.4995 ,\n", " 5836.5464 , 6040.9556 ]]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45\n", " * time (time) datetime64[ns] 2021-12-22 2021-12-22T01:00:00 ... 2021-12-26\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: ng/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'pm2p5_conc' (day: 5, level: 1, lat: 155, lon: 450)>\n", "array([[[[ 1169.239 , 1166.6467 , 1160.973 , ..., 1441.5961 ,\n", " 1446.9415 , 1449.0151 ],\n", " [ 1173.6224 , 1171.9554 , 1171.7555 , ..., 1428.3876 ,\n", " 1443.7915 , 1446.5171 ],\n", " [ 1181.1288 , 1189.5563 , 1205.5222 , ..., 1435.0128 ,\n", " 1436.0138 , 1443.3612 ],\n", " ...,\n", " [ 9959.0625 , 9706.599 , 10212.829 , ..., 8834.37 ,\n", " 8843.07 , 8738.081 ],\n", " [11996.876 , 11674.386 , 11926.778 , ..., 8548.44 ,\n", " 8362.801 , 8002.9683 ],\n", " [13141.722 , 12680.837 , 12554.7 , ..., 7965.3184 ,\n", " 7982.112 , 7990.6177 ]]],\n", "\n", "\n", " [[[ 1686.1406 , 1708.1188 , 1722.3102 , ..., 1365.6635 ,\n", " 1362.4203 , 1382.3403 ],\n", " [ 1709.118 , 1726.6967 , 1740.0448 , ..., 1310.9231 ,\n", " 1319.0963 , 1326.693 ],\n", " [ 1732.6241 , 1738.5929 , 1748.2808 , ..., 1290.9888 ,\n", "...\n", " 4905.723 , 4991.6763 ],\n", " [ 1478.167 , 1535.4425 , 1637.3916 , ..., 4755.4307 ,\n", " 4620.1465 , 4505.0903 ],\n", " [ 1717.3419 , 1729.2365 , 1662.1465 , ..., 4393.5034 ,\n", " 4420.8423 , 4419.639 ]]],\n", "\n", "\n", " [[[ 1362.0598 , 1371.5527 , 1349.8243 , ..., 2480.518 ,\n", " 2496.761 , 2526.6606 ],\n", " [ 1398.2976 , 1351.3591 , 1315.5477 , ..., 2294.1143 ,\n", " 2327.9363 , 2370.2136 ],\n", " [ 1287.1544 , 1304.108 , 1268.4387 , ..., 2281.4312 ,\n", " 2239.3528 , 2212.153 ],\n", " ...,\n", " [ 1829.8173 , 1892.3165 , 1997.889 , ..., 6986.432 ,\n", " 6914.4253 , 6935.685 ],\n", " [ 1650.3838 , 1853.0875 , 2025.124 , ..., 6504.3003 ,\n", " 6350.027 , 6176.655 ],\n", " [ 1954.8159 , 2019.9797 , 1916.7521 , ..., 5647.4995 ,\n", " 5836.5464 , 6040.9556 ]]]], dtype=float32)\n", "Coordinates:\n", " * lat (lat) float32 69.95 69.85 69.75 69.65 ... 54.85 54.75 54.65 54.55\n", " * level (level) float32 0.0\n", " * lon (lon) float32 -2.45 -2.35 -2.25 -2.15 ... 42.15 42.25 42.35 42.45\n", " * day (day) int64 22 23 24 25 26\n", "Attributes:\n", " species: PM2.5 Aerosol\n", " units: ng/m3\n", " value: hourly values\n", " standard_name: mass_concentration_of_pm2p5_ambient_aerosol_in_air
<xarray.DataArray 'day' (day: 5)>\n", "array([22, 23, 24, 25, 26])\n", "Coordinates:\n", " * day (day) int64 22 23 24 25 26\n", "Attributes:\n", " long_name: FORECAST time from 20211222