Package osgeo :: Package utils :: Module gdal_calc
[hide private]
[frames] | no frames]

Module gdal_calc

source code

Functions [hide private]
 
DoesDriverHandleExtension(drv, ext) source code
 
GetExtension(filename) source code
 
GetOutputDriversFor(filename) source code
 
GetOutputDriverFor(filename) source code
 
doit(opts, args) source code
 
Calc(calc, outfile, NoDataValue=None, type=None, format=None, creation_options=None, allBands='', overwrite=False, debug=False, quiet=False, **input_files)
Perform raster calculations with numpy syntax.
source code
 
store_input_file(option, opt_str, value, parser) source code
 
add_alpha_args(parser, argv) source code
 
main(argv) source code
Variables [hide private]
  AlphaList = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J",...
  DefaultNDVLookup = {'Byte': 255, 'UInt16': 65535, 'Int16':-327...
Function Details [hide private]

Calc(calc, outfile, NoDataValue=None, type=None, format=None, creation_options=None, allBands='', overwrite=False, debug=False, quiet=False, **input_files)

source code 
Perform raster calculations with numpy syntax.
Use any basic arithmetic supported by numpy arrays such as +-* along with logical
operators such as >. Note that all files must have the same dimensions, but no projection checking is performed.

Keyword arguments:
    [A-Z]: input files
    [A_band - Z_band]: band to use for respective input file

Examples:
add two files together:
    Calc("A+B", A="input1.tif", B="input2.tif", outfile="result.tif")

average of two layers:
    Calc(calc="(A+B)/2", A="input1.tif", B="input2.tif", outfile="result.tif")

set values of zero and below to null:
    Calc(calc="A*(A>0)", A="input.tif", A_band=2, outfile="result.tif", NoDataValue=0)

work with two bands:
    Calc(["(A+B)/2", "A*(A>0)"], A="input.tif", A_band=1, B="input.tif", B_band=2, outfile="result.tif", NoDataValue=0)


Variables Details [hide private]

AlphaList

Value:
["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",\
 "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]

DefaultNDVLookup

Value:
{'Byte': 255, 'UInt16': 65535, 'Int16':-32767, 'UInt32': 4294967293, '\
Int32':-2147483647, 'Float32': 3.402823466E+38, 'Float64': 1.797693134\
8623158E+308}