Raster I/O Simplification¶
A set of Python modules which makes it easy to write raster processing code in Python. Built on top of GDAL, it handles the details of opening and closing files, checking alignment of projection and raster grid, stepping through the raster in small blocks, etc., allowing the programmer to concentrate on the processing involved. It is licensed under GPL 3.
""" Reads in two input files and adds them together. Assumes that they have the same number of bands. """ from rios import applier # Set up input and output filenames. infiles = applier.FilenameAssociations() infiles.image1 = "file1.img" infiles.image2 = "file2.img" outfiles = applier.FilenameAssociations() outfiles.outimage = "outfile.img" # Set up the function to be applied def addThem(info, inputs, outputs): """ Function to be called by rios. Adds image1 and image2 from the inputs, and places the result in the outputs as outimage. """ outputs.outimage = inputs.image1 + inputs.image2 # Apply the function to the inputs, creating the outputs. applier.apply(addThem, infiles, outfiles)
See Applier Examples for more information.
conda config --add channels conda-forge conda create -n myenv rios source activate myenv # omit 'source' on Windows