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

incorrect station ids #261

Closed
johnrharley opened this issue Apr 12, 2018 · 4 comments
Closed

incorrect station ids #261

johnrharley opened this issue Apr 12, 2018 · 4 comments
Labels
Milestone

Comments

@johnrharley
Copy link

The included list of buoys as given by buoy_stations() returns a number of stations (especially in Southeast Alaska) with single digit values in the station column, which are incorrect and cannot be passed into the buoy() command.

I believe this is because these buoy ids are 5 digit alphanumeric identifiers (i.e. JNEA2) rather than the 5 digit numeric identifiers of most other stations.

A quick and dirty patch for most of these stations could be extracting the station id from the DC.description column which contains the station following the "station". This worked for me for pulling out the station ids I was interested in (using dplyr):

buoy_stations() %>%
  filter(lat > 55 & lat < 60, lon < -130 & lon > -140) %>% # southeast alaska coordinates
  mutate(station=ifelse(nchar(station)<4, # stations that weren't working had 1 or 2 digit station ids
                        substr(sapply(strsplit(DC.description, split = "station"), '[', 2),start=2, stop=6), 
                        station)) # if value is > 4 digits just return the original station name

There are a number of other stations in other regions with 1 or 2 digit station ids, so I suspect this will not work for all buoys.

Session Info
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rnoaa_0.7.0
@sckott sckott added this to the v0.8 milestone Apr 12, 2018
@sckott sckott added the bug label Apr 12, 2018
sckott added a commit that referenced this issue Apr 12, 2018
bump dev version
update buoy station datasets in inst/extdata/
@sckott
Copy link
Contributor

sckott commented Apr 12, 2018

thanks for the issue @johnrharley

just fixed

@sckott
Copy link
Contributor

sckott commented Apr 12, 2018

updated the cached data.frame in the pkg, and chagned the code internally to use async requests so it runs faster, and we i think correctly grab the station id now.

See what's cached with buoy_stations() and you can try buoy_stations(TRUE) to download new version if you like (though right now shouldn't differ from what was just cached in the pkg)

@johnrharley
Copy link
Author

Thanks Scott, I didn't try to download a new version but the cached data look great.

@sckott
Copy link
Contributor

sckott commented Apr 13, 2018

great, glad it works

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

No branches or pull requests

2 participants