invls: Calculates land to sea ratio in upwind direction

View source: R/othertools.R

invlsR Documentation

Calculates land to sea ratio in upwind direction

Description

invls is used to calculate an inverse distance2 weighted ratio of land to sea in a specified upwind direction.

Usage

invls(landsea, e, direction)

Arguments

landsea

A SpatRast object with NAs (representing sea) or any non-NA value (representing land). The object should have a larger extent than that for which land-sea ratio values are needed, as the calculation requires land / sea coverage to be assessed upwind outside the target area.

e

an terra::ext object indicating the region for which land-sea ratios are required.

direction

an optional single numeric value specifying the direction (decimal degrees) from which the wind is blowing.

Details

This function calculates a coefficient of the ratio of land to sea pixels in a specified upwind direction, across all elements of a SpatRaster object, weighted using an inverse distance squared function, such that nearby pixels have a greater influence on the coefficient. It returns a SpatRaster object representing values ranging between zero (all upwind pixels sea) to one (all upwind pixels land). Upwind direction is randomly varied by ± jitter.amount degrees.

Value

a SpatRaster object with distance-weighted proportions of upwind land pixels

Examples

library(terra)
ls1 <- invls(rast(dtm100m), ext(rast(dtm1m)), 180)
ls2 <- invls(rast(dtm100m), ext(rast(dtm1m)), 270)
par(mfrow=c(2,1))
plot(ls1, main = "Land to sea weighting, southerly wind")
plot(ls2, main = "Land to sea weighting, westerly wind")

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