df_2_pgdb: df_2_pgdb() stores weather station in database

Description Usage Arguments Value Note Examples

Description

This function takes a data frame (with weather stations' information) and saves it as a table in a Postgres database. The function necessitates arguments: ghcnd, type, geoid, and the data frame.

Usage

1
df_2_pgdb(ghcnd, geoid, type, coor_ws, suffix)

Arguments

ghcnd

String that refers to the Global Historical Climate Network (daily) dataset

geoid

FIPS number from census tables

type

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

coor_ws

Data frame with noaa weather station information

suffix

Help to name table at the database

Value

Function returns a data frame. When fails store the information, it return 1.

Note

The output table name has the following form: st_co_geoid_ws_suffix_type "st" is the U.S. State, and "co" is the U.S. County name. "geoid" is the fips identifier. "suffix" a character string to identify table,and "type" is the weather variable (i.e. TMAX,TMIN,PRCP). The function assumes that a cb_2013_us_state_20m and a cb_2013_us_county_20m exist in the postgres database.

Examples

1
2
ncdc.df <- as.data.frame(all_coor_ws(ghcnd = 'GHCND', geoid = '36061', type = 'PRCP'))
df_2_pgdb(ghcnd = 'GHCND', geoid = '36061', type = 'PRCP', ncdc.df, suffix = 'example')

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