ropensci-archive / bomrang

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

Error when downloading data? #75

Closed lzb5600 closed 6 years ago

lzb5600 commented 6 years ago

when I run the following code:

library("bomrang") tmpweather <- get_historical( stationid = "066208", type = "min")

The error message occurred: Error in .get_zip_url(stationid, obscode) : Error in retrieving resource identifiers.

I can download some other data with other latlon/stationid, but for some of them this error occurred,

jonocarroll commented 6 years ago

Just checking - are you sure that's the stationid you used? I get the error "Station not recognised." which is what I'd expect to happen if the station wasn't listed in bomrang's internal database.

Could you perhaps post a reprex with si=TRUE?

jonocarroll commented 6 years ago

The internal database was updated recently, so it's possible that it's not fully aligned for get_historical(). I can't check until I update to R 3.5.

lzb5600 commented 6 years ago

Thank you @jonocarroll . I have modified the description of this issue. This should reproduce the error.

jonocarroll commented 6 years ago

If I visit the URL which should provide the intermediate data, I get

No data available
Unfortunately there are no data available for the site number you have entered. 
This may be because either the station number is invalid, or the station has not 
observed the type of data requested.

I can make this error visible to the user when detected.

Entering the stationid 066208 here: http://www.bom.gov.au/climate/data/ shows the same error. Do you have reason to think there should be data for this station?

lzb5600 commented 6 years ago

@jonocarroll Thanks. Actually, I am trying to get the historical weather condition for a set of latlon. When I loop through some coordinates, this error appears. I got the stationid from the error message.

For example, when I try:

get_historical(latlon = c(-34.21248, 150.9994), type = "min")

following message shows:

image

I am new to R, forgive me that I don't know how to use "reprex".

jonocarroll commented 6 years ago

Thank you, that's helpful. The 'Closest station' logic is supposedly finding the stationid physically closest to those coordinates, returning Wattamolla. According to the BOM search itself, it turns out Wattamolla has several stations

068218 068190 068161 (closed)

but it does not list 066208 at all.

Using the bureau's station finder with those coordinates it suggests many closed stations are close, and the nearest open station is 068024 Darkes Forest (Kintyre) NSW (~14km drive). Comparing to an actual map, Wattamolla Beach/Falls/etc... are a little further away (~25km drive).

None of the above stationids are recognised by bomrang.

In any case, I am starting to think this is an issue with sweep_for_stations and/or the known list of stations. @adamhsparks?

lzb5600 commented 6 years ago

I think I figure out the reason. When I try:

get_historical(latlon = c(-34.21248,150.9994), type = "solar")

It works and fetch the solar exposure data of station "066208". It seems that it just select the nearest weather station no matter what type of data we are requiring. This may result in the error.

jonocarroll commented 6 years ago

With that code I get

Closest station: 068219 (WOLLONGONG (APPIN))

jonocarroll commented 6 years ago

The search for nearest stations occurs regardless of which type is requested. We do not have a cache of which data are available at each station.

lzb5600 commented 6 years ago

@jonocarroll I have used update_forecast_towns() and update_station_locations(). May be this is the reason why we get different closest stations.

jonocarroll commented 6 years ago

That would have something to do with it, thank you.

adamhsparks commented 6 years ago

Closing this issue. Please feel free to reopen if you have further details about this issue.