ERAgetNearestTimeseries: Finds timeseries of ERA data nearest to specified location

View source: R/ERAgetNearestTimeseries.R

ERAgetNearestTimeseriesR Documentation

Finds timeseries of ERA data nearest to specified location

Description

Reads a NetCDF file containing ERA reanalysis data and extracts the timeseries of the specified variable. Some of the the commonly-used variables are:

Parameter Units Variable
10 m eastward wind component m/s u10
10 m northward wind component m/s v10
2 metre temperature K t2m
2 metre dewpoint K d2m
Downward surface solar radiation* J/m^2 ssrd
Downward surface thermal radiation* J/m^2 strd
Surface net solar radiation* J/m^2 ssr
Surface net thermal radiation* J/m^2 str
Total precipitation* m of water tp

Parameters marked with an asterisk are cumulative values, and must be deaccumulated using the deaccumERA function.

Usage

ERAgetNearestTimeseries(
  ncdfFile,
  varName,
  pointLon,
  pointLat,
  projection = "+proj=utm +zone=13 +ellps=WGS84",
  timezone = "",
  quiet = TRUE,
  logfile = ""
)

Arguments

ncdfFile

Required. 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 0-360, so add 360 to negative longitudes.

pointLat

Required. Decimal latitude of desired location.

projection

Optional. Projection to be used to convert latitudes and longitudes to locations. Used for finding the nearest ERA gridpoint. The default, +proj=utm +zone=13 +ellps=WGS84, is only valid for Western Canada. If you are processing data for the whole world, you can use the August Epicycloidal Projection which is +proj=august +lon_0=90w .

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).

Author(s)

Kevin Shook

See Also

ERAdeaccum

Examples

## Not run: 
ssrd <- ERAgetNearestTimeseries('ssrd.nc', 'ssrd', 243.5, 51.69, timezone='Etc/GMT+7')
t2m <- ERAgetNearestTimeseries('t2m.nc', 't2m', 243.5, 51.69, timezone='Etc/GMT+7')
tp <- ERAgetNearestTimeseries('tp.nc', 'tp', 243.5, 51.69, timezone='Etc/GMT+7')
strd <- ERAgetNearestTimeseries('strd.nc', 'strd', 243.5, 51.69, timezone='Etc/GMT+7')
u10 <- ERAgetNearestTimeseries('u10v10.nc', 'u10', 243.5, 51.69, timezone='Etc/GMT+7')
v10 <- ERAgetNearestTimeseries('u10v10.nc', 'v10', 243.5, 51.69, timezone='Etc/GMT+7')
d2m <- ERAgetNearestTimeseries('d2m.nc', 'd2m', 243.5, 51.69, timezone='Etc/GMT+7')
## End(Not run)

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