Skip to contents

Interpolates 3D gepotential from model levels to pressure levels.

Usage

Vintp_zg(
  ta_ml,
  ps,
  ap_full,
  b_full,
  ap_half,
  b_half,
  orog,
  pl,
  model_levels = "pl",
  hus_ml = NULL,
  nthreads = 1
)

Arguments

ta_ml

air temperature [lon, lat, lev, time] on model levels.

ps

surface pressure [lon, lat, time] (hPa).

ap_full

vertical coordinate formula term ap(k) or a(k) [lev] at layer midpoints (hPa). In case model uses hybrid height coordinates, `ap_full` is hybrid height coordinate (meter).

b_full

vertical coordinate formula term b(k) [lev] at layer midpoints. b(k) is dimensionless fraction. In case model uses hybrid height coordinates, `b_full` is dimensionless fraction.

ap_half

vertical coordinate formula term ap(k) or a(k) [lev+1] at layer interfaces (hPa).

b_half

vertical coordinate formula term b(k) [lev+1] at layer interfaces. b(k) is dimensionless fraction.

orog

surface altitude in meter [lon, lat].

pl

vector of the required pressure levels [plev] e.g., c(1000,950,850) in hPa.

model_levels

Character. Either "pl" for models on hybrid pressure levels or "ml" for models on hybrid height levels.

hus_ml

specific humidity [lon, lat, lev, time] on model levels. It must be provided in case, model data is on hybrid sigma pressure levels.

nthreads

an integer specifying the number of threads to use for computation (OpenMP). Default is 1.

Value

geoptential (m^2/sec^2) on pressure levels [lon, lat, plev, time]

Examples

data("NorESM2_LM")

ta_ml <- NorESM2_LM$ta
hus_ml <- NorESM2_LM$hus
ps <- NorESM2_LM$ps
orog <- NorESM2_LM$orog

a_full <- NorESM2_LM$a * NorESM2_LM$p0
b_full <- NorESM2_LM$b
# half levels
a_half <- NorESM2_LM$a_bnds
b_half <- NorESM2_LM$b_bnds


pl <- seq(1000, 50, -25)
model_levels <- "pl"
nthreads <- 1

res <- Vintp_zg(ta_ml, ps, a_full, b_full,
  a_half, b_half, orog, pl,
  model_levels = "pl",
  hus_ml
)