View source: R/sidfex.plot.speedangle.R
sidfex.plot.speedangle | R Documentation |
Generate a so-called speed-angle-plot for SIDFEx forecast data. Speed and angle errors are always based on the integrated displacement of the target (e.g., buoy) from its initial position. If only a (sub-)index of the forecasts is provided, all relevant forecast and observational data are read, remapped to a common time axis, analysed, and subsequently plotted; if intermediate results (that must be consistent with the index) are provided, the corresponding steps are skipped.
sidfex.plot.speedangle(index=NULL,read.fcst.res=NULL,read.obs.res=NULL,remap.res=NULL,col.by="DaysLeadTime",colbar=sl.colbar.redgreyblue_256,colbar.breaks=NULL,colbar.breaks.log=FALSE,points.type="p",device="pdf",file=paste0("~/sidfex.plot.speedangle.",device),width=NULL,do.init.device=TRUE,do.close.device=TRUE,labels=TRUE,labels.cex=1,bg.lines.lwd=labels.cex,...)
index |
a data frame specifying the SIDFEx forecasts to be read/analysed/plotted, or |
read.fcst.res |
a list with SIDFEx forecasts as returned by |
read.obs.res |
a list with SIDFEx observations as returned by |
remap.res |
a list with remapped SIDFEx observations as returned by |
col.by |
a character specifiying by what property data points shall be coloured. Can be either any column of |
colbar |
a spheRlab colourbar as returned by |
colbar.breaks |
an optional numeric vector specifying the breaks between colours. Ignored if |
colbar.breaks.log |
a logical value indicating whether breaks for the colourbar shall be placed in logarithmic steps. Default is |
points.type |
a character specifying whether only points ('p'), only lines ('l'), or both ('b') shall be plotted. |
device |
a character specifying which graphics device to use, or |
file |
a character specifying the output file (if |
width |
a scalar specifying the width of the resulting figure. The height will be equal. If |
labels |
a logical value specifying whether or not labels shall be plotted. Default is |
labels.cex |
a numerical value specifying the amount by which labels shall be magnified relative to the default. |
bg.lines.lwd |
a numerical value specifying the width of the background lines (marking the 'coordinate system'). |
... |
Further graphical parameters to be forwarded to |
A list with the elements col.by
, colbar
, categorical
, breaks
, and labels
, which can be used to plot the corresponding colourbar with sl.plot.colbar
.
Helge Goessling
sidfex.read.fcst
, sidfex.read.obs
, sidfex.remap.obs2fcst
# load whole SIDFEx forecast index
index = sidfex.load.index()
# extract subindex with all forecasts that match some filters
subindex = index[ index$TargetID == "300234063991680" &
index$GroupID %in% c("metno001","esrl001","ukmo001","eccc001") &
index$InitYear == 2018 &
index$InitDayOfYear > 210 &
index$InitDayOfYear < 215, ]
# Generate a speed-angle-plot for all forecast data corresponding to the subindex, with colours according to the GroupID, as well as the corresponding colourbar
colbar = sidfex.plot.speedangle(subindex,col.by="GroupID",points.type="l",colbar=sl.colbar(cols = c("violet","blue","green","yellow","orange","red"),N=256),device="pdf",file="~/speedangle_example_1.pdf")
sl.plot.colbar(colbar,file.name="~/speedangle_example_1_colbar.pdf")
# Generate another speed-angle-plot for the same data, but with colours according to DaysLeadTime
colbar = sidfex.plot.speedangle(subindex,col.by="DaysLeadTime",points.type="l",colbar=sl.colbar(cols = c("violet","blue","green","yellow","orange","red"),N=256),device="pdf",file="~/speedangle_example_2.pdf")
sl.plot.colbar(colbar,file.name="~/speedangle_example_2_colbar.pdf")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.