# 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`. `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`. Normalized difference helper function for computing an index such as NDVI. `sin`(obj) Element-wise 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`.
`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).

Parameters
• y (Int, Float, Image, ImageCollection) – y-coordinates

• x (Int, Float, Image, ImageCollection) – x-coordinates

Returns

x – Angle(s) in radians, in the range `[-pi, pi]`, of the type that results from broadcasting `y` to `x`, (except `Int` is promoted to `Float`)

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` or `ImageCollection`.

Can also be used with `Int` and `Float` types.

`log`(obj)[source]

Element-wise natural log of an `Image` or `ImageCollection`.

Can also be used with `Int` and `Float` types.

`log2`(obj)[source]

Element-wise base 2 log of an `Image` or `ImageCollection`.

Can also be used with `Int` and `Float` types.

`log10`(obj)[source]

Element-wise base 10 log of an `Image` or `ImageCollection`.

Can also be used with `Int` and `Float` types.

`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")
>>> nir, red = col.unpack_bands(["nir", "red"])
>>> ndvi = wf.normalized_difference(nir, red)
```
`sin`(obj)[source]

Element-wise sine of an `Image` or `ImageCollection`.

Can also be used with `Int` and `Float` types.

`sqrt`(obj)[source]

Element-wise square root of an `Image` or `ImageCollection`.

Can also be used with `Int` and `Float` types.

`tan`(obj)[source]

Element-wise tangent of an `Image` or `ImageCollection`.

Can also be used with `Int` and `Float` types.