Introduction

HoloCube is a Python library that makes it easy to explore and visualize geographical, meterological, oceanographic, and other multidimensional gridded datasets. HoloCube interfaces between the HoloViews library for flexible visualizations of multidimensional data, the Iris library for storing and processing climate and weather data, and the Cartopy library for working with cartographic projections and visualizations in Matplotlib. Specifically, HoloCube:

  1. Extends HoloViews objects to allow them to use data stored in Iris cubes. After import holocube, data can be provided to any Holoviews Element directly as a cube, without needing to first convert into one of the other supported formats (NumPy arrays, Pandas data frames, etc.). This support is independent of the other support below -- data from Iris cubes can be used even in non-geographic Elements, and most geographic Elements can accept data in any format.

  2. Adds a set of new HoloViews Elements that have an associated geographic projection (GeoElements), based on cartopy.crs. These currently include GeoFeature, WMTS, GeoTiles, Points, Contours, Image, and Text objects, each of which can easily be overlaid in the same plots. E.g. an object with temperature data can be overlaid with coastline data using an expression like Image(temp_cube)*hc.GeoFeature(cartopy.feature.COASTLINE). Each GeoElement can also be freely combined in layouts with any other HoloViews Element, making it simple to make even complex multi-figure layours.

With HoloCube, you can now work easily and naturally with large, multidimensional datasets, instantly visualizing any subset or combination of them, while always being able to access the raw data underlying any plot. Here's a simple example:

In [1]:
import holoviews as hv
import holocube as hc
from cartopy import crs
from cartopy import feature as cf

hv.notebook_extension()
HoloViewsJS successfully loaded in this cell.
In [2]:
%%opts GeoFeature [projection=crs.Geostationary()]

coasts  = hc.GeoFeature(cf.COASTLINE)
borders = hc.GeoFeature(cf.BORDERS)
ocean   = hc.GeoFeature(cf.OCEAN)

ocean + borders + (ocean*borders).relabel("Overlay")
Out[2]:

The following example loads a cube from iris-sample-data and displays it as follows:

In [3]:
import iris
surface_temp = iris.load_cube(iris.sample_data_path('GloSea4', 'ensemble_001.pp'))
print surface_temp.summary()
surface_temperature / (K)           (time: 6; latitude: 145; longitude: 192)
     Dimension coordinates:
          time                           x            -               -
          latitude                       -            x               -
          longitude                      -            -               x
     Auxiliary coordinates:
          forecast_period                x            -               -
     Scalar coordinates:
          forecast_reference_time: 2011-07-18 00:00:00
     Attributes:
          STASH: m01s00i024
          source: Data from Met Office Unified Model
          um_version: 7.6
     Cell methods:
          mean: time (1 hour)

With HoloViews, you can quickly view the data in the cube interactively:

In [4]:
%%opts GeoImage [colorbar=True] (cmap='viridis')
(hc.HoloCube(surface_temp).groupby(['time'], group_type=hc.Image) * hc.GeoFeature(cf.COASTLINE))
Out[4]:

This website is still under construction but you can get a taste of what is to come in our first tutorial.

Installation

See the github repo for installation instructions and to get started with the examples.


Support

HoloCube was developed through a collaboration between Continuum Analytics and the Met Office. HoloCube is completely open source, available under a BSD license freely for both commercial and non-commercial use. Please file bug reports and feature requests on our github site.