View source: R/check_distance_NEW.r
| check_distance | R Documentation |
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.
check_distance(DataTA, year, wd, suffix)
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. |
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.
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.
W. Zupa, I. Bitetto
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
wd <- tempdir()
suffix <- "2020-03-05_time_h17m44s55"
year <- 2007
check_distance(RoME::TA, year, wd, suffix)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.