getInterpolatedDataByCity: Get k-nearest station data, Filtered, Interpolated

Description Usage Arguments Details Value Examples

Description

This function applies four filters: 1) Remove stations with little to no data 2) Remove stations that exceed a maximum distance from each city's reference point 3) Remove stations that exceed a threshold of missing data, including NA values 4) Select closest station remaining for each city, as all remaining stations are deemed adequate

Usage

1
2
getInterpolatedDataByCity(city.list, station.list, k = 5, begin, end,
  distance = 100, hourly_interval = 3, tolerance = 0.05)

Arguments

city.list

City of list of Cities. The format should be as follows: "City, State", or "City, Country"

station.list

Full list of ISD stations included in the package

k

The number of stations to return

begin

Start year (4 digits)

end

End year (4 digits)

distance

Maximum distance allowable from each city's reference point

hourly_interval

Minimum hourly interval allowable (1=hourly; 3 = every 3 hours; 6 = every 6 hours, etc..)

tolerance

This is the percent, in decimals, of missing data you will allow. (.05 = 5% of total data)

Details

It then performs two steps to interpolate missing values: 1) Average over all data points in original dataset to find average hourly observations 2) Linearly interpolate hourly data points for missing observations

Value

Returns a single dataframe with hourly observations (including interpolated) of every city.

Examples

1
2
3
4
5
6
7
## Not run: 
data(stations)
cities <- c("Nairobi, Kenya", "Tema, Ghana", "Accra, Ghana", "Abidjan, Ivory Coast")
hourly.data <- getInterpolatedDataByCity(cities, station.list, 5, 2010, 2013, 100, 3, .05)
dim(hourly.data)

## End(Not run)

mpiccirilli/weatheR documentation built on May 23, 2019, 6:28 a.m.