vis_nc: Visualize NETCDF file

Description Usage Arguments Value Author(s) See Also Examples

Description

Visualize a single time slice of a NETCDF object. If you want to project correctly, use OSMscale as in the example below. (https://github.com/brry/OSMscale#intro).

Usage

1
2
3
4
5
vis_nc(nc, index = 1, x = as.vector(nc$lon), y = as.vector(nc$lat),
  z = as.vector(nc$var[, , index]), apply = NA, zlab = paste(nc$varname,
  nc$time[index]), add = FALSE, pch = 15, cex = 1.25, col = seqPal(100,
  colors = RColorBrewer::brewer.pal(9, "OrRd")), bg.leg = NA, cex.leg = 1,
  legargs = NULL, ...)

Arguments

nc

nc object from read_nc

index

Integer: a single time slice number to be plotted. To plot several slices, use vis_nc_all. DEFAULT: 1

x, y, z

x,y,z Coordinates. DEFAULT: nc elements lon, lat, var (@ time index)

apply

Function to be applied to aggregate time in nc$var, e.g. mean or median. If given, index and z are ignored! Should take na.rm as argument. DEFAULT: NA

zlab

Legend title. DEFAULT: varname time

add

Logical: add to existing plot? DEFAULT: FALSE

pch, cex

Point character and character expansion (symbol size). DEFAULT: 15, 1.25

col

Color palette. DEFAULT: berryFunctions::seqPal using colors from RColorBrewer::brewer.pal(9, "OrRd")

bg.leg, cex.leg

Background and character size for legend. DEFAULT: NA, 1

legargs

List of further arguments passed to legend ( berryFunctions::colPointsLegend)

...

Further arguments passed to berryFunctions::colPoints

Value

colPoints list output

Author(s)

Berry Boessenkool, berry-b@gmx.de, Feb 2017

See Also

read_nc, vis_nc_all and vis_nc_film for several time slices, get_ncPoint, colPoints

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# to be added

## Not run:  # too time consuming for CRAN checks
# install.packages("OSMscale)
library(OSMscale)
map <- pointsMap(nc$lat, nc$lon)
pp <- projectPoints(as.vector(nc$lat), as.vector(nc$lon), to=posm())
plot(map); scaleBar(map)
vis_nc(nc, x=pp$x, y=pp$y, add=TRUE)

## End(Not run)

brry/mhmVis documentation built on May 13, 2019, 7:53 a.m.