GetGhcn: Get GHCN-D data for specified siteIds.

Description Usage Arguments Value See Also Examples

View source: R/ghcn_get.R

Description

GetGhcn downloads the daily GHCN (Global Historic Climatology Network) data for each site in siteIds and creates a dataframe containing five fields: siteIds, date, daily GHCN value, the qFlag and the element. Data has become available in two formats either categorized by gauge station (use GetGhcn) or categorized by year (use GetGhcn2). If there are many gauges, then GetGhcn2 would be much faster.

Usage

1
2
GetGhcn(siteIds, elements, startDate = NULL, endDate = NULL,
  parallel = FALSE, fileAdd = NULL)

Arguments

siteIds

A single siteId or vector of siteIds. SiteIds should match the standardized GHCN-D IDs (for example : ACW00011604). See http://www1.ncdc.noaa.gov/pub/data/ghcn/daily/ghcnd-stations.txt for a list of siteIds.

elements

A character vector defining what type of observation you are interested in. There are five core elements as well as a number of additional elements. The five core elements are:

PRCP

= Precipitation (tenths of mm), the precipitation will be converted to mm when calling GetGhcn or GetGhcn2

SNOW

= Snowfall (mm)

SNWD

= Snow depth (mm)

TMAX

= Maximum temperature (tenths of degrees C)

TMIN

= Minimum temperature (tenths of degrees C)

For the full list of elemenst refer to ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt

startDate, endDate

Date.

parallel

Logical (DEFAULT=FALSE)

fileAdd

Address to the url containg all the daily GHCN data, default is http://www1.ncdc.noaa.gov/pub/data/ghcn/daily/all/

Value

A dataframe containing the date, corresponding daily GHCN-D value, the qFlag and the element.

See Also

Other GHCN: CalcDailyGhcn, GetGhcn2, SelectGhcnGauges

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
siteIds=c("ACW00011604","AJ000037579","AJ000037883","ASN00005095")
startDate="1949/02/01"
endDate="1949/10/01"
element="PRCP"
obsPrcp<-GetGhcn(siteIds,element,startDate,endDate,parallel=FALSE)

## End(Not run)

# Or you could use the results of SelectGhcnGauges:
## Not run: 
countryCodeList=c("US")
networkCodeList=c("1")
statesList=c("WY")
selectedGauges<-SelectGhcnGauges(countryCode=countryCodeList,
                                 networkCode=networkCodeList,
                                 states=statesList)
obsPrcp<-GetGhcn(selectedGauges$siteIds,element,startDate,endDate,parallel=FALSE)

## End(Not run)

NCAR/rwrfhydro documentation built on Feb. 28, 2021, 12:47 p.m.