{ "cells": [ { "cell_type": "markdown", "id": "9abc7ae0-1bba-47d8-a1df-17386def470c", "metadata": {}, "source": [ "## Loading data with yt_xarray \n", "\n", "This notebook demonstrates how to initialize a yt dataset object from an open xarray dataset.\n", "\n", "After describing the sample data that is used, the notebook covers:\n", "\n", "* [Loading all fields](#Loading-all-fields)\n", "* [Overview of yt datasets](#A-brief-overview-of-yt-datasets)\n", "* [Loading a subset of fields](#Loading-a-subset-of-fields)\n", "* [Loading method and memory usage](#Loading-method-and-memory-usage)\n", "\n", "\n", "### sample data\n", "\n", "We'll be using some random sample data in this notebook (as well as many of the others), generated from a convenience function, `yt_xarray.sample_data.load_random_xr_data()`. To use it, we have to supply two dictionaries: one containing fieldnames mapped to the dimension names and a second containing the starting value, end value and number of elements for each dimension:\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "9b750bb0-f68d-4765-8860-caeb37f1b2f2", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n",
"Dimensions: (x: 15, y: 10, z: 15)\n",
"Coordinates:\n",
" * x (x) float64 0.0 0.07143 0.1429 0.2143 ... 0.8571 0.9286 1.0\n",
" * y (y) float64 0.0 0.1111 0.2222 0.3333 ... 0.7778 0.8889 1.0\n",
" * z (z) float64 0.0 0.07143 0.1429 0.2143 ... 0.8571 0.9286 1.0\n",
"Data variables:\n",
" temperature (x, y, z) float64 0.7337 0.2377 0.9107 ... 0.3052 0.8424 0.615\n",
" pressure (x, y, z) float64 0.8171 0.6735 0.5087 ... 0.5845 0.2743 0.3072\n",
"Attributes:\n",
" geospatial_vertical_units: m