Skip to content

Instantly share code, notes, and snippets.

View omad's full-sized avatar

Damien Ayers omad

View GitHub Profile
@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.
#
@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 / 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 / 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 / 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 / Interactive PQ.ipynb
Created August 23, 2016 03:33
notebooks/Interactive PQ.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@omad
omad / shuffle.html
Created February 24, 2017 03:54
Shuffle Tabular Rows
<html>
<head>
<title></title>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<h1>Shuffle Table</h1>
<ol>
<li>Copy your selection from Excel into the text area below</li>
<li>Press the shuffle button. (go on, press it a few times if you want)</li>
@omad
omad / Find matching date in Pandas Dataframe.ipynb
Created February 27, 2017 20:31
Find matching date in Pandas Dataframe.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@omad
omad / ls7_nbar_albers_dataset.json
Created March 16, 2017 03:12
Example Datacube Datasets
{
"lineage": {
"machine": {
"software_versions": {
"python": {
"version": "3.5.3 | packaged by conda-forge | (default, Feb 9 2017, 14:37:12) \n[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]"
},
"datacube": {
"version": "1.2.2",
"repo_url": "https://github.com/data-cube/agdc-v2.git"
@omad
omad / Daily Polygon DataCube Visualisation.ipynb
Created March 29, 2017 06:15
Daily Polygon DataCube Visualisation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.