horizonangle: Calculates the tangent of the horizon angle

View source: R/solartools.R

horizonangleR Documentation

Calculates the tangent of the horizon angle

Description

horizonangle is used to calculate the tangent of the angle to the horizon in a specified direction.

Usage

horizonangle(dtm, azimuth, reso = 1)

Arguments

dtm

a SpatRaster object, two-dimensional array or matrix of elevations (m). If not a SpatRaster, orientated as if derived from a raster using is_raster(). I.e. ⁠[1, 1]⁠ is the NW corner.

azimuth

a numeric value representing the direction of the horizon as, for example, returned by solazi() (º from north).

reso

a single numeric value representing the spatial resolution of dtm (m).

Details

To enable calculation of horizon angles near the edge of dtm a 100 pixel buffer is of zeros is placed around it. NAs in dtm are converted to zeros. The projection system used must be such that units of x, y and z are identical. Use terra::project() to convert the projection to a Universal Transverse Mercator type projection system. If dtm is a SpatRaster object, a SpatRaster object is returned.

Value

a SpatRaster object or two-dimensional array of numeric values representing the tangent of the angle to the horizon in a specified direction.

Examples

library(terra)
ha <- horizonangle(dtm1m, 0)
plot(ha, main = "Tangent of angle to horizon")

ilyamaclean/microclima documentation built on Sept. 5, 2024, 8:37 p.m.