bin_to_raster: Generate 2D grid of L3b data for viewing

View source: R/bin_funcs.R

bin_to_rasterR 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

bin_to_raster(
  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
bin_to_raster(df = get_bins(region="nwa",variables=c("bin","bathymetry")),
              ext = c(lon_bounds$NWA, lat_bounds$NWA))

BIO-RSG/oceancolouR documentation built on Nov. 3, 2024, 2:03 a.m.