coastalTps: Calculates coastal effects using thin-plate spline

View source: R/othertools.R

coastalTpsR Documentation

Calculates coastal effects using thin-plate spline

Description

coastalTps uses thin-plate spline interpolation to estimate the effects of coastal buffering of land-temperatures by the sea.

Usage

coastalTps(dT, lsw, lsa)

Arguments

dT

a coarse-resolution raster of sea - land temperatures (ºC).

lsw

a fine-resolution raster of coastal exposure upwind, as produced by invls().

lsa

a fine-resolution raster of mean coastal exposure in all directions.

Value

a fine-resolution raster of sea - land temperature differences (ºC).

Examples

library(raster)
# =========================================
# Calculate land-sea temperature difference
# =========================================
temp <- tas[,,1]
sst <- 10.665
dT <- if_raster(sst - temp, dtm1km)
# ============================
# Obtain coastal exposure data
# ============================
lsw <- landsearatios[,,7]  # upwind
lsa <- apply(landsearatios, c(1, 2), mean) # mean, all directions
lsw <- if_raster(lsw, dtm100m)
lsa <- if_raster(lsa, dtm100m)
# ==========================================================
# Calculate coastal effects using thin-plate spline and plot
# ==========================================================
dTf <- coastalTps(dT, lsw, lsa)
par(mfrow = c(2, 1))
plot(sst - dT, main = expression(paste("Temperature ",(~degree~C))))
plot(sst - dTf, main = expression(paste("Temperature ",(~degree~C))))

ilyamaclean/microclima documentation built on Oct. 31, 2023, 11:41 p.m.