{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# plotting quantified data" ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "# to be able to read unit attributes following the CF conventions\n", "import cf_xarray.units # noqa: F401 # must be imported before pint_xarray\n", "import xarray as xr\n", "\n", "import pint_xarray # noqa: F401\n", "from pint_xarray import unit_registry as ureg\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 pint does not understand by default. To still be able to read them we are using the registry provided by cf-xarray.\n",
"