Learn R Programming

SDLfilter (version 1.2.1)

depthfilter: Filter locations by water depth

Description

Function to remove fixes located at a given height from the high tide line.

Usage

depthfilter(sdata, bathymetry, extract = "bilinear", tide, qi = 4,
  depth = 0, tidal.plane, filter = TRUE)

Arguments

sdata

A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi". This filter is independently applied to a subset of data grouped by the unique "id". "DateTime" is date & time in class POSIXct. "lat" and "lon" are the recorded latitude and longitude in decimal degrees. "qi" is the numerical quality index associated with each fix where the greater number represents better quality (e.g. number of GPS satellites used for estimation).

bathymetry

object of class "RasterLayer" containing bathymetric data in meters. Geographic coordinate system is WGS84.

extract

Method to extract cell values from raster layer inherited from extract function of the raster package. Default is "bilinear". See extract for details.

tide

A data frame containing columns with the following headers: "tideDT", "reading", "standard.port". "tideDT" is date & time in class POSIXct for each observed tidal height. "reading" is the observed tidal height in meters. "standard.port" is the identifier of each tidal station.

qi

An integer specifying threshold quality index. Fixes associated to a quality index higher than the threshold are excluded from the depthfilter. Default is 4

depth

An integer denoting vertical difference from a high tide line in meters. A positive value indicates above the high tide and a negative value indicates below the high tide. The function removes fixes above the given threshold. Default is 0 m (i.e. high tide line).

tidal.plane

A data frame containing columns with the following headers: "standard.port", "secondary.port", "lat", "lon", "timeDiff", "datumDiff". "standard.port" is the identifier for a tidal observation station. "secondary.port" is the identifier for a station at which tide is only predicted using tidal records observed at the related standard port. "lat" and "lon" are the latitude and longitude of each secondary port in decimal degrees. "timeDiff" is the time difference between standard port and its associated secondary port. "datumDiff" is the baseline difference in meters between bathymetry and tidal observations/predictions if each data uses different datum (e.g. LAT and MSL).

filter

Default is TRUE. If FALSE, the function does not filter locations but the depth estimates are returned.

Value

Input data is returned with two columns added; "depth.exp", "depth.HT". "depth.exp" is the estimated water depth at the time of location fixing. "depth.HT" is the estimated water depth at the high tide nearest to the time and location of each fix. When the "filter" option is enabled, the fixes identified by this filter are removed from the input data.

Details

This function removes fixes located at a given height from estimated high tide line when the "filter" option is enabled. The function chooses the closest match between each fix and tidal observations or predictions in temporal and spatial scales in order to estimate height of high tide at the time and location of each fix. It does not filter data when the "filter" option is disabled but it returns the estimated water depth of each location with the tide effect accounted for (bathymetry + tide). The estimated water depths are returned in the "depth.exp" column.

References

Shimada T, Limpus C, Jones R, Hazel J, Groom R, Hamann M (2016) Sea turtles return home after intentional displacement from coastal foraging areas. Marine Biology 163:1-14 doi:10.1007/s00227-015-2771-0

Beaman, R.J. (2010) Project 3DGBR: A high-resolution depth model for the Great Barrier Reef and Coral Sea. Marine and Tropical Sciences Research Facility (MTSRF) Project 2.5i.1a Final Report, MTSRF, Cairns, Australia, pp. 13 plus Appendix 1.

See Also

dupfilter, ddfilter

Examples

Run this code
# NOT RUN {
#### Load data sets
## Fastloc GPS data obtained from a green turtle
data(turtle)

## Bathymetry model developed by Beaman (2010)
data(bathymodel)

## A tidal plane for the example site
data(tidalplane)

## Tidal observations and predictions for the example site
data(tidedata)

## Maps for the example site
data(SandyStrait)


#### Remove temporal and/or spatial duplicates
turtle.dup <- dupfilter(turtle)


#### Remove biologically unrealistic fixes 
turtle.dd <- ddfilter(turtle.dup, vmax=9.9, qi=4, ia=90, maxvlp=2.0)


#### Apply depthfilter
turtle.dep <- depthfilter(sdata=turtle.dd, 
                          bathymetry=bathymodel, 
                          tide=tidedata, 
                          tidal.plane=tidalplane)


#### Plot data removed or retained by depthfilter
plotMap(turtle.dd, bgmap=SandyStrait, point.bg = "red", point.size = 2, line.size = 0.5, 
        axes.lab.size = 0, title.size=0, sb.distance=10, multiplot = FALSE)[[1]] + 
geom_point(aes(x=lon, y=lat), data=turtle.dep, size=2, fill="yellow", shape=21)+
geom_point(aes(x=x, y=y), data=data.frame(x=c(152.68, 152.68), y=c(-25.3, -25.34)), 
           size=3, fill=c("yellow", "red"), shape=21) + 
annotate("text", x=c(152.7, 152.7), y=c(-25.3, -25.34), label=c("Retained", "Removed"), 
         colour="black", size=4, hjust = 0)
# }

Run the code above in your browser using DataLab