Description Usage Arguments Details References See Also Examples
View source: R/autoplot_spi_forecast.R
The function returns a plot with the historical SPI values as a barplot and the ensemble forecasts as boxplots.
The function works with station data only and needs a observational time series and an ensemble forecast as input.
To see some example outputs of this function, look at the vignette "autoplot-functions" accessible through the package help main page or by typing
vignette("autoplot-functions",package="ClimIndVis") into the console.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
obs_p |
Station observations. Climindvis-object with type = "p" generated by make_object. |
fc_p |
Forecasts at stations. Climindvis-object with type = "fc_p" generated by |
index |
Character string. This is set to index="spi_forecast" and does not have to be provided. |
index_args |
List of arguments for index. For arguments see |
selpoints |
Array to select subset of points to plot. There are two options:
|
output |
Format of image to be plotted ("png", "jpeg", "tiff", "pdf","dev.new"). Default = NULL, output to null device (getOption("device") will show you the null device. If you are not using RStudio, NULL and dev.new will give the same output). |
plotdir |
Character string of path of directory for saving plots. Ignored if output is NULL or "dev.new". |
plotname |
Optional. Character string. First part of plot name followed by character string containing index name/aggregation/time period/... depending on the autoplot function. Default = "". |
plotstart |
Numeric. Chosen start year of historic time series plot. For a reference period of e.g. 1981-2010 and a forecast for 2011, plotstart can be set to 2009 and only 2009-2010 and the forecast 2011 is displayed. |
plot_title |
Logical. Add plot title to graphic. Default = TRUE. |
title |
Optional. Character string. If provided added above the plot in addition to default information from the respective function (e.g. index name/aggregation/time period/...). Default = "", no additional title is written. |
trendplots. |
No trendplots implemented in this graphic. Set to FALSE. |
For the SPI calculation, aggt needs to be set to "monthly". For further arguments see index_arguments.spi_forecast
The forecast dates need to continue the time series of the historical dataset. If the observational data ends on 2010-04-30, the forecast data needs to start 2010-05-01. Thus, the SPI is calculated for the overlapping period. If there is a time gap between forecast and historical data, no overlapping period is calculated.
The function can only be applied to station data and not to gridded data. Note, that you have to provide the same amount of station data in the two climdindvis-objects forecast and observation (obs_p, fc_p). No checks are executed, whether the coordinates of the observational data corresponds to the coordinates of the forecast data.
The SPI calculation is based on the SCI package from Lukas Gudmundsson & James Stagge. For the argument distribution, provide a distribution for which the corresponding density function (dname), the corresponding distribution function (pname) and the quantile function (qname) must be defined (see for example GammaDist). Distributions are listed in the package stats.
For SPI with forecast no trend can be calculated at the moment.
Stagee, J.H. ; Tallaksen, L.M.; Gudmundsson, L.; van Loon, A.; Stahl, K.: Candidate Distributions for Climatological Drought Indices (SPI and SPEI), 2015, International Journal of Climatology, 35, 4027-4040, doi:10.1002/joc.4267.
Other autoplot_functions:
autoplot_anomaly_map()
,
autoplot_anomaly_ts()
,
autoplot_climatology_map()
,
autoplot_forecast_map()
,
autoplot_forecast_stations()
,
autoplot_overview_stations()
,
autoplot_trend_map()
,
autoplot_ts_stations()
,
autoplot_verification_map()
1 2 3 4 5 6 | #' ## Load example climindvis objects:
data(object_st, object_fc_st)
autoplot_forecast_spi(
obs_p = object_st,fc_p = object_fc_st, index = "spi_forecast",
index_args = list(aggt = "monthly", timescale= 3),plotstart=2008)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.