Skip to content

Instantly share code, notes, and snippets.

@celoyd
celoyd / ml.md
Last active November 30, 2017 20:24

Work in progress – check back for a more final draft.

A written introduction to convolutional neural networks

This is not meant to be the only outline you read. It’s meant to fill in gaps that others left for me.

A sample problem

Let’s suppose we’re trying to tell sunflowers from tulips in pictures. Suppose every image is grayscale, with 10,000 pixels, with each pixel in the range 0..1.

@celoyd
celoyd / # gdal2 - 2017-08-25_16-05-49.txt
Created August 25, 2017 23:06
gdal2 (osgeo/osgeo4mac/gdal2) on macOS 10.12.6 - Homebrew build logs
Homebrew build logs for osgeo/osgeo4mac/gdal2 on macOS 10.12.6
Build date: 2017-08-25 16:05:49
@celoyd
celoyd / # gdal2 - 2017-08-25_15-56-21.txt
Created August 25, 2017 22:56
gdal2 (osgeo/osgeo4mac/gdal2) on macOS 10.12.6 - Homebrew build logs
Homebrew build logs for osgeo/osgeo4mac/gdal2 on macOS 10.12.6
Build date: 2017-08-25 15:56:21
@celoyd
celoyd / # gdal2 - 2017-08-25_15-44-45.txt
Created August 25, 2017 22:48
gdal2 (osgeo/osgeo4mac/gdal2) on macOS 10.12.6 - Homebrew build logs
Homebrew build logs for osgeo/osgeo4mac/gdal2 on macOS 10.12.6
Build date: 2017-08-25 15:44:45

Getting GSOD

0. Introduction

00: What’s in this guide?

This is a discursive recipe for turning the Global Summary of the Day weather dataset into a useful PostgreSQL database on a Unix system. It's aimed at data nerds with no prior knowledge of GSOD. For simplicity, it only describes one way of doing things, but the canny reader will see many possible variations (for example, using staged temporary files rather than a pipeline to do data conversion) and substitutions (mysql for postgres, curl for wget, perl for python, …).

Depending on how you do things, you’ll need something like 50 free gigabytes of disk space to work in, and the final database will use about 20 gigabytes.

# python pca_multiband.py input.jpeg output.tif
# n-band image -> PCA -> n-band TIFF image
# with lots of hackety assumptions
# (e.g., output is same type as input)
from sys import argv
import rasterio as rio
import numpy as np
from sklearn import decomposition
# python pca_multiband.py input.jpeg output.tif
# n-band image -> PCA -> n-band TIFF image
# with lots of hackety assumptions
# (e.g., output is same type as input)
from sys import argv
import rasterio as rio
import numpy as np
from sklearn import decomposition
@celoyd
celoyd / soda.md
Last active October 10, 2016 20:20
Re: Tell Politicians What They Should Focus On

Hi.

On Oct 7, 2016, at 11:31 AM, No on HH Research Team [email protected] wrote:

If you’re the research team, why are you doing advocacy? What’s the communications team doing right now?

Dear Neighbor,

🤔 Are we neighbors? I would say my neighbors are people close enough that I would walk to visit them. This feels like false intimacy. Why not tell me where you are?

#!/usr/bin/env python
import numpy as np
import cv2
from sys import argv
# Gaussian radius (should really be an argument):
r = 21
src, dst = argv[1:]
#!/usr/bin/env python
import rasterio as rio
from sys import argv, exit
from skimage import io
import numpy as np
from math import pi, radians
def px_to_rad(n):
return n / 200.0 # 1 px = 5 mrad