checkSummarizedDataAvailability: Quick Check to see if WeatherUnderground has Summarized...

Description Usage Arguments Value Examples

View source: R/wrapper_functions.R

Description

Before we attempt to fetch the data for a big time interval of dates, this function is useful to see if the data even exists. @details This functions build a custom URL and checks for the data. If available, it will find one row for each date in the date range.

Usage

1
2
checkSummarizedDataAvailability(station_id, start_date, end_date = NULL,
  station_type = "airportCode")

Arguments

station_id

is a valid 3-letter airport code or a valid Weather Station ID

start_date

is a valid string representing a date in the past (YYYY-MM-DD, all numeric)

end_date

is a a valid string representing a date in the past (YYYY-MM-DD, all numeric) and is greater than start_date. Default is NULL, in which case the end_date is taken to the same as the start_date

station_type

is either airportCode or id

Value

1 if the Station did have weather records, 0 if nothing was found

Examples

1
2
3
4
5
6
## Not run: 
data_okay <- checkSummarizedDataAvailability("GIG", 
                                             "2000-01-01",
                                             "2005-12-31")

## End(Not run)

Example output

URL to Try:
 https://www.wunderground.com/history/airport/GIG/2000/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2005&req_city=NA&req_state=NA&req_statename=NA&format=1

Retrieving from: https://www.wunderground.com/history/airport/GIG/2000/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2005&req_city=NA&req_state=NA&req_statename=NA&format=1
URL does not seem to exist: https://www.wunderground.com/history/airport/GIG/2000/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2005&req_city=NA&req_state=NA&req_statename=NA&format=1
The original error message:
Failed to connect to www.wunderground.com port 443: Connection refusedChecking Summarized Data Availability For GIG
Found 0 records for 2000-01-01 to 2005-12-31
Data is Not Available
Warning message:
In isObtainedDataValid(wxdata, station_id, custom_url) :
  There seems to be no data in the URL.
Try going to the URL via your browser and seeing if there is data.
                    
 Inspect the validity of the URL being tried:
 https://www.wunderground.com/history/airport/GIG/2000/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2005&req_city=NA&req_state=NA&req_statename=NA&format=1 

weatherData documentation built on June 6, 2017, 1:02 a.m.