NARRgetNearestTimeseries: Finds timeseries of NARR data nearest to specified location

View source: R/NARRgetNearestTimeseries.R

NARRgetNearestTimeseriesR Documentation

Finds timeseries of NARR data nearest to specified location

Description

Reads a NARR NetCDF file, which contains all of the 3-hour values of a single variable for a single year, and extracts the values for a single location. Note that the values are NOT quality controlled - negative precipitation values are possible.

Usage

NARRgetNearestTimeseries(
  ncdfFile,
  varName,
  pointLon,
  pointLat,
  timezone = "",
  quiet = TRUE,
  logfile = ""
)

Arguments

ncdfFile

Name of the NetCDF file containing ERA data.

varName

Required. Name of the NetCDF variable to extract.

pointLon

Required. Decimal longitude of desired location. Note that the NetCDF longitude is East, your value should be negative.

pointLat

Required. Decimal latitude of desired location.

timezone

Required. The name of the timezone of the data as a character string. This should be the timezone of your data, but omitting daylight savings time. Note that the timezone code is specific to your OS. To avoid problems, you should use a timezone without daylight savings time. Under Linux, you can use CST and MST for Central Standard or Mountain Standard time, respectively. Under Windows or OSX, you can use etc/GMT+6 or etc/GMT+7 for Central Standard and Mountain Standard time. DO NOT use America/Regina as the time zone, as it includes historical changes between standard and daylight savings time.

quiet

Optional. Suppresses display of messages, except for errors. If you are calling this function in an R script, you will usually leave quiet=TRUE (i.e. the default). If you are working interactively, you will probably want to set quiet=FALSE, as it will list the actual latitude and longitude of the ERA tile.

logfile

Optional. Name of the file to be used for logging the action. Normally not used.

Value

If unsuccessful, returns FALSE. If successful, returns a standard CRHMr dataframe containing the datetime and the extracted data, which are unpacked (i.e. the NetCDF multiplier and offset have been applied). If quiet=FALSE, then the NARR location used and its distance to the specified location will be displayed.

If unsuccessful, returns FALSE. If successful, returns a CRHMr data frame of the specified variable. Note that no unit conversions are done, so the variable will be in the NARR units.

Examples

## Not run: 
p1979 <- NARRgetNearestTimeseries('acpcp.1979.nc', varName='acpcp', pointLon = -113, 
pointLat = 52, timezone = 'CST', quiet=FALSE)
## End(Not run)

CentreForHydrology/Reanalysis documentation built on Nov. 23, 2022, 2:57 a.m.