ropensci-archive / bomrang

:warning: ARCHIVED :warning: Australian government Bureau of Meteorology (BOM) data client for R
Other
109 stars 26 forks source link

get_current_weather - JSON files not found, but they do exist #100

Closed ozjimbob closed 5 years ago

ozjimbob commented 5 years ago

In the get_current_weather function, a number of stations, or lat/long queries, return the error "However, a corresponding JSON file was not found at bom.gov.au.". However, the corresponding JSON files do appear to exist - I'm assuming the BOM have moved or changed something and bomrang needs updating to reflect the change? Example below is for "Canberra" - looking at the BOM's website, the appropriate JSON file does appear to exist and contain data, at the URL:

http://reg.bom.gov.au/fwo/IDN60903/IDN60903.94926.json

However, looking at the get_current_weather function itself, it attempts to load this URL, which does not exist:

http://www.bom.gov.au/fwo/IDNA60801/IDNA60801.94926.json

Session Info R version 3.4.4 (2018-03-15) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.3 LTS Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.0 LAPACK: /usr/lib/lapack/liblapack.so.3.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] readr_1.3.1 httr_1.4.0 stringr_1.0.0 tibble_2.1.3 purrr_0.3.2 sf_0.7-4 lubridate_1.7.4 [8] ncdf4_1.16.1 threddscrawler_0.1 bomrang_0.5.0 rvest_0.3.4 xml2_1.2.0 Rook_1.1-1 rgdal_1.4-4 [15] maptools_0.8-39 rjson_0.2.15 raster_2.9-5 sp_1.3-1 dplyr_0.8.2 RPostgreSQL_0.4 DBI_1.0.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.1 pillar_1.4.2 compiler_3.4.4 class_7.3-9 tools_3.4.4 digest_0.6.9 jsonlite_1.6 [8] lattice_0.20-33 pkgconfig_2.0.2 rlang_0.4.0 rstudioapi_0.10 curl_3.3 e1071_1.6-7 hms_0.4.2 [15] rappdirs_0.3.1 classInt_0.3-3 grid_3.4.4 tidyselect_0.2.5 glue_1.3.1 data.table_1.12.2 R6_2.4.0 [22] XML_3.98-1.20 foreign_0.8-59 selectr_0.4-1 hoardr_0.5.2 magrittr_1.5 units_0.6-3 codetools_0.2-8 [29] assertthat_0.2.1 brew_1.0-6 KernSmooth_2.23-15 stringi_1.0-1 crayon_1.3.4 ```r library(bomrang) get_current_weather("Canberra") ``` Returns error: **Error: A station was matched. However, a corresponding JSON file was not found at bom.gov.au.**
adamhsparks commented 5 years ago

I'll have a look later.

Do they appear if you update the internal list? https://docs.ropensci.org/bomrang/articles/bomrang.html#using-the-update-functions

ozjimbob commented 5 years ago

That's an excellent point - I wasn't aware of that function (silly me). However, running it doesn't help. Both update_forecast_towns() and update_station_locations() return the following error:

> update_station_locations()
This will overwrite the current internal databases of BOM stations.
If reproducibility is necessary, you may not wish to proceed.
Do you understand and wish to proceed (Y/n)?

Error in readLines(con = getOption("bomrang_connection"), n = 1) : 'con' is not a connection

Note that I never actually pressed Y or N to proceed - the error appeared immediately on running the function.

adamhsparks commented 5 years ago

Ah, OK. That's a bug to be fixed.

adamhsparks commented 5 years ago

I've confirmed the first issue as well. I'll see what I can do to get both corrected. Thanks for opening this issue.

adamhsparks commented 5 years ago

I think I've found it. BOM changed something in the designations. I've had to recreate the databases and rewrite the function for the end-user to update them as well, but I think it's working now.

I've fixed the other issue you noted with not being able to run update_station_locations(), I think. Running checks on rhub now and hopefully will merge into devel branch tonight with an aim to get a release submitted to CRAN tomorrow.

EwenH commented 5 years ago

On an acute tagent. Have you heard about the "new" api that was supposed to replace all these easy to consume files via a single portal. This is clearly not for simplicity, rather monetisation. It looks like the project has stalled significantly atmbut I am sure it will reappear over time.

adamhsparks commented 5 years ago

Yeah, I've heard rumblings about it but seen little real substance.

If it is a "real" API, that's OK. It would take time to rewrite the package, but I think we could, I (re)wrote nasapower, when NASA did the same thing, gory details. If it's not open, that's another matter that we obviously have no control over.

adamhsparks commented 5 years ago

Closed with release 0.6.0