ws_metadata_2_pgdb: ws_metadata_2_pgdb() stores metadata of NOAA info into a...

Description Usage Arguments Value Note Examples

Description

This function works in cascade with the all_coor_ws(). This function uses the mindate and maxdate returned from the rnoaa API data frame. Weather stations are described in terms of mindate, and maxdate dates, were weather data is available. Hence, 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, it seems that this 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.

Usage

1
ws_metadata_2_pgdb(geoid, type, stations)

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.

Value

function 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
5
ghcnd    <- 'GHCND'
geoid    <- '12087'
type     <- 'TMAX'
stations <- as.data.frame( all_coor_ws( ghcnd, geoid, type) )
ws_metadata_2_pgdb( geoid, type, stations ) 

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