Skip to contents

Interpolates 3D specific humidity from model levels to pressure levels.

Usage

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

Arguments

hus_ml

specific humidity [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). It must be provided in case, model uses hybrid height levels.

b_half

vertical coordinate formula term b(k) [lev+1] at layer interfaces. b(k) is dimensionless fraction. It must be provided in case, model uses hybrid height levels.

model_levels

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

pl

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

orog

surface altitude in meter [lon, lat]. It must be provided in case, model uses hybrid height levels.

ta_ml

temperature on model levels [lon, lat, lev, time]. It must be provided in case, model uses hybrid height levels.

nthreads

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

Value

specific humidity [lon, lat, plev, time] on pressure levels.

Examples

data("NorESM2_LM")
ap_full <- NorESM2_LM$a * NorESM2_LM$p0
res <- Vintp_hus(
  hus_ml = NorESM2_LM$hus,
  ps = NorESM2_LM$ps / 100,
  ap_full = ap_full / 100,
  b_full = NorESM2_LM$b,
  model_levels = "pl",
  pl = seq(1000, 50, -25),
  nthreads = 1
)