Skip to content

Instantly share code, notes, and snippets.

View omad's full-sized avatar

Damien Ayers omad

View GitHub Profile
@omad
omad / Shell Output.txt
Created February 18, 2016 00:11
NetCDF4 Python String Attribute Experiments
$ python2 netcdfstringstest.py py2test.nc
$ python3 netcdfstringstest.py py3test.nc
$ ncdump py2test.nc
netcdf py2test {
// global attributes:
string :uni = "Δ" ;
:encoded_uni = "Δ" ;
@omad
omad / SumTileSizes.ipynb
Created January 27, 2016 05:12
Sum ARG25 Tile Sizes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@omad
omad / cli_print_gdal_image.py
Created November 6, 2015 03:59
Output an ASCII representation of a GDAL image to the terminal
import numpy as np
from osgeo import gdal
import warnings
import scipy.ndimage
@click.command(help="Print an image to the terminal ")
@click.option('--size', '-s')
@click.argument('filename', type=click.Path(exists=True, readable=True))
def print_image(filename='', size=50):
"""
@omad
omad / draw_australia.py
Created November 5, 2015 06:38
Example Basemap Drawings
from mpl_toolkits.basemap import Basemap
import mpl_toolkits.basemap.pyproj as pyproj
import matplotlib.pyplot as plt
import numpy as np
# make sure the value of resolution is a lowercase L,
# for 'low', not a numeral 1
map = Basemap(projection='ortho', lat_0=-30, lon_0=130,
resolution='l', area_thresh=1000.0)
@omad
omad / replace_files.py
Created May 5, 2014 12:13
Replace corrupted images that were imported into Lightroom, with originals from a memory stick.
#!/usr/bin/env python
#
# Damien Ayers 2014
#
# Replace corrupted images that were imported into Lightroom, with originals from a memory stick.
#
# Walk through a target directory structure of possibly corrupted files, and replace them
# with files from a source directory. Files in the source may be at completely different
# relative paths, but will have the same file name.
#