globe: Globe temperature

globeR Documentation

Globe temperature

Description

Globe temperatures (Tg, Tnwb, WBGT).

The can be computed for either a data.frame or a SpatRasterDataset. These must have variables "temp" (C), "rhum" (%), "wind" (m s-1), and "srad" (J s-1 m-2). The data.frame must also have a variable "date".

Usage

## S4 method for signature 'data.frame'
Tg(x, latitude)
## S4 method for signature 'SpatRasterDataset'
Tg(x, filename="", overwrite=FALSE, ...)

## S4 method for signature 'data.frame'
Tnwb(x, latitude, kelvin=FALSE)
## S4 method for signature 'SpatRasterDataset'
Tnwb(x, kelvin=FALSE, filename="", overwrite=FALSE, ...)

## S4 method for signature 'data.frame'
WBGT(x, latitude, kelvin=FALSE)
## S4 method for signature 'SpatRasterDataset'
WBGT(x, kelvin=FALSE, mask=NULL, filename="", overwrite=FALSE, ...)

Arguments

x

data.frame or SpatRasterDataset

latitude

numeric

filename

character. Output filename

overwrite

logical. If TRUE, filename is overwritten

...

additional arguments for writing files as in writeRaster

kelvin

logical. Set to TRUE of the units of temperature are in Kelvin

mask

NULL of SpatRaster. if a SpatRaster is used, it should have one layer. No computations are done for cells that are NA, and these are set to NA in the output

Value

numeric or SpatRaster

Examples

wd <- data.frame(date=as.Date("2003-08-28") + 1:3, 
		temp=c(19.1, 20.6, 19.4), 
		rhum=c(66,71,73), 
		wind=c(3.3, 1.9, 1.1), 
		srad=c(168, 178, 125))
Tg(wd, 40.96) 

Tnwb(wd, 40.96) 

WBGT(wd, 40.96) 


library(terra)
r <- rast(ncol=2, nrow=2, nlyr=1)
temp <- setValues(r, 21:24)
time(temp) <- as.Date("2000-01-01")
rhum <- setValues(r, 81:84)
wind <- setValues(r, 9:12)
srad <- setValues(r, 100:103)
s <- sds(list(temp=temp, rhum=rhum, wind=wind, srad=srad))

x <- Tg(s)
y <- WBGT(s)

meteor documentation built on July 26, 2023, 5:16 p.m.