ray_source: Calculate the Rossby waves ray paths over a source region

View source: R/ray_source.R

ray_sourceR Documentation

Calculate the Rossby waves ray paths over a source region

Description

ray_source returns the Rossby wave ray paths (lat/lon) triggered from one or more initial source/position (x0, y0), one or more total wavenumber (K), and one or more direction set up when invoking the function. ray_source must ingest the meridional gradient of the absolute vorticity in mercator coordinatesbetam, the zonal mean wind u, and the latitude vector (lat). Those variables can be obtained (recommended) using betaks function. The zonal means of the basic state will be calculated along the ray program, as well as the conversion to mercator coordinates of u. The resultant output is a spatial feature object from a combination of initial and final positions/sources, total wavenumbers (K), and directions.

Usage

ray_source(
  betam,
  u,
  lat,
  x0,
  y0,
  K,
  cx,
  dt,
  itime,
  direction,
  interpolation = "trin",
  tl = 1,
  a = 6371000,
  verbose = FALSE,
  ofile
)

Arguments

betam

matrix (longitude = rows x latitude from minor to major = columns) obtained with betaks. betam is the meridional gradient of the absolute vorticity in mercator coordinates

u

matrix (longitude = rows x latitude from minor to major = columns) obtained with betaks. Is the zonal wind speed in the appropriate format for the ray. It will be converted in mercator coordinates inside the ray

lat

Numeric vector of latitudes from minor to major (ex: -90 to 90). Obtained with betaks

x0

Vector with the initial longitudes (choose between -180 to 180)

y0

Vector with the initial latitudes

K

Vector; Total Rossby wavenumber

cx

numeric. Indicates the zonal phase speed. The program is designed for eastward propagation (cx > 0) and stationary waves (cx = 0, the default).

dt

Numeric value; Timestep for integration (hours)

itime

Numeric value; total integration time. For instance, 10 days times 4 times per day

direction

Vector with two possibilities: 1 or -1 It controls the wave displacement: If 1, the wave goes to the north of the source; If -1, the wave goes to the south of the source.

interpolation

Character. Set the interpolation method to be used: trin or ypos

tl

Numeric value; Turning latitude. Do not change this! It will always start with a positive tl (1) and automatically change to negative (-1) after the turning latitude.

a

Earth's radio (m)

verbose

Boolean; if TRUE (default) return messages during compilation

ofile

Character; Output file name with .csv extension, for instance, "/user/ray.csv"

Value

sf data.frame

Examples

## Not run: 
#do not run
input <- system.file("extdata",
                     "uwnd.mon.mean_200hPa_2014JFM.nc",
                      package = "raytracing")
b <- betaks(u = input)
rt <- ray_source(betam = b$betam,
                 u = b$u,
                 lat = b$lat,
                 K = 3,
                 itime = 10*4,
                 cx = 0,
                 x0 = -c(130, 135),
                 y0 = -30,
                 dt = 6,
                 direction = -1,
                 interpolation = "trin")

# Plot:
data(coastlines)
plot(coastlines,
     reset = FALSE,
     axes = TRUE,
     graticule = TRUE,
     col = "grey",
     main = "Coelho et al. (2015): JFM/2014")
plot(rt[sf::st_is(rt, "LINESTRING"),]["lon_ini"],
     add = TRUE,
     lwd = 2,
     pal = colorRampPalette(c("black", "blue")))

## End(Not run)

raytracing documentation built on June 7, 2022, 1:09 a.m.