{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Xarray 4: Remote access"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Overview\n",
"1. Work with a multiple-file Xarray `Dataset` hosted on NCAR's Research Data Archive\n",
"2. Subset the Dataset along its dimensions\n",
"3. Perform unit conversion\n",
"4. Create a well-labeled multi-parameter contour plot of gridded ERA-5 reanalysis data\n",
"\n",
"## Prerequisites\n",
"\n",
"| Concepts | Importance | Notes |\n",
"| --- | --- | --- |\n",
"| Xarray Lessons 1-3| Necessary | |\n",
"\n",
"* **Time to learn**: 30 minutes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Imports"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"import pandas as pd\n",
"import numpy as np\n",
"from datetime import datetime as dt\n",
"from metpy.units import units\n",
"from metpy import calc as mpcalc\n",
"import cartopy.crs as ccrs\n",
"import cartopy.feature as cfeature\n",
"import matplotlib.pyplot as plt\n",
"import requests\n",
"from pathlib import Path"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Work with the ERA-5 Dataset hosted on NCAR's [Remote Data Archive](https://rda.ucar.edu/datasets/ds633.0/#description)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Datasets are ever-growing in terms of size and sheer number. It is not \"remotely\" possible to download every dataset one might want to use to your computer! Fortunately, although Xarray provides easy access to files stored \"locally\" on disk, it can also give you access to files stored on remotely-located servers via different types of *data access protocols*. One such protocol is called **OpenDAP**. It makes files available via a specially-crafted web link, or *URL*. This is how we will access ERA-5 datasets stored on the ERA-5 [RDA's THREDDS server](https://thredds.rda.ucar.edu/thredds/catalog/files/g/ds633.0/catalog.html) data catalog."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
open_mfdataset
, that allows for one Dataset
to be created from multiple sources. However, this may lead to strange errors after we subset the data later in this notebook. This problem seems specific to using open_mfdataset
on file served by THREDDS.\n",
"