Turning ripples into waves

Optimizing code for iso-surfaces using Fortran, Cython, and Numba

A very common operation for ocean modelers is to extract an iso-surface from 3D the model results. The application ranges from fancy isopycnals 3D views to simply getting any variable sliced at some arbitrary depth.

In this post I will explore a few different ways compute iso-surfaces. First we have ...

Using get_variables_by_attributes with xray

In my last post I showed the new get_variables_by_attributes method that will be available in netCDF4-python 1.2.0. But what if you want to use that now? You can just copy the method as a local function and change the self argument to take the the netCDF4.Dataset (nc ...

netCDF4 python and the get_variables_by_attributes

netCDF-Java users like to brag about the Get by Attribute method in the Java version of the netCDF library. This method allow the user to query for using the information in the variable attribute. That is much better than browsing the all variables names to find what you need. I ...

Iris "hidden" feature

I had to create a figure showing the data used to create the World Ocean Atlas climatology (WOA). WOA has that information in each file already, so that part was easy. Let's check the metadata:

In [3]:
import iris

url = (' ...

Beer Cake



  • 250 g butter
  • 1 cup of pilsen/larger beer
  • 250 g flour
  • 1 cup cocoa
  • 1 3/4 teaspoon baking powder
  • 1/2 teaspoon salt
  • 1 teaspoon sodium bicarbonate
  • 2 eggs
  • 2 teaspoon vanilla extract


  • 400 g cream cheese
  • 2 teaspoon vanilla extract
  • 1 cup of butter ...

Three ways to make a choropleth

Making choropleths is fun. I will leave at that! Want more explanation? Follow this link.

In this post I will show three way to create choropleths with Python. The Good, the Bad and the Ugly (or in the original: Il buono, il brutto, il cattivo)!

The Ugly: geopandas

Choropleths with ...

Masking land/ocean with shapely

A common task when plotting data on a map (or reduce the number of points in KDTree search ;-) is to mask either the land or the oceanic part of the data. In this post I will show how to do mask land using a shapefile and shapely.

Let's start ...

Reading GPX files directly with fiona

In a previous post I said I would try to build a GPX loader for GeoPandas. If you try to load a GPX file right now this is what you get.

In [3]:
import geopandas as gpd

fname = './data/2014_08_05_farol.gpx'

gdf = gpd.read_file(fname)

Ouch! Not ...