Adafruit GPS with a Pro Mini 3v3 8MHz

The default 9600 baud rate is a little too fast for the 8MHz clock speed of the Pro Mini 3v3 when using a software serial connection. This can result in invalid data being received from the GPS.

Adafruit GPS with Pro Mini 3v3 8MHz

NMEA messages include a basic checksum to ensure the message was received correctly ...

Continue reading »

XKCD + Google Trends, 5 Years Later

Back in 2012 XKCD #1043 presented data from Google Trends, predicting that searches for "tumblr" would overtake "blog" on 12th October 2012:

Plus the reaction in the Tumblverse is always 'repeatedly get hit by a dog and fall down the stairs'.

Fast-forward to present (2017) and we can see the prediction was a good, with "tumblr" overtaking "blog" sometime between October and November:

https://trends.google.co.uk/trends ...

Continue reading »

Sorted Open Data (Part 2) with D3

This post is Part 2 of a series. See Part 1: Sorted Open Data with Shapely and SVG.

Continue reading »

Sorted Open Data with Shapely and SVG

I recently came across the Sorted Cities project by Hans Hack. He uses building footprint data extracted from OpenStreetMap to create beautiful posters, showing all of the buildings in a city sorted by their area.

As soon as I saw this, the hacker in me thought "how would I go about creating this myself?"

Continue reading »

Fun with emoji

Despite being somewhat late to the party 🎉, this week I've been having fun with emoji 😂. Emoji are just unicode characters, which means as well as being easy to send in text messages they can also turn up in places you might not expect.

For example, emoji are correctly displayed ...

Continue reading »

Compiling Python extensions for old glibc versions

I'm a big fan of the Anaconda Python distribution. It makes managing multiple Python environments on different operating systems easy (at least in theory).

I recently came across an issue trying to import a Cython extension I'd built for Linux on a different machine. We'd be testing ...

Continue reading »

Masking NetCDF datasets using Rasterio

This post brings a couple of ideas from previous posts together, namely downloading data using NetCDF and masking raster layers with vector data.

The end result is the ability to query raster datasets using irregular shapes and only download the data you actually need.

Continue reading »

Pickling Cython classes

Automatic pickle support in Cython is still a pending feature. In order to support pickling of cdef classes you must implement the pickle protocol. This is done by implementing the __getstate__ and __setstate__ methods. Although the official documentation is quite clear, it lacks a simple example and also instruction on ...

Continue reading »

Do I Need An Umbrella Today?

A few years ago I came across Umbrella Today. The site had a simple function, providing a weather forecast with only one variable: is it going to rain today? Enter your zip code and you get a Yes-No answer to the question. The simplicity of this appealed to me. Although ...

Continue reading »

Splitting large polygons for faster intersections

Large polygons are a problem for geoprocessing operations. Intersections involving large polygons are slow because the entire geometry needs to be evaluated. In addition to this, spatial indexing doesn't help (much) because the bounding box of the polygon is itself large.

This is a common problem with flood extent ...

Continue reading »