Description Usage Arguments Value Note Examples
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.
1 | ws_metadata_2_pgdb(geoid, type, stations)
|
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. |
function returns the name of the new table of the subset of weather stations with intersecting data
Remember that all_coor_ws() returns a set of stations.
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 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.