ERAgetMultipleLocationTimeseries: Extracts timeseries of ERA data nearest to multiple specified...

View source: R/ERAgetMultipleTimeseries.R

ERAgetMultipleLocationTimeseriesR Documentation

Extracts timeseries of ERA data nearest to multiple specified locations

Description

Reads a NetCDF file containing ERA reanalysis data and extracts the timeseries of the specified variable for each location. This is faster than calling the function ERAgetNearestTimseries for each location, as the reanalysis data are only read in once. 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

ERAgetMultipleLocationTimeseries(
  ncdfFile,
  varName,
  siteNames,
  outDir = "",
  pointLons,
  pointLats,
  projection = "+proj=utm +zone=13 +ellps=WGS84",
  timezones = "",
  quiet = TRUE,
  logfile = ""
)

Arguments

ncdfFile

Required. Name of the NetCDF file containing ERA data.

varName

Required. Name of the NetCDF variable to extract.

siteNames

Required. A vector containing the names of the sites. The names will be used for the output obs files.

outDir

Optional. Directory to hold output files. If not specified, the current directory will be used.

pointLons

Required. A vector containing decimal longitudes of desired locations. Note that the NetCDF longitude is 0-360, so add 360 to negative longitudes.

pointLats

Required. A vector containing decimal latitudes 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 .

timezones

Required. A vector containing 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. If there are fewer timezone values than variable names, the timezone will be recycled.

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 TRUE and all variables for all locations are written to obs files in the specified directory.

Author(s)

Kevin Shook

See Also

ERAgetNearestTimeseries ERAdeaccum

Examples

## Not run: 
ERAgetMultipleLocationTimeseries('ssrd.nc', 'ssrd', s$`Station Names`,  
pointLons = s$Longitude, pointLats = s$Latitude, projection='+proj=august +lon_0=90w', 
timezones=s$timezone, quiet=FALSE)
## End(Not run)

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