#!/usr/bin/env python # coding: utf-8 # #
# #
# Unidata Logo #
# # ![under construction](https://images2.minutemediacdn.com/image/upload/c_fit,f_auto,fl_lossy,q_auto,w_728/v1555999902/shape/mentalfloss/under_construction1_0.gif?itok=Pn9g_wu6) # #

xarray: Calculations

#

Unidata AMS 2021 Student Conference

# #
#
# # --- # # Using [xarray](http://xarray.pydata.org/en/stable/), you can perform many of the same calculations as you would with a basic NumPy array, but with the added benefit of name-based rather than position-based dimensions/axes as well as label-based lookups. In this notebook, we'll be demonstrating several of these types of calculations (except for a specific subset of calculations, called aggregations, which combine data together using some summary statistic...these get [their own training notebook](https://nbviewer.jupyter.org/github/Unidata/pyaos-ams-2021/blob/master/notebooks/analysis/xarray_aggregations.ipynb)). # # For a full overview of xarray calculations, see [the relevant page in xarray's documentation](http://xarray.pydata.org/en/stable/computation.html). # #
HTML repr for a basic NetCDF dataset opened with xarray
# # # ### Focuses # # - Show how ufuncs work smoothly on xarray data # - Demonstrate pandas-like missing data calculations # - Learn artithmetic operations take care of dimension broadcasting automatically # - Learn how to wrap custom computations # - Demonstrate using calculations from an external library (xskillscore, for verification statistics) # # ### Objectives # # 1. [...](#1.-Access-local-NetCDF-data) # 1. [...](#2.-Access-remote-OPENDAP-data) # 1. [...](#3.-Access-local-GRIB-data) # # --- # ### Imports # In[ ]: import numpy as np import xarray as xr # --- # ## 1. Section 1 # # ... # In[ ]: ... # Top # # --- # ## 2. Section 2 # # ... # In[ ]: ... # Top # # --- # ## 3. Section 3 # # ... # In[ ]: ... # # Top # # --- # ## See also # # There's a lot more to xarray than just calculations! Be sure to take a look at the other xarray training notebooks linked below: # # - [Xarray data access](https://nbviewer.jupyter.org/github/Unidata/pyaos-ams-2021/blob/master/notebooks/dataAccess/xarray_data_access.ipynb) # - [Indexing with xarray](https://nbviewer.jupyter.org/github/Unidata/pyaos-ams-2021/blob/master/notebooks/analysis/xarray_indexing.ipynb) # - [Interpolation and regridding with xarray](https://nbviewer.jupyter.org/github/Unidata/pyaos-ams-2021/blob/master/notebooks/analysis/xarray_interpolation.ipynb) # - [Xarray aggregation operations](https://nbviewer.jupyter.org/github/Unidata/pyaos-ams-2021/blob/master/notebooks/analysis/xarray_aggregations.ipynb) # - [MetPy with xarray](https://nbviewer.jupyter.org/github/Unidata/pyaos-ams-2021/blob/master/notebooks/analysis/metpy_and_xarray.ipynb) # # Top #