Created
March 22, 2014 19:38
-
-
Save robintw/9713069 to your computer and use it in GitHub Desktop.
RIOS code which leads to strange offset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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