var_to_rast: Generate 2D grid of L3b data for viewing

View source: R/bin_funcs.R

var_to_rastR Documentation

Generate 2D grid of L3b data for viewing

Description

Given a dataframe with 2 columns (bin number and variable), create a 2D matrix or raster FOR VISUALIZATION ONLY, NOT TO BE USED FOR STATS.

Usage

var_to_rast(
  df,
  resolution = "4",
  ext = c(xmn = -147, xmx = -41, ymn = 39, ymx = 86),
  rast = TRUE,
  max_bins = 5e+07
)

Arguments

df

Dataframe with 2 columns: first column="bin" and second column is the variable name (note: the dataframe does not have to be sorted in order of bin number).

resolution

String indicating spatial resolution, see ?gen_nrows for list of accepted strings.

ext

Named vector containing the boundaries of the resulting grid (xmn, xmx, ymn, ymx).

rast

TRUE/FALSE, should the resulting bin matrix be converted to raster?

max_bins

Maximum grid size (total number of pixels) that can be generated between the selected latitudes. This is to prevent overloading memory with the higher-resolution grids (e.g. 250m, 1km)

Value

Raster containing the variable data.

References

See https://oceancolor.gsfc.nasa.gov/docs/format/l3bins/ for more information on bin numbers.

Examples

# make a bathymetry raster for the Northwest Atlantic
var_to_rast(df = get_bins(region="nwa",variables=c("bin","bathymetry")),
            ext = c(lon_bounds$NWA, lat_bounds$NWA))

BIO-RSG/oceancolouR documentation built on April 30, 2024, 7:54 a.m.