Check which points have potentially invalid depths.

check_depth(data, report = FALSE, depthmargin = 0, shoremargin = NA,
  bathymetry = NULL)

Arguments

data

The data frame.

report

If TRUE, errors are returned instead of records.

depthmargin

How much can the given depth deviate from the bathymetry in the rasters (in meters).

shoremargin

How far offshore (in meters) should a record be to have a bathymetry greater than 0. If NA (default) then this test is ignored.

bathymetry

Raster* object that you want to use to check the depth against. If NULL (default) then the bathymetry from the xylookup service is used.

Value

Problematic records or an errors report.

Details

Multiple checks are performed in this function:

  1. missing depth column (warning)

  2. empty depth column (warning)

  3. depth values that can't be converted to numbers (error)

  4. depth values that are larger than the depth value in the bathymetry layer, after applying the provided depthmargin (error)

  5. depth values that are negative for off shore points, after applying the provided shoremargin (error)

  6. minimum depth greater than maximum depth (error)

See also

check_onland check_outliers_dataset check_outliers_species lookup_xy

Examples

# NOT RUN {
notok <- check_depth(abra, report = FALSE)
print(nrow(notok))
r <- check_depth(abra, report = TRUE, depthmargin = 100, shoremargin = 100)
print(r)
plot_map_leaflet(abra[r$row,], popup = "id")
# }