GetGhcn2: Get GHCN-D data for specified siteIds.

Description Usage Arguments Value See Also Examples

View source: R/ghcn_get.R

Description

GetGhcn2 downloads the daily GHCN (Global Historic Climatology Network) data for each site in siteIds and creates a dataframe containing the fields: siteIds, date, element, daily GHCN value, mFlag, qFlag, sFlag and reportTime. This is a faster function compared to GetGhcn if you have many sites.

Usage

1
2
GetGhcn2(siteIDs, elements, startDate, endDate, 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 the csv files of daily GHCN by year. default is http://www1.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/

Value

A dataframe containing the siteIds, date, daily GHCN-D, element, sFlag, qFlag, mFlag and reportTime. If the element is PRCP, then divide the numbers by 10 to convert to mm. For more information on possible outcomes of flags and their meaning, refer to http://www1.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/readme.txt

See Also

Other GHCN: CalcDailyGhcn, GetGhcn, 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="2015/02/01"
endDate="2015/10/01"
element="PRCP"
obsPrcp<-GetGhcn2(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<-GetGhcn2(selectedGauges$siteIds,element,startDate,endDate,parallel=FALSE)

## End(Not run)

mccreigh/rwrfhydro documentation built on Feb. 28, 2021, 1:53 p.m.