flget_bathymetry {FjordLight}R Documentation

Extract and/or plot bathymetry data from a NetCDF file downloaded by FjordLight.

Description

This functions will conveniently extract the bathymetry data stored within a NetCDF file downloaded via fl_DownloadFjord. There are options for how the user would like to subset the data, which data format the data should be extracted to, and if the user would like to plot the data in the process.

Usage

flget_bathymetry(fjord, what = "o", mode = "raster", PLOT = FALSE)

Arguments

fjord

Expects the object loaded via fl_LoadFjord.

what

The default value "o" will load all "ocean" data, meaning it will filter out any land pixels. The other options are: "c" filters out only coastal bathymetry data (depth of 200 m to 0 m), "s" filters out only shallow bathymetry data (depth of 50 m to 0 m), and "l" loads only the land data. One may combine "o", "c", or "s", with "l" (e.g. "ol") to load both sea and land data.

mode

Determines the format of the bathymetry data loaded into the R environment. The default "raster" will load the data as a raster format. The other option "df" will load the data as a data.frame with three columns.

PLOT

Boolean argument (default = FALSE) that tells the function if the user would like the loaded bathymetry and/or elevation data to be plotted or not. NB: this argument will only run if the user chooses mode = "raster".

Value

Depending on which arguments the user chooses, this function will return the filtered bathymetry 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

depth

metres

Note that the depth column will contain both elevation (positive) and depth (negative) values.

Author(s)

Bernard Gentili & Robert Schlegel

Examples

# Load data
fjord_code <- "test"
fjorddata <- fl_LoadFjord(fjord_code, dirdata = system.file("extdata", package = "FjordLight"))

# Shallow data (what = "s"; s for shallow) as a data.frame
shallow_df <- flget_bathymetry(fjorddata, what = "s", mode = "df")

# Plot all ocean and land data

full_bathy <- flget_bathymetry(fjorddata, what = "ol", mode = "raster", PLOT = TRUE)


# Plot only land data

land_only <- flget_bathymetry(fjorddata, what = "l", mode = "raster", PLOT =TRUE)


# For more examples see: https://face-it-project.github.io/FjordLight/articles/fl_example.html


[Package FjordLight version 1.0.0 Index]