Extract pixel surface area data from a NetCDF file downloaded by FjordLight
.
flget_area.Rd
This functions will conveniently extract the pixel surface area data stored within a
NetCDF file downloaded via fl_DownloadFjord
. The user may choose to
load the data in either raster or data.frame formats. It is useful to combine these
data with others, e.g. bathymetry data loaded via fl_DownloadFjord
Arguments
- fjord
Expects the object loaded via
fl_LoadFjord
.- mode
Determines the format to be loaded into the R environment. The default
"raster"
will load the data as a raster format."3col"
will load the data as a data.frame with three columns.
Value
Depending on which arguments the user chooses, this function will return the
surface area data as a RasterLayer
(mode = "raster"
) or
data.frame (mode = "df"
). The data.frame will contain the following columns:
- longitude
degree decimals
- latitude
degree decimals
- PixelArea_km2
the surface area of the grid cell [km^2]
Examples
# Load data
fjord_code <- "test"
fjorddata <- fl_LoadFjord(fjord_code, dirdata = system.file("extdata", package = "FjordLight"))
# Load area data
area <- flget_area(fjorddata, mode = "df")