flget_Pfunction {FjordLight} | R Documentation |
Extract p function data from a NetCDF file downloaded by FjordLight
.
Description
This functions will conveniently extract the p function 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_Pfunction(
fjord,
type = "coastal",
period = "Global",
month = NULL,
year = NULL,
mode = "function",
PLOT = FALSE,
add = FALSE,
...
)
Arguments
fjord |
Expects the object loaded via |
type |
Whether the p function should show values for the |
period |
Here the user determines which time period of data should be loaded. To load
the total average values (default) use |
month |
The monthly climatology to extract. Accepts an integer value from 3 to 10.
This argument is ignored if |
year |
The yearly average to extract. Currently accepts an integer value from 2003 to 2022.
This argument is ignored if |
mode |
Determines the basic process that this function performs. The default
|
PLOT |
Boolean argument (default = |
add |
Boolean (i.e. |
... |
Additional arguments that may be passed to |
Value
Depending on which arguments the user chooses for mode
, a function will
be returned (see examples). Or a two column data.frame:
irradianceLevel |
A threshold value [mol photons m-2 d-1] |
optics_global|year|month |
The column name is determined by the arguments passed to |
Author(s)
Bernard Gentili & Robert Schlegel
Examples
# Load data
fjord_code <- "test"
fjorddata <- fl_LoadFjord(fjord_code, dirdata = system.file("extdata", package = "FjordLight"))
# Create a function
fG <- flget_Pfunction(fjorddata, "shallow", "Global")
# Then use it with specific PAR thresholds
irradiance_levels <- c(0.1, 1, 10)
fG(irradiance_levels)
# As a 2 column data.frame
f2012 <- flget_Pfunction(fjorddata, "shallow", "Yearly", year = 2012, mode = "df", PLOT = TRUE)
str(f2012)
# Plot a P-function
fGlob <- flget_Pfunction(fjorddata, "coastal", "Global", PLOT = TRUE, lty = 1, col = 1, lwd = 2,
Main = paste(fjord_code, "P-functions"), ylim = c(0, 50))