ws_metadata_by_date_2_pgdb: ws_metadata_by_date_2_pgdb() stores NOAA information into...

Description Usage Arguments Value Note Examples

Description

This function uses the metadata returned from all_coor_ws which in turn uses the rnoaa API to retrieve NOAA data. Metadata includes the mindate, and maxdate dates. Given a particular variable (i.e. TMAX, TMIN, PRCP, etc), we are interested to retrieve the number of weather stations whose time window defined by the interval [mindate, maxdate] intersects and the length of the time window is maximum. Searching for answers online,the solution is a hard computing problem. It belongs to the set of problems defined as the 'Maximum Subset Intersection' problem which are close-related to the set cover problem studied in graph theory. The following function computes a resulting set using an heuristic described through the comments in the body of the function. It starts with the current year and the span variable defines the threshold for the algorithm to search for the answers.

Usage

1
ws_metadata_by_date_2_pgdb(geoid, type, stations, ssDate, ffDate)

Arguments

geoid

FIPS number from census tables (tiger files)

type

Variable under investigation i.e. TMAX, TMIN, PRCP

stations

The universe of stations from the rnoaa API from where the new subset will be computed.

ssDate

Staring date from interval to retrieve weather data

ffDate

Final date from interval to retrieve weather data

Value

Returns the name of the new table of the subset of weather stations with intersecting data

Note

Remember that all_coor_ws() returns a set of stations.

Examples

1
2
3
4
stations <- as.data.frame(all_coor_ws( ghcnd = 'GHCND', geoid = '48113', type = 'TMAX'))
ssDate <- '2000-01-01'
ffDate <- '2001-01-01'
ws_metadata_by_date_2_pgdb( geoid = '48113', type = 'TMAX', stations, ssDate, ffDate) 

rabravo/ws2pgdb documentation built on May 26, 2019, 8:51 p.m.