rxtracto_3D: Extract environmental data in a 3-dimensional box from an...

View source: R/rxtracto_3D.R

rxtracto_3DR Documentation

Extract environmental data in a 3-dimensional box from an 'ERDDAP™' server using 'rerddap'.

Description

rxtracto_3D uses the R program 'rerddap' to extract environmental data from an 'ERDDAP' server in an (x,y,z, time) bounding box. The same call could be made directly in rerddap, but function is maintained as it is used in the polygon routine.

Usage

rxtracto_3D(
  dataInfo,
  parameter = NULL,
  xcoord = NULL,
  ycoord = NULL,
  zcoord = NULL,
  tcoord = NULL,
  xName = "longitude",
  yName = "latitude",
  zName = "altitude",
  tName = "time",
  verbose = FALSE,
  cache_remove = TRUE
)

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 (usually altitude or depth)

tcoord

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

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")

verbose

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

cache_remove

- logical variable (default TRUE) whether to delete 'rerddap' cache

Value

If successful a structure with data and dimensions:

  • extract$data - the data array dimensioned (lon,lat,time)

  • extract$varname - the name of the parameter extracted

  • extract$datasetname - ERDDAP™ dataset name

  • extract$longitude - the longitudes on some scale as request

  • extract$latitude - the latitudes always going south to north

  • extract$time - the times of the extracts

else an error string

Examples

## toy example to show use
## and keep execution time low
##
# dataInfo <- rerddap::info('erdHadISST')
parameter <- 'sst'
xcoord <- c(-130.5, -130.5)
ycoord <- c(40.5, 40.5)
tcoord <- c('2006-01-16', '2006-01-16')
# extract <- rxtracto_3D(dataInfo, parameter, xcoord = xcoord, ycoord = ycoord,
#                        tcoord = tcoord)

## bathymetry example
## 2-D example getting bathymetry
dataInfo <- rerddap::info('etopo360')
parameter <- 'altitude'
# extract <- rxtracto_3D(dataInfo, parameter, xcoord = xcoord, ycoord = ycoord)

rerddapXtracto documentation built on Sept. 11, 2024, 5:19 p.m.