rxtracto: Extract environmental data along a trajectory from an...

View source: R/rxtracto.R

rxtractoR Documentation

Extract environmental data along a trajectory from an 'ERDDAP' server using 'rerddap'.

Description

rxtracto_new uses the R program 'rerddap' to extract environmental data from an 'ERDDAP' server along a (x,y,z, time) trajectory.

Usage

rxtracto(
  dataInfo,
  parameter = NULL,
  xcoord = NULL,
  ycoord = NULL,
  zcoord = NULL,
  tcoord = NULL,
  xlen = 0,
  ylen = 0,
  zlen = 0,
  xName = "longitude",
  yName = "latitude",
  zName = "altitude",
  tName = "time",
  interp = NULL,
  verbose = FALSE,
  progress_bar = FALSE
)

Arguments

dataInfo

- the return from an 'rerddap::info' call to an 'ERDDAP' server

parameter

- character string containing the name of the parameter to extract

xcoord

- a real array with the x-coordinates of the trajectory (if longitude in #' decimal degrees East, either 0-360 or -180 to 180)

ycoord

- a real array with the y-coordinate of the trajectory (if latitude in decimal degrees N; -90 to 90)

zcoord

-a real array with the z-coordinate of the trajectory (usually altitude or depth)

tcoord

- a character array with the times of the trajectory in "YYYY-MM-DD" - for now restricted to be time.

xlen

- real array defining the longitude box around the given point (xlen/2 around the point)

ylen

- real array defining the latitude box around the given point (ylen/2 around the point)

zlen

- real array defining the depth or altitude box around the given point (zlen/2 around the point)

xName

- character string with name of the xcoord in the 'ERDDAP' dataset (default "longitude")

yName

- character string with name of the ycoord in the 'ERDDAP' dataset (default "latitude")

zName

- character string with name of the zcoord in the 'ERDDAP' dataset (default "altitude")

tName

- character string with name of the tcoord in the 'ERDDAP' dataset (default "time")

interp

- array (size 2) of character strings - c(interpolation type, neighborhood) Uses the new ERDDAP interpoation option to get values See Vignette for details Default is Null, do not use the interpolation option

verbose

- logical variable (default FALSE) if the the URL request should be verbose

progress_bar

- logical variable (default FALSE) should a progress bar be displayed

Value

If success a dataframe containing:

  • column 1 = mean of data within search radius

  • column 2 = standard deviation of data within search radius

  • column 3 = number of points found within search radius

  • column 4 = time of returned value

  • column 5 = min longitude of call (decimal degrees)

  • column 6 = max longitude of call (decimal degrees)

  • column 7 = min latitude of call (decimal degrees)

  • column 8 = max latitude of call (decimal degrees)

  • column 9 = requested time in tag

  • column 10 = median of data within search radius

  • column 11 = median absolute deviation of data within search radius

else an error string

Examples

## toy example to show use
## but keep execution time down
##
# dataInfo <- rerddap::info('erdHadISST')
##
parameter <- 'sst'
xcoord <- c(-130.5)
ycoord <- c(40.5)
tcoord <- c('2006-01-16')
# extract <- rxtracto(dataInfo, parameter = parameter, xcoord = xcoord,
#                   ycoord = ycoord, tcoord= tcoord
#                   )
##
## bathymetry example
## 2-D example getting bathymetry
dataInfo <- rerddap::info('etopo360')
parameter <- 'altitude'
# extract <- rxtracto(dataInfo, parameter, xcoord = xcoord, ycoord = ycoord)


rmendels/rerddapXtracto documentation built on Jan. 19, 2024, 6:28 p.m.