WATCHcreateWFDEIobs: Creates a CRHM .obs file of 3-hourly values from WATCH...

View source: R/WATCHcreateWFDEIobs.R

WATCHcreateWFDEIobsR Documentation

Creates a CRHM .obs file of 3-hourly values from WATCH reanalysis data WFDEI files

Description

Extracts data from WATCH WDFEI netCDF files and builds a CRHM .obs file of 3-hour data containing t, ea, u10, and p values. The output values can be interpolated to hourly using the function HourlyWATCHobs. The windspeeds are at 10m, hence they are denoted as u10. Air temperatures are at 2m. The values for ea are computed from the atmospheric pressure (at 10m) and the absolute humidity (at 2m).

Usage

WATCHcreateWFDEIobs(
  nc.location = "",
  startyear = 1979,
  endyear = 2012,
  lon = 0,
  lat = 0,
  houroffset = 0,
  obsFileName = "",
  quiet = TRUE,
  logfile = ""
)

Arguments

nc.location

Required. A character string of the directory holding the WATCH WFDEI netCDf files. This is a file path WITHOUT a terminal slash, e.g. z:\WATCH\WFDEI

startyear

Optional. Year to begin. Must be in the range 1979-2012. Default is 1979.

endyear

Optional. Year to end. Must be in the range 1979-2012. Default is 2012.

lon

Required. Decimal longitude to extract for.

lat

Required. Decimal latitude to extract for.

houroffset

Required. Number of hours that the local location is offset from UTC (GMT). Must be negative in the western hemisphere. For Mountain Standard Time, the offset is -7 hours.

obsFileName

Required. Name of the .obs file to be created.

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.

logfile

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

Value

If successful, returns the value TRUE and writes the specified .obs file. Each month's data is written as it is created. If unsuccessful, returns the value FALSE.

Author(s)

Kevin Shook.

References

R code for conversion of air pressure and absolute humidity was taken from project PEcAn The Predictive Ecosystem Analyzer http://pecanproject.github.io. The source code is available at https://github.com/PecanProject/pecan/blob/master/modules/data.atmosphere/R/metutils.R.

Examples

## Not run: 
location <- 'z:\data\WATCH\WFDEI'
obsFileName <- 'VermilionWATCH_WFDEI.obs'
WATCHcreateWFDEIobs(location, 1979, 2001, -111.9, 53.2, -7, obsFileName)
## End(Not run)

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