atan2: Two argument arc-tangent

Description Usage Arguments See Also Examples

Description

For Raster* objects x and y, atan2(y, x) returns the angle in radians for the tangent y/x, handling the case when x is zero. See Trig

See Math-methods for other trigonometric and mathematical functions that can be used with Raster* objects.

Usage

1
atan2(y, x) 

Arguments

y

Raster* object

x

Raster* object

See Also

Math-methods

Examples

1
2
3
4
r1 <- r2 <- raster(nrow=10, ncol=10)
values(r1) <- (runif(ncell(r1))-0.5) * 10
values(r2) <- (runif(ncell(r1))-0.5) * 10
atan2(r1, r2)

Example output

Loading required package: sp
class      : RasterLayer 
dimensions : 10, 10, 100  (nrow, ncol, ncell)
resolution : 36, 18  (x, y)
extent     : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +no_defs 
source     : memory
names      : layer 
values     : -2.945838, 3.111986  (min, max)

raster documentation built on Jan. 5, 2021, 3:01 a.m.