From b7d1cfc4dfc87e8ef0cab831004e0f7a27827531 Mon Sep 17 00:00:00 2001 From: BaptisteDlp Date: Sun, 10 Dec 2023 10:35:09 +1100 Subject: [PATCH] Add example --- R/plotTemporal.R | 15 ++++++++++++++- man/plotTemporal.Rd | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/R/plotTemporal.R b/R/plotTemporal.R index da284d12..018daae5 100644 --- a/R/plotTemporal.R +++ b/R/plotTemporal.R @@ -48,7 +48,20 @@ checkInputsPlotTemporal <- function(data, storm, var) { #' #' @examples #' \donttest{ -#' #Add example here +#' sds <- defStormsDataset() +#' st <- defStormsList(sds = sds, loi = "Vanuatu", names = "PAM", verbose = 0) +#' +#' df <- data.frame(x = c(168.33, 167.17), y = c(-17.73, -15.53)) +#' rownames(df) <- c("Port_Vila", "Luganville") +#' +#' # Generate temporal series of wind on the points +#' TS <- temporalBehaviour(st, points = df, product = "TS", tempRes = 0.5, verbose = 0) +#' +#' # Plot temporal series of wind speed +#' plotTemporal(data=TS, storm="PAM") +#' +#' # Plot temporal series of wind direction +#' plotTemporal(data=TS, storm="PAM", var='direction') #' } plotTemporal <- function(data, storm, var = 'speed'){ diff --git a/man/plotTemporal.Rd b/man/plotTemporal.Rd index 22bddfd6..b9199258 100644 --- a/man/plotTemporal.Rd +++ b/man/plotTemporal.Rd @@ -27,6 +27,19 @@ locations } \examples{ \donttest{ -#Add example here +sds <- defStormsDataset() +st <- defStormsList(sds = sds, loi = "Vanuatu", names = "PAM", verbose = 0) + +df <- data.frame(x = c(168.33, 167.17), y = c(-17.73, -15.53)) +rownames(df) <- c("Port_Vila", "Luganville") + +# Generate temporal series of wind on the points +TS <- temporalBehaviour(st, points = df, product = "TS", tempRes = 0.5, verbose = 0) + +# Plot temporal series of wind speed +plotTemporal(data=TS, storm="PAM") + +# Plot temporal series of wind direction +plotTemporal(data=TS, storm="PAM", var='direction') } }