Description Usage Arguments Details Value Examples
This function is the main function of the package. It operates on the three standard regions "NonPolar", "Arctic", and "Antarctic" or on a subregion (see user's guide and function cl_subregion())
1 | cl_surface(region, month = 0, E = 1.6, type = "s", dir = ".")
|
region |
: [character] choose among : "NonPolar", "Arctic" and "Antarctic" or give the name of a subregion of one of these three regions. For example : suppose you have calculated the Pfunction of a subregion called "med" from the main region "NonPolar". You have downloaded a file called "NonPolar.med.Pfunctions.dat" (see function cl_subregion()). In this case pass "NonPolar.med". |
month |
: [integer] the month (-1, 0, 1-12); if -1 gives the values for global and all months; if 0 gives the global value; if 1 < month < 12 gives the values for the month; |
E |
: [numeric] mol.photons \; m^{-2} \; d^{-1} |
type |
: [character] choose among : "Sg" "s" "P" "E" (default "s") |
dir |
: [character] only used if region is not one of the three standard regions but a subregion; in this case, it is the path to the directory where is stored the Pfunction file (example : "NonPolar.med.Pfunctions.dat") of this subregion ( default = ".", that is the current directory ) |
This function uses the Pfunction file :
included in the package if region is "NonPolar" "Arctic" or "Antarctic"
previously calculated and downloaded if region is the name of a subregion.
if type == "Sg" [numeric] : an unique value (surface area of the region in km^{2})
if type == "s" [numeric vector] : surface areas in km^{2} receiving more than E mol.photons \; m^{-2} \; d^{-1}
if type == "P" [numeric array] : values of the P-function in % for the E values
if type == "E" [numeric vector] : discrete values of E used for tabulated P-functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## surface of the "NonPolar" region
cl_surface("NonPolar", type = "Sg")
## global P-function
cl_surface("NonPolar", month = 0, E = c(0.01,0.02,0.05,0.1,0.2,0.5,1), type = "P")
## get E values in "Arctic" region then computes and plot global and monthly P-functions
region <- "Arctic"
E <- cl_surface(region, type = "E")
pc <- cl_surface(region, month = -1, E = E, type = "P")
matplot(E, pc, type = "l", log = "x", xlim = rev(range(E)),
lty = 1:5, col = 1:6, lwd = 2, ylab = "%", main = region)
legend("topleft", legend = colnames(pc),
lty = 1:5, col = 1:6, lwd = 2, bty = "n")
## example for a subregion
region <- "NonPolar.Gabes"
## for this example the directory where to find the P-function file
## "NonPolar.Gabes.Pfunctions.dat" is in the package itself;
## you can obtain your own P-function files and save them in
## the directory of your choice - see function cl_subregion()
dir <- system.file("extdata", package = "CoastalLight")
E <- cl_surface(region, type = "E", dir = dir)
pc <- cl_surface(region, month = -1, E = E, type = "P", dir = dir)
matplot(E, pc, type = "l", log = "x", xlim = rev(range(E)),
lty = 1:5, col = 1:6, lwd = 2, ylab = "%", main = region)
legend("topleft", legend = colnames(pc),
lty = 1:5, col = 1:6, lwd = 2, bty = "n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.