## Find the path to the demo file.
polar.file <- system.file("extdata/surfinfo_polar.ncf", package="M3")
## Read in the terrain elevation variable.
elev <- get.M3.var(file=polar.file, var="HT")
## Make a plot.
image(elev$x.cell.ctr, elev$y.cell.ctr, elev$data[,,1],
xlab="Projection x-coord (km)", ylab="Projection y-coord (km)",
zlim=range(elev$data[,,1]), col=heat.colors(15))
## Subset to a smaller geographic area in southwestern U.S.
subset.elev <- var.subset(elev, llx=-2000, urx=0, lly=-6500, ury=-4000)
## Make a plot of this subset.
image(subset.elev$x.cell.ctr, subset.elev$y.cell.ctr,
subset.elev$data[,,1], xlab="Projection x-coord (km)",
ylab="Projection y-coord (km)", zlim=range(subset.elev$data[,,1]),
col=heat.colors(15))
## Superimpose U.S. state boundaries on the plot.
state.bds <- get.map.lines.M3.proj(file=polar.file)$coords
lines(state.bds)
Run the code above in your browser using DataLab