sample.echogram: Select and sample data values from an echogram

Description Usage Arguments Details Value Author(s) Examples

View source: R/sample.echogram.R

Description

This function allows to select individual pixels from an echogram and returns the Sv value, ping time and depth of the sampled pixel.

Usage

1
sample.echogram(echogram, plot = TRUE, coords = NULL, col = "black") 

Arguments

echogram

an object of class “echogram” as returned by read.echogram.

plot

logical. If TRUE (the default), the echogram to be sampled is plotted.

coords

(x, y) coordinates (in plot units) of the desired samples. They could result from previous sampling of another frequency.

col

color for the sampled points pixels.

Details

The selection of pixels to sample can be done by clicking on the echogram or by passing the coordinates of the desired pixels to the function. The coordinates should be in plot units, and therefore, these typically come from a previous selection by clicking on another frequency's echogram (see examples).

sample.echogram makes use of locator function, and therefore it only works in devices supported by the latter, such as X11, windows and quartz.

Value

A data frame with seven variables:

id

pixel id.

x

x coordinate in plot units.

y

y coordinate in plot units.

d

distance in plot units from the selected location to a valid pixel.

pingTime

time of sampled ping.

depth

depth of the sample.

Sv

Sv value.

Author(s)

Héctor Villalobos

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# import 38 and 120 kHz data from an HAC file 
hacfile <- system.file("hac", "D20150510-T202500.hac", package = "echogram")
echo2.038 <- read.echogram(hacfile, channel = 1)
echo2.120 <- read.echogram(hacfile, channel = 2)

# plot 38 kHz echogram 
echogram(echo2.038)

## Not run:  
# select points coordinates with the mouse 
# click to select several locations and escape when done
pts038 <- sample.echogram(echo2.038) 
pts038

# plot 120 kHz echogram 
echogram(echo2.120)

# use the points previously selected for 38 kHz
pts120 <- sample.echogram(echo2.120, coords = pts038[ , 2:3])
pts120

## End(Not run)

echogram documentation built on Dec. 16, 2019, 9:30 a.m.