{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"# Introduction\n",
"\n",
"Welcome to the Xarray Tutorial.\n",
"\n",
"Xarray is an open source project and Python package that makes working with\n",
"labelled multi-dimensional arrays simple, efficient, and fun!\n",
"\n",
"Xarray introduces labels in the form of dimensions, coordinates and attributes\n",
"on top of raw [NumPy](https://numpy.org/)-like arrays, which allows for a more\n",
"intuitive, more concise, and less error-prone developer experience. The package\n",
"includes a large and growing library of domain-agnostic functions for advanced\n",
"analytics and visualization with these data structures.\n",
"\n",
"Xarray is inspired by and borrows heavily from\n",
"[pandas](https://pandas.pydata.org/), the popular data analysis package focused\n",
"on labelled tabular data. It is particularly tailored to working with\n",
"[netCDF files](http://www.unidata.ucar.edu/software/netcdf), which were the\n",
"source of Xarrayâ€™s data model, and integrates tightly with\n",
"[Dask](http://dask.org/) for parallel computing.\n",
"\n",
"## Tutorial Setup\n",
"\n",
"This tutorial is designed to run on [Binder](https://mybinder.org/). This will\n",
"allow you to run the turoial in the cloud without any additional setup. To get\n",
"started, simply click\n",
"[here](https://mybinder.org/v2/gh/xarray-contrib/xarray-tutorial/master?urlpath=lab):\n",
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xarray-contrib/xarray-tutorial/master)\n",
"\n",
"If you choose to install the tutorial locally, follow these steps:\n",
"\n",
"1. Clone the repository:\n",
"\n",
" ```\n",
" git clone https://github.com/xarray-contrib/xarray-tutorial.git\n",
" ```\n",
"\n",
"1. Install the environment. The repository includes an `environment.yaml` in the\n",
" `.binder` subdirectory that contains a list of all the packages needed to run\n",
" this tutorial. To install them using conda run:\n",
"\n",
" ```\n",
" conda env create -f .binder/environment.yml\n",
" conda activate xarray\n",
" ```\n",
"\n",
"1. Start a Jupyter session:\n",
"\n",
" ```\n",
" jupyter lab\n",
" ```\n",
"\n",
"## Useful links\n",
"\n",
"1. References\n",
"\n",
"- [Documentation](http://xarray.pydata.org/en/stable/)\n",
"- [Code Repository](https://github.com/pydata/xarray)\n",
"\n",
"1. Ask for help:\n",
"\n",
"- Use the\n",
" [python-xarray](https://stackoverflow.com/questions/tagged/python-xarray) on\n",
" StackOverflow\n",
"- [GitHub Issues](https://github.com/pydata/xarray/issues) for bug reports and\n",
" feature requests\n",
"\n",
"## Tutorial Structure\n",
"\n",
"This tutorial is made up of multiple Jupyter Notebooks. These notebooks mix\n",
"code, text, visualization, and exercises.\n",
"\n",
"If you haven't used JupyterLab before, it's similar to the Jupyter Notebook. If\n",
"you haven't used the Notebook, the quick intro is\n",
"\n",
"1. There are two modes: command and edit\n",
"1. From command mode, press Enter to edit a cell (like this markdown cell)\n",
"1. From edit mode, press Esc to change to command mode\n",
"1. Press shift+enter to execute a cell and move to the next cell.\n",
"1. The toolbar has commands for executing, converting, and creating cells.\n",
"\n",
"The layout of the tutorial will be as follows:\n",
"\n",
"1. [Introduction + Data structures for multi-dimensional data](./01_datastructures_and_io.ipynb)\n",
"1. [Working with labeled data](02_working_with_labeled_data.ipynb)\n",
"1. [Computation with Xarray](03_computation_with_xarray.ipynb)\n",
"1. [Plotting and Visualization](04_plotting_and_visualization.ipynb)\n",
"1. [Introduction to Dask](05_intro_to_dask.ipynb)\n",
"1. [Dask and Xarray](06_xarray_and_dask.ipynb)\n",
"\n",
"## Exercise: Print Hello, world!\n",
"\n",
"Each notebook will have exercises for you to solve. You'll be given a blank or\n",
"partially completed cell, followed by a hidden cell with a solution. For\n",
"example.\n",
"\n",
"Print the text \"Hello, world!\".\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Your code here"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In some cases, the next cell will have the solution. Click the ellipses to\n",
"expand the solution, and always make sure to run the solution cell, in case\n",
"later sections of the notebook depend on the output from the solution.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"print(\"Hello, world!\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Going Deeper\n",
"\n",
"We've designed the notebooks above to cover the basics of Xarray from beginning\n",
"to end. To help you go deeper, we've also create a list of notebooks that\n",
"demonstrate real-world applications of Xarray in a variety of use cases. These\n",
"need not be explored in any particular sequence, instead they are meant to\n",
"provide a sampling of what Xarray can be used for.\n",
"\n",
"### Xarray and Weather/Climate Model Data\n",
"\n",
"1. [Global Mean Surface Temperature from CMIP6](https://binder.pangeo.io/v2/gh/pangeo-gallery/cmip6/binder?urlpath=git-pull?repo=https://github.com/pangeo-gallery/cmip6%26amp%3Burlpath=lab/tree/cmip6):\n",
" Start with `global_mean_surface_temp.ipynb` then feel free to explore the\n",
" rest of the notebooks.\n",
" \n",
"1. [National Water Model Streamflow Analysis](https://aws-uswest2-binder.pangeo.io/v2/gh/rsignell-usgs/esip-gallery/binder?urlpath=git-pull?repo=https://github.com/rsignell-usgs/esip-gallery%26amp%3Burlpath=lab/tree/esip-gallery):\n",
" Start with `02_National_Water_Model.ipynb` then feel free to explore the rest\n",
" of the notebooks.\n",
"\n",
"### Xarray and Satellite Data\n",
"\n",
"1. [Landsat-8 on AWS](https://aws-uswest2-binder.pangeo.io/v2/gh/pangeo-data/landsat-8-tutorial-gallery/master/?urlpath=git-pull?repo=https://github.com/pangeo-data/landsat-8-tutorial-gallery%26amp%3Burlpath=lab/tree/landsat-8-tutorial-gallery/landsat8.ipynb%3Fautodecode)\n",
"\n",
"### Xarray and Baysian Statistical Modeling\n",
"\n",
"1. [Xarray and PyMC3](https://mybinder.org/v2/gh/pymc-devs/pymc3/master?filepath=%2Fdocs%2Fsource%2Fnotebooks):\n",
" Start with `multilevel_modeling.ipynb` then feel free to explore the rest of\n",
" the notebooks. Also checkout [Arviz](https://arviz-devs.github.io/arviz/)\n",
" which uses Xarray as its data model.\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}