makeTopography | R Documentation |
Make topography data suitable for the 'graphics::contour'
and
'grDevices::contourLines'
functions using freely available global
seafloor topography data.
makeTopography (dat, digits=2, func=NULL)
dat |
|
digits |
|
func |
|
Suitable data can be obtained through the Topex acquisition form.
The function 'utils::read.table'
will import dowloaded ASCII files into R,
creating objects suitable for the argument 'dat'
in 'makeTopography'
.
When creating data for regions with longitude values spanning
-180^\circ
to 0^\circ
, consider
subtracting 360 from the result's longitude coordinates (x
).
When creating bathymetry data, consider negating the result's
elevations (z
) to give depths positive values.
Combinations of (x,y)
do not need to be complete (z[x,y]=NA
) or
unique (z[x,y] = func(z[x,y])
).
List with elements x
, y
, and z
. Elements x
and
y
are vectors, while z
is a matrix with rownames x
and colnames y
.
The functions 'graphics::contour'
and 'grDevices::contourLines'
expect data conforming to this list format.
Nicholas M. Boers, Staff Software Engineer
Jobber, Edmonton AB
Maintainer: Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Institute of Ocean Sciences (IOS), Sidney BC
Last modified Rd: 2021-01-11
In package graphics:
contour
In package grDevices:
contourLines
In package PBSmapping:
convCP
local(envir=.PBSmapEnv,expr={
oldpar = par(no.readonly=TRUE)
#--- Example 1: Sample data frame and conversion.
file <- data.frame(X=c(1,1,2,2),Y=c(3,4,3,4),Z=c(5,6,7,8))
print(makeTopography(file))
#--- Example 2: Aleutian Islands bathymetry
isob <- c(100,500,1000,2500,5000)
icol <- rgb(0,0,seq(255,100,len=length(isob)),max=255)
afile <- paste(system.file(package="PBSmapping"),
"/Extra/aleutian.txt",sep="")
aleutian <- read.table(afile, header=FALSE, col.names=c("x","y","z"))
aleutian$x <- aleutian$x - 360
aleutian$z <- -aleutian$z
alBathy <- makeTopography(aleutian)
alCL <- contourLines(alBathy,levels=isob)
alCP <- convCP(alCL)
alPoly <- alCP$PolySet
attr(alPoly,"projection") <- "LL"
plotMap(alPoly, type="n", cex.axis=1.2, cex.lab=1.5)
addLines(alPoly,col=icol)
data(nepacLL,envir=.PBSmapEnv)
addPolys(nepacLL,col="gold")
legend(x="topleft",bty="n",col=icol,lwd=2,legend=as.character(isob))
par(oldpar)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.