Skip to content

Instantly share code, notes, and snippets.

@robintw
Created March 22, 2014 19:38
Show Gist options
  • Save robintw/9713069 to your computer and use it in GitHub Desktop.
Save robintw/9713069 to your computer and use it in GitHub Desktop.
RIOS code which leads to strange offset
import numpy as np
from rios import applier
import tempfile
import subprocess
# Set up the function to be applied
def doMask(info, inputs, outputs, args):
if np.isnan(args.no_data):
outputs.outimage = np.isfinite(inputs.image)
else:
outputs.outimage = (inputs.image != args.no_data)
def create_image_footprint(image_filename, output_filename, no_data):
# Set up input and output filenames.
infiles = applier.FilenameAssociations()
infiles.image = image_filename
outfiles = applier.FilenameAssociations()
outfiles.outimage = output_filename
args = applier.OtherInputs()
args.no_data = no_data
controls = applier.ApplierControls()
controls.setOutputDriverName("GTiff")
# Apply the function to the inputs, creating the outputs.
applier.apply(doMask, infiles, outfiles, args, controls=controls)
create_image_footprint("LE72020252014072EDC00/LE72020252014072EDC00_B1.TIF", "Mask.tif", 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment