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

Bug when parsing coordinates of RIA meteorological stations #20

Closed
rubenfcasal opened this issue Dec 16, 2023 · 2 comments
Closed

Bug when parsing coordinates of RIA meteorological stations #20

rubenfcasal opened this issue Dec 16, 2023 · 2 comments

Comments

@rubenfcasal
Copy link
Contributor

When comparing the representation of the coordinates of the RIA stations obtained with meteospain with the map on the official website (https://www.juntadeandalucia.es/agriculturaypesca/ifapa/riaweb/web/), I realized that there must be an error in the processing.

The package assumes that the geographical coordinates of RIA stations are retrieved in a decimal degree (DD) format, but in reality they are in "degrees", "minutes" and "seconds" (DMS) format.

The following function could be used to convert (longitude or latidude) in this DMS format (DDMMSSsssH) to numeric DD:

.parse_coord_gmsh <- function(coord){
  gmsh <- stringr::str_sub_all(coord, 
        cbind(start = c(1, 3, 5, 10), length = c(2, 2, 5, 1)))
  sapply(gmsh, function(x) (as.numeric(x[1]) + as.numeric(x[2])/60 + 
         as.numeric(x[3])/3600000) * if (grepl(x[4],"W|S")) -1 else 1)
}
rubenfcasal added a commit to rubenfcasal/meteospain that referenced this issue Dec 16, 2023
MalditoBarbudo added a commit that referenced this issue Dec 18, 2023
@MalditoBarbudo
Copy link
Member

@rubenfcasal

This is now fixed in main and devel branches, I will maintain the issue open until the new package version is in CRAN

@MalditoBarbudo
Copy link
Member

New version 0.1.4 on its way to CRAN, I'll close this.

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

2 participants