1gdal_calc(1) General Commands Manual gdal_calc(1)
2
3
4
6 gdal_calcCommand line raster calculator with numpy syntax.
7
9 gdal_calc.py --calc=expression --outfile=out_filename [-A filename]
10 [--A_band=n] [-B...-Z filename] [other_options]
11
12 Options:
13 -h, --help show this help message and exit
14 --calc=expression calculation in gdalnumeric syntax using +-/* or any
15 numpy array functions (i.e. log10())
16 -A filename input gdal raster file, you can use any letter (A-Z)
17 --A_band=n number of raster band for file A (default 1)
18 --outfile=filename output file to generate or fill
19 --NoDataValue=value output nodata value (default datatype specific value)
20 --type=datatype output datatype, must be one of ['Int32', 'Int16',
21 'Float64', 'UInt16', 'Byte', 'UInt32', 'Float32']
22 --format=gdal_format GDAL format for output file
23 --creation-option=option, --co=option
24 Passes a creation option to the output format driver.
25 Multiple options may be listed. See format specific
26 documentation for legal creation options for each
27 format.
28 --allBands=[A-Z] process all bands of given raster (A-Z)
29 --overwrite overwrite output file if it already exists
30 --debug print debugging information
31 --quiet suppress progress messages
32
34 Command line raster calculator with numpy syntax. Use any basic
35 arithmetic supported by numpy arrays such as +-*\ along with logical
36 operators such as >. Note that all files must have the same dimensions,
37 but no projection checking is performed.
38
40 add two files together
41
42 gdal_calc.py -A input1.tif -B input2.tif --outfile=result.tif --calc="A+B"
43
44
45 average of two layers
46
47 gdal_calc.py -A input.tif -B input2.tif --outfile=result.tif --calc="(A+B)/2"
48
49
50 set values of zero and below to null
51
52 gdal_calc.py -A input.tif --outfile=result.tif --calc="A*(A>0)" --NoDataValue=0
53
54
56 Chris Yesson <chris dot yesson at ioz dot ac dot uk> Etienne Tourigny
57 <etourigny dot dev at gmail dot com>
58
59
60
61GDAL Thu Jul 25 2019 gdal_calc(1)