grad {meteoEVT}R Documentation

gradient of a scalar field

Description

Calculates the gradient

Usage

grad(
  fld,
  lat = NULL,
  d = 3,
  system = "p",
  rho = NULL,
  dx = 0.25,
  dy = 0.25,
  plev = 5000,
  mode = "lonlat"
)

Arguments

fld

field with dimensions (lon,lat,p)

lat

vector containing latitude

d

scalar for dimension (use d=2 for horizontal gradient and d=3 for 3d-gradient)

system

for type of coordinate system (use 'p' for pressure system and 'z' for height system)

rho

field with dimensions (lon,lat,p) for density or a scalar rho (for constant density)

dx

x resolution in the corresponding unit (e.g. 0.25 degree for ERA5 with mode='lonlat' or e.g. 1000 m in cartesian coordinates with mode='cartesian')

dy

y resolution in the corresponding unit (e.g. 0.25 degree for ERA5 with mode='lonlat' or e.g. 1000 m in cartesian coordinates with mode='cartesian')

plev

a scalar containing the p resolution (if equidistant) or a vector containing pressure levels in Pa (for non-equidistant)

mode

the coordinate system, options are lonlat for a longitude-latitude-grid (default), or cartesian for an equidistant cartesian grid

Value

field containing the gradient with dimension (lon,lat,p,d)

Examples

myfile=system.file("extdata", "era5_storm-zeynep.nc", package = "meteoEVT")
data = readin_era5(myfile)
theta=calc_theta(data$temp,data$lev)
theta_grad=grad(theta,data$lat)

[Package meteoEVT version 0.1.0 Index]