PyViz Application

In this notebook, we will create a Dashboard with two HoloViews objects:

  1. a panel pn.widgets.Select object that contains a list of Xarray variables, and

  2. a hvPlot object that takes the selected variable on input.

hvplot

Fig. 10 Python tools for data visualization PyViz.

See also

An in-depth description of the approach quickly presented here is well discussed in a recent paper by Signell & Pothina (2019)1.

Load the required Python libraries

First of all, load the necessary libraries. These are the ones we discussed previously:

  • numpy

  • matplotlib

  • cartopy

  • panel

  • xarray

  • holoviews

  • geoviews

import os
import numpy as np
import xarray as xr

import cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
cartopy.config['data_dir'] = os.getenv('CARTOPY_DIR', cartopy.config.get('data_dir'))

import cmocean

import holoviews as hv
from holoviews import opts, dim

import geoviews as gv
from geoviews import tile_sources as gvts
import geoviews.feature as gf
from cartopy import crs as ccrs

import hvplot.xarray
import panel as pn

import warnings
warnings.filterwarnings("ignore", category=RuntimeWarning) 

gv.extension('bokeh')