
Supported expression operators are listed in the following table. Only the intersection of unmasked pixelsĪre considered and returned as unmasked when bands from more than one source image areĮvaluated. To change this behavior, multiply one of the operands byġ.0: 10 * 1.0 / 20 = 0.5.

Note that expression() uses "floor division", whichĭiscards the remainder and returns an integer when two integers are divided. Bands can be defined from images other than the input when using Bands in the image may be referred to as b("band name") or In the expression and the values are the image bands to which the variables should be The math operation, the second argument is a dictionary where the keys are variable names used Observe that the first argument to expression() is the textual representation of Var diff = landsat2008.subtract(landsat1999) previously loaded 1999-2003 composite. Compute multi-band difference between the 2008-2012 composite and the The following example of multi-band image subtraction demonstrates how bands are matchedĪutomatically, resulting in a “change vector” for each pixel for each co-occurring band.Ĭode Editor (JavaScript) // Load a 5-year Landsat 7 composite 2008-2012. The type of the output pixels is the union of the input types. Output bands are named for the longer of the two inputs, or if they're equal in length, in theįirst input's order. Number of bands, but not the same names, they're used pairwise in the natural order. One band, then it is used against all the bands in the other input. Only the intersection of unmasked pixels between the two inputs areĬonsidered and returned as unmasked, all else are masked. divide(landsat_lect('B4').add(landsat_lect('B3')))) Note: the normalized difference operation is available as a shortcut method:

#Field math illustrations code#
Code Editor (JavaScript) // Load a 5-year Landsat 7 composite 1999-2003.
