check_distance: Check of distance consistency

View source: R/check_distance_NEW.r

check_distanceR Documentation

Check of distance consistency

Description

The function checks whether there are inconsistencies between the DISTANCE field values in the TA table and the distances computed from the geographical coordinates of each haul.

Usage

check_distance(DataTA, year, wd, suffix)

Arguments

DataTA

Haul data table formatted according to the MEDITS protocol (TA table).

year

Reference year for the analysis.

wd

Working directory path defined by the user.

suffix

Suffix string to uniquely identify the output logfile and plots.

Details

The comparison between the DISTANCE field and the distance computed from shooting and hauling coordinates is performed with a tolerance threshold of 30%.

The geographic distance is calculated using the function distGeo() from the geosphere package, which computes the shortest path (great-circle distance) between two points on the Earth's ellipsoid (WGS84) using coordinates in decimal degrees.

Coordinates in the TA table are usually expressed in degrees and decimal minutes. These are automatically converted into decimal degrees using the internal function MEDITS.to.dd() before the computation.

Value

The function always returns TRUE. Its purpose is to generate warnings for hauls where the recorded DISTANCE differs significantly from the computed geographic distance.

Warnings are saved in a logfile located in the Logfiles subdirectory of the specified working directory. Additionally, for hauls with discrepancies, graphical maps are generated and saved in the Graphs subdirectory to support visual inspection and correction.

Author(s)

W. Zupa, I. Bitetto

References

Anonymous. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
https://www.sibm.it/MEDITS%202011/principaledownload.htm

Hijmans, R. J. (2019). geosphere: Spherical Trigonometry. R package version 1.5-10.
https://cran.r-project.org/package=geosphere

Examples

wd <- tempdir()
suffix <- "2020-03-05_time_h17m44s55"
year <- 2007
check_distance(RoME::TA, year, wd, suffix)

RoME documentation built on April 24, 2026, 1:07 a.m.