WATCHgroupWFDEIobs: Create obs files from WATCH WFDEI data for groups of sites

View source: R/WATCHgroupWFDEIobs.R

WATCHgroupWFDEIobsR Documentation

Create obs files from WATCH WFDEI data for groups of sites

Description

Extracts all variables from WFDEI NetCDF files and builds obs files for all specified locations

Usage

WATCHgroupWFDEIobs(
  siteFile,
  ncLocation,
  outputLocation,
  startyear = 1979,
  endyear = 2001,
  solarMethod = "PotSolarInst",
  interpolationMethod = "linear",
  quiet = TRUE,
  logfile = ""
)

Arguments

siteFile

Required. A .csv file containing all of the variables required to describe the site locations. These are:

Name

Name of site

Land

Land ID number

Longitude

Site longitude

Latitude

Site latitude

glon

Site glon value

glat

Site glat value

timezone

Time zone for site. Must be in Etc format, e.g. Etc/GMT+7

SolarOffset

Local offset of solar noon in hours

ncLocation

Required. Location of all of the WATCH WFD files. Must have a trailing '\' symbol.

outputLocation

Required. Location for all of the output files. Must have a trailing '\' symbol.

startyear

Optional. Year to begin extraction. Default is 1901.

endyear

Optional. Year to begin extraction. Default is 2001.

solarMethod

The method to be used for calculating the extra-terrestrial radiation. The default method is PotSolarInst, which requires the package EcoHydRology to be installed. The other supported method is simpleMaxSolar. Note that this method is only valid for latitudes between 49 and 55 N.

interpolationMethod

Optional. A vector containing the methods to be used for interpolation for each of the variables. Currently supported methods are linear and spline. The default is to use linear interpolation. If fewer methods than columns are specified, the methods are 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.

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: 
points <- './Reanalysis/testdata/WATCH_selected_points.csv'
outputLocation <- './Reanalysis/testdata/'
ncloc <- '//water.usask.ca/Centre/Reanalysis_data/WATCH/WFD'
WATCHgroupWFDEIobs(siteFile = points, ncLocation = ncloc, outputLocation=outputLocation, 
startyear = 1962, endyear = 1962))

## End(Not run)

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