satinDataframe: Reshape a satin object into a data frame

View source: R/satinDataframe.R

satinDataframeR Documentation

Reshape a satin object into a data frame

Description

A satin object is reshaped as a data frame with longitude, latitude and remote sensed data column(s).

Usage

satinDataframe(X, reverse = FALSE)

Arguments

X

a satin object as returned by read.nasaoc, read.ghrsst, read.osunpp, read.cmems, or a data frame produced with this function.

reverse

logical, TRUE is used to create a satin object from a data frame previously created with this function (see details).

Details

This is mainly an utility function called by crop, extractPts, and pixelate functions. However, it may be useful when the user wants to arrange the ocean data variables stored in a satin object as a data frame, with rows representing pixels whose longitude and latitude coordinates are in the first two columns and their data values in the remaining column(s). The attributes describing the data (name, units, period, etc.) are preserved. Specifying reverse = TRUE reverses the operation.

Value

When reverse = FALSE, a data frame with at least three columns: "x", "y" for longitude and latitude coordinates, and data for the variable(s). When reverse = TRUE a satin object as produced.

Author(s)

Héctor Villalobos

Examples

# load sample SST data
data(dsst)

# reshape into a data frame
X <- satinDataframe(dsst)
head(X)

# reverse the operation
Y <- satinDataframe(X, reverse = TRUE)
Y
plot(Y)

satin documentation built on Sept. 23, 2022, 1:06 a.m.