Skip to contents

This function calculates the geostrophic wind components (ug, vg) from a given geopotential field [lon, lat, lev, time] using the geostrophic wind equations.

Usage

geostrophic_wind(zg, lon, lat, nthreads = 1)

Arguments

zg

geopotential [lon, lat, lev, time] on pressure levels (m^2/s^2).

lon

longitude coordinates [lon] (degrees east).

lat

latitude coordinates [lat] (degrees north).

nthreads

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

Value

A list with two 4D arrays:

  • ug: zonal geostrophic wind [lon, lat, lev, time].

  • vg: meridional geostrophic wind [lon, lat, lev, time].

Details

The derivatives are approximated using finite differences. Grid spacing is computed using Haversine formula.

Examples

data("ERA5_pl")
zg <- ERA5_pl$z
lon <- ERA5_pl$lon
lat <- ERA5_pl$lat

geo_wind <- geostrophic_wind(zg, lon, lat)