python4oceanographers

Turning ripples into waves

Olive Bread

Pão de Azeitona

Massa:

  • 30 g fermento biológico
  • 1 colher (sopa) açúcar
  • 4 xícaras (chá) farinha de trigo peneirada
  • 1 xícaras (chá) azeite de oliva
  • 1 xícaras (chá) sal
  • 1 gema para pincelar

Recheio:

  • 200 g azeitonas pretas picadas
  • 200 g azeitonas verdes picadas
  • 2 colheres (sopa) orégano

Modo de ...

Plotting geotiff with cartopy

This post is a quick example on how to read geotiff images with GDAL and plot them with Cartopy.

The image, and most of the code, is from Kelsey Jordahl original notebook. The main difference is that I compressed the geotiff with:

gdal_translate -co "TILED=YES" -co "COMPRESS=JPEG" manhattan ...

Simulating Matlab's compass with mpl

Matlab's compass is a very handy function to plot arrows emanating from an origin. As far as I know matplotlib does not have an equivalent function. However, matplotlib is so versatile that we can build a compass like function very quickly.

We will need a function to convert from ...

Plotting shapefiles with cartopy and folium

First we will use cartopy's shapereader to download (and cache) states shapefile with 50 meters resolution from the NaturalEarth.

In [2]:
from cartopy.io import shapereader


kw = dict(resolution='50m', category='cultural',
          name='admin_1_states_provinces')

states_shp = shapereader.natural_earth(**kw)
shp = shapereader.Reader(states_shp)

Now let's create a list of ...

Calling Fortran from python

It is well known that python work wonders as a "glue language." Together with IPython magic functions we can execute code, push and pull variables, call functions, and even compile code from other languages in the IPython cell.

In previous posts I showed some examples with R, octave and matlab ...

SEAPY is dead, long live SEAPY!

Some time ago I started a website called SEAPY shameless copied from based on WHOI's SEAMAT. However, as any site that contains list of links, it suffered (and badly) from link rot. So here it is, SEAPY is dead, long live SEAPY. I am closing the old google code ...

To Pcolor or not to Pcolor

Matplotlib's pcolor is not like MatlabTM pcolor, and that leads to some confusion. In fact, matplotlib's pcolor is an improved way to "pcolor" things.

Here are some plots to illustrate what I mean. First, some fake data

In [2]:
import numpy as np

data = np.array([[1, 2 ...