{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Plotting Quantified Data" ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "from astropy import units as u\n", "\n", "import astropy_xarray # noqa: F401\n", "\n", "# to be able to read unit attributes following the CF conventions\n", "# import cf_xarray.units # must be imported before astropy_xarray\n", "u.set_enabled_aliases(\n", " {\n", " \"degK\": u.Kelvin,\n", " \"K\": u.Kelvin,\n", " \"degrees_north\": u.deg,\n", " \"degrees_east\": u.deg,\n", " },\n", ")\n", "\n", "xr.set_options(display_expand_data=False)" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## load the data" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "ds = xr.tutorial.open_dataset(\"air_temperature\")\n", "data = ds.air\n", "data" ] }, { "cell_type": "markdown", "id": "4", "metadata": {}, "source": [ "## quantify the data" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "
xarray.tutorial functions. As such, the units attributes follow the CF conventions, which astropy does not understand by default. To still be able to read them, registry be aliases can be used. For more information, see cf-xarray.\n",
"