Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import rasterio as rio
from sys import argv
from skimage import io
import numpy as np
# Reads an image with a bunch of bands (i.e., layers on the z axis)
# and returns an image with one band, each value in which is the mean
# along the z axis at that x,y.
#!/usr/bin/env python
# simple visualization of the Cb/Cr plane of an image
# python vectorscope.py input.png output.png
# (supports whatever image formats your skimage does)
# bugs include: everything is in painter order
from skimage import io
import numpy as np
from sys import argv
#!/usr/bin/env python
# simple visualization of the Cb/Cr plane of an image
from skimage import io
import numpy as np
from sys import argv
src = io.imread(argv[1])
print src.shape
#!/usr/bin/env python
from astropy.io import fits
from sys import argv
from reproject import reproject_interp
fixed = fits.open(argv[1])[0]
loose = fits.open(argv[2])[0]
array, footprint = reproject_interp(loose, fixed.header, order='bilinear')
#!/usr/bin/env python
from astropy.io import fits
from skimage import io
from sys import argv
io.imsave(
argv[2],
fits.open(argv[1])[0].data
)
<osm version="0.6" generator="CGImap 0.4.0 (1640 thorn-02.openstreetmap.org)" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
<way id="15547913" visible="true" version="19" changeset="38771896" timestamp="2016-04-22T00:55:05Z" user="Charlie Loyd" uid="1414919">
<nd ref="153863499"/>
<nd ref="30186957"/>
<nd ref="153864247"/>
<nd ref="153864236"/>
<nd ref="2292049020"/>
<nd ref="153864157"/>
<nd ref="2292049021"/>
<nd ref="153864144"/>

Hi [redacted],

Some answers for you:

What interested you in composing this image and what does it mean to you.

I work on satellite imagery at Mapbox, so I see a lot of pictures of Earth. I’ve always been interested in the history and culture around the Whole Earth: the image of the sunlit planet floating in space. When the Himawari-8 data started coming out, I tried different things with it, and the most compelling for me was that Whole Earth – what we call a full disk image. Because you get a frame every 10 minutes, you can make a fairly smooth animation, and I wanted to show that off. We don’t get a lot of chances to think about the face of the Earth as something in motion.

As for what it means to me personally, I think of a few things.

#!/usr/bin/env python
# Calculate an ISO 6346 check digit (probably).
# The official algorithm costs about $100 to know.
# By Charlie Loyd, 2008-04-11.
from re import compile as regex
from string import uppercase
def iso6346checksum(code, ten='error'):
'''Call with a string like 'TEXU 328422' and optionally ten=
from __future__ import division
from skbio.diversity.alpha import simpson
import rasterio as rio
from sys import argv
import numpy as np
import affine
scale = 20
#!/usr/bin/env python
# Reeeeallly simple 4:1 un-Bayer for the Chang'e
# mosaicked PNGs posted here:
# http://planetary.s3.amazonaws.com/data/change3/tcam.html
# See also:
# http://www.planetary.org/blogs/emily-lakdawalla/2016/01281656-fun-with-a-new-data-set-change.html
# Usage: python demosaic.py TCAM-[...].png x.png