Last chance! 50% off unlimited learning
Sale ends in
Convenience function to plot radar products on a pretty map. Creates a separate plot for each layer, a selection is possible.
plotRadar(
x,
layer = NULL,
main = x@title,
land = "gray80",
sea = "cadetblue1",
de = "grey80",
eu = "black",
col = berryFunctions::seqPal(),
xlim = NULL,
ylim = NULL,
zlim = NULL,
axes = TRUE,
las = 1,
mar = c(2.5, 3.5, 2.5, 5),
keeppar = TRUE,
project = TRUE,
proj = "radolan",
extent = "radolan",
targetproj = "ll",
quiet = rdwdquiet(),
...
)
raster oject, e.g. 'dat' element of object returned by readDWD()
.
Optional: selected layer(s) to be plotted. DEFAULT: NULL
Graph title(s). Use "" to suppress.
Noteoutput@title
is set to main
! DEFAULT: x@title
Color of land areas in the map. DEFAULT: "gray80"
Color of sea areas in the map. DEFAULT: "cadetblue1"
Color of Deutschland Bundesland borders (DEU
). DEFAULT: "grey80"
Color of Europe country borders (EUR
). DEFAULT: "black"
Color palette for the data itself.
DEFAULT: berryFunctions::seqPal()
xlim. DEFAULT: NULL, i.e. taken from x extent (after reprojection if project=TRUE
)
ylim. DEFAULT: NULL, i.e. taken from y extent (after reprojection if project=TRUE
)
zlim. 3 Options: two-number vector,
zlim="ind"
for individual zlim per layer,
or NULL for range
of selected layer(s).
DEFAULT: NULL
Draw axes? DEFAULT: TRUE
LabelAxisStyle for axes. DEFAULT: 1 (all upright)
Vector with plot margins. DEFAULT: c(2.5, 3.5, 2.5, 5)
Logical: keep the margins set with par, so later points etc are
added in the right location?
DEFAULT: TRUE, opposite to sf::plot
with reset=TRUE, see
https://github.com/cran/sf/blob/master/R/plot.R
Project the data before plotting? Not needed if
projectRasterDWD()
has already been called. DEFAULT: TRUE
current projection, see projectRasterDWD()
,
used only if project=TRUE
. DEFAULT: "radolan"
current extent, see projectRasterDWD()
,
used only if project=TRUE
. DEFAULT: "radolan"
target projection, see projectRasterDWD()
,
used only if project=TRUE
. DEFAULT: "ll"
suppress progress messages? DEFAULT: FALSE through rdwdquiet()
Further arguments passed to raster::plot()
raster object, projected (if project=TRUE
).
If length(layer)==1
, only that selected layer is returned.
output@title
is set to main
.
addBorders()
, readDWD()
, https://bookdown.org/brry/rdwd/raster-data.html
# NOT RUN {
# See homepage in the section 'See Also'
# }
# NOT RUN {
## Excluded from CRAN checks: requires internet connection
link <- "seasonal/air_temperature_mean/16_DJF/grids_germany_seasonal_air_temp_mean_188216.asc.gz"
rad <- dataDWD(link, base=gridbase, joinbf=TRUE, dir=tempdir())
radp <- plotRadar(rad, proj="seasonal", extent=rad@extent, main="plotRadar ex")
plotRadar(radp, ylim=c(52,54), project=FALSE) # reuses main
# plotRadar equivalent, map only country borders:
radpm <- projectRasterDWD(rad[[1]], proj="seasonal", extent=rad@extent)
raster::plot(radpm)
addBorders()
# several layers
url <- "daily/Project_TRY/pressure/PRED_199606_daymean.nc.gz" # 5 MB
nc <- dataDWD(url, base=gridbase, joinbf=TRUE, dir=localtestdir())
ncp3 <- plotRadar(nc, main=paste(nc@title, nc@z[[1]]), layer=1:3,
col=terrain.colors(100), proj="nc", extent="nc")
plotRadar(ncp3, layer=3:4, project=FALSE) # still has all layers
plotRadar(ncp3, layer=4:5, project=FALSE, zlim="ind") # individual zlims per layer
plotRadar(ncp3, layer=1, project=FALSE, zlim=c(1016,1020))
ncp1 <- plotRadar(nc, layer=1, proj="nc", extent="nc") # much faster projection
# no longer has layers 2-4:
berryFunctions::is.error(plotRadar(ncp1, layer=1:4, project=FALSE), TRUE, TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab