View source: R/mask.echogram.R
mask.echogram | R Documentation |
This function creates, and optionally applies, a mask by “blanking” portions of the Sv data matrix of an echogram.
mask.echogram(echogram, surf.off = NULL, bott.off = NULL, mask = TRUE)
echogram |
an object of |
surf.off |
surface offset in m defining the upper layer (refered to the surface) to be masked. |
bott.off |
bottom offset in m defining the bottom layer (refered to the bottom) to be masked. |
mask |
logical. If |
The masking process consists in producing a matrix of the same dimensions as the original Sv data matrix with NA
's in the masked portion and 1's otherwise. The product of both matrices gives the masked echogram.
When mask = FALSE
, a masking matrix is returned. When mask = TRUE
(the default), an object of class
“echogram” with the mask applied.
Héctor Villalobos
# import 38 kHz data from HAC file
hacfile <- system.file("hac", "D20150510-T202500.hac", package = "echogram")
echo2.038 <- read.echogram(hacfile, channel = 1)
# make a copy of the original echogram
tmp <- echo2.038
# Create a mask, which is a matrix with 1's and NA's
mask <- mask.echogram(tmp, surf.off = 1, bott.off = -1, mask = FALSE)
image(t(mask[nrow(mask):1, ]))
# Apply mask to echogram
tmp$Sv <- tmp$Sv * mask
echogram(tmp)
# By default, the function returns the masked echogram
echo2.038mask <- mask.echogram(echo2.038, surf.off = 2, bott.off = 0.2)
echogram(echo2.038mask)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.