Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coordinatePrecision - deciding how precise the units are. #9

Open
SimonGoring opened this issue Jan 3, 2017 · 0 comments
Open

coordinatePrecision - deciding how precise the units are. #9

SimonGoring opened this issue Jan 3, 2017 · 0 comments

Comments

@SimonGoring
Copy link
Contributor

Understanding coordinate precision is hard. I'd like to be able to include it, but it's challenging.

The first potential solution I used was to look at the number of decimal places. You can't do this in R, but I wrote a short function that converts the numeric to a character and then split the string at the decimal point. Doing this provides a table that shows the maximum decimal places in the site coordinates:

Decimal places Count of Sites
0 55
1 225
2 1846
3 63
4 133
5 576
6 3057
7 32
8 25
9 26
10 10
12 255
13 2207
16 1

This should indicate that it's unreasonable to think that this is the best solution. Given that many of these coordinates are decimal interpretations of the d^o^m's" system it might make sense to look for values that divide evenly into dms systems.

I added the function dms_conv:

dms_conv <- function(x) {
  
  if (x < 0) { w <- TRUE } else { w <- FALSE }
  
  x <- abs(x)
  
  d <- x - (x %% 1)
  m <- ((x - d) * 60) - (((x - d) * 60) %% 1)
  s <- x - (d + m/60)
  
  c(ifelse(w, d, -d), m, ifelse(s < 0.5, 0, s))
}

So, now we can test whether the seconds are whole numbers or not, to get some estimate of precision. If s == 0, then we can look at the precision of the m. The coordinatePrecision field allows for repeating decimals, as recognizing precision in minutes &cetera.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant