Math¶
Functions:
arctan2 (y, x) |
Element-wise arc tangent of y/x choosing the quadrant correctly. |
cos (obj) |
Element-wise cosine of an Image or ImageCollection . |
arccos (obj) |
Element-wise inverse cosine of an Image or ImageCollection . |
log (obj) |
Element-wise natural log of an Image or ImageCollection . |
log2 (obj) |
Element-wise base 2 log of an Image or ImageCollection . |
log10 (obj) |
Element-wise base 10 log of an Image or ImageCollection . |
log1p (obj) |
Element-wise log of 1 + an Image or ImageCollection . |
normalized_difference (x, y) |
Normalized difference helper function for computing an index such as NDVI. |
sin (obj) |
Element-wise sine of an Image or ImageCollection . |
arcsin (obj) |
Element-wise inverse sine of an Image or ImageCollection . |
sqrt (obj) |
Element-wise square root of an Image or ImageCollection . |
tan (obj) |
Element-wise tangent of an Image or ImageCollection . |
arctan (obj) |
Element-wise inverse tangent of an Image or ImageCollection . |
exp (obj) |
Element-wise exponential of an Image or ImageCollection . |
square (obj) |
Element-wise square of an Image or ImageCollection . |
-
arctan2
(y, x)[source]¶ Element-wise 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 “y-coordinate” is the first function parameter, the “x-coordinate” 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: [1]y
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]¶ Element-wise 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]¶ Element-wise 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]¶ Element-wise 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]¶ Element-wise 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]¶ Element-wise 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]¶ Element-wise 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="2017-01-01", ... end_datetime="2017-05-30") >>> 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]¶ Element-wise 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]¶ Element-wise 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]¶ Element-wise 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]¶ Element-wise 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]¶ Element-wise 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