Math¶
Functions:

Elementwise arc tangent of 

Elementwise cosine of an 

Elementwise inverse cosine of an 

Elementwise natural log of an 

Elementwise base 2 log of an 

Elementwise base 10 log of an 

Elementwise log of 1 + an 

Normalized difference helper function for computing an index such as NDVI. 

Elementwise sine of an 

Elementwise inverse sine of an 

Elementwise square root of an 

Elementwise tangent of an 

Elementwise inverse tangent of an 

Elementwise exponential of an 

Elementwise square of an 

arctan2
(y, x)[source]¶ Elementwise arc tangent of
y/x
choosing the quadrant correctly.The quadrant (i.e., branch) is chosen so that
arctan2(y, x)
is the signed angle in radians between the ray ending at the origin and passing through the point (1,0), and the ray ending at the origin and passing through the point (x, y). (Note the role reversal: the “ycoordinate” is the first function parameter, the “xcoordinate” is the second.) By IEEE convention, this function is defined for x = +/0 and for either or both of y and x = +/inf (see Notes for specific values).Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(1) >>> wf.arctan2(my_int, my_int).compute() 0.7853981633974483
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(1) >>> img = wf.Image.from_id("landsat:LC08:PRE:TOAR:meta_LC80270312016188_v1").pick_bands("red") >>> wf.arctan2(img, my_int).compute(geoctx) # geoctx is an arbitrary geocontext for 'img' ImageResult: * ndarray: MaskedArray<shape=(1, 512, 512), dtype=float64> * properties: 'acquired', 'area', 'bits_per_pixel', 'bright_fraction', ... * bandinfo: 'red' * geocontext: 'geometry', 'key', 'resolution', 'tilesize', ...
 Parameters
 Returns
x – Angle(s) in radians, in the range
[pi, pi]
, of the type that results from broadcastingy
tox
, (exceptInt
is promoted toFloat
) Return type
Float, Image, ImageCollection
Notes
arctan2 is identical to the
atan2
function of the underlying C library. The following special values are defined in the C standard: 1y
x
arctan2(y,x)
+/ 0
+0
+/ 0
+/ 0
0
+/ pi
> 0
+/inf
+0 / +pi
< 0
+/inf
0 / pi
+/inf
+inf
+/ (pi/4)
+/inf
inf
+/ (3*pi/4)
Note that +0 and 0 are distinct floating point numbers, as are +inf and inf.
References
 1
ISO/IEC standard 9899:1999, “Programming language C.”

cos
(obj)[source]¶ Elementwise cosine of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(0) >>> wf.cos(my_int).compute() 1.0

arccos
(obj)[source]¶ Elementwise inverse cosine of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(0) >>> wf.arccos(my_int).compute() 1.0

log
(obj)[source]¶ Elementwise natural log of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(1) >>> wf.log(my_int).compute() 0.0

log2
(obj)[source]¶ Elementwise base 2 log of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(1) >>> wf.log2(my_int).compute() 0.0

log10
(obj)[source]¶ Elementwise base 10 log of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(1) >>> wf.log10(my_int).compute() 0.0

log1p
(obj)[source]¶ Elementwise log of 1 + an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(1) >>> wf.log1p(my_int).compute() 0.6931471805599453

normalized_difference
(x, y)[source]¶ Normalized difference helper function for computing an index such as NDVI.
Example
>>> import descarteslabs.workflows as wf >>> col = wf.ImageCollection.from_id("landsat:LC08:01:RT:TOAR", ... start_datetime="20170101", ... end_datetime="20170530") >>> nir, red = col.unpack_bands("nir red") >>> # geoctx is an arbitrary geocontext for 'col' >>> wf.normalized_difference(nir, red).compute(geoctx) ImageCollectionResult of length 2: * ndarray: MaskedArray<shape=(2, 1, 512, 512), dtype=float64> * properties: 2 items * bandinfo: 'nir_sub_red_div_nir_add_red' * geocontext: 'geometry', 'key', 'resolution', 'tilesize', ...

sin
(obj)[source]¶ Elementwise sine of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(0) >>> wf.sin(my_int).compute() 0.0

arcsin
(obj)[source]¶ Elementwise inverse sine of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(0) >>> wf.arcsin(my_int).compute() 0.0

sqrt
(obj)[source]¶ Elementwise square root of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(4) >>> wf.sqrt(my_int).compute() 2.0

tan
(obj)[source]¶ Elementwise tangent of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(0) >>> wf.tan(my_int).compute() 0.0

arctan
(obj)[source]¶ Elementwise inverse tangent of an
Image
orImageCollection
.Can also be used with
Int
andFloat
types.Examples
>>> import descarteslabs.workflows as wf >>> my_int = wf.Int(0) >>> wf.arctan(my_int).compute() 0.0