{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Interactive plots with Ipyleaflet" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Overview:\n", "1. Interactively display images from remote map servers with ipyleaflet\n", "2. Overlay gridded data on the interactive map " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Prerequisites\n", "\n", "| Concepts | Importance | Notes |\n", "| --- | --- | --- |\n", "| Contextily | |\n", "| Xarray | |\n", "\n", "* **Time to learn**: 20 minutes\n", "***" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from datetime import datetime\n", "from ipyleaflet import Map, TileLayer, basemaps, basemap_to_tiles\n", "from ipyleaflet.velocity import Velocity\n", "import xarray as xr" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Interactively display images from remote map servers with ipyleaflet" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "While we've made some nice looking maps so far in the course, they are all *static* images ... i.e., they can only be viewed ... not interacted with. Most of us have browsed interactive map-based websites, such as Google Maps, where we can use our mouse or touch-enabled screen to move around, zoom in or out, or otherwise intereact with the plot. The **Javascript** programming language is what makes this interactivity possible. Here, we will use a Python package, [ipyleaflet](https://ipyleaflet.readthedocs.io/en/latest/), as a \"bridge\" to Javascript." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
DataArray objects so we will exploit that here.\n",
"