CanRCM4unadjustedGetNearestTimeseries: Reads a time series for the nearest point from undadjusted...

View source: R/CanRCM4UnadjustedGetNearestTimeseries.R

CanRCM4unadjustedGetNearestTimeseriesR Documentation

Reads a time series for the nearest point from undadjusted CanRCM4

Description

This function extracts a time series of hourly values from a NetCDF file of CanRCM4 data, which has not been bias-corrected. The values are stored at a spatial resolution of 0.125 degees, so the closest point to the specified location will be used. Each NetCDF file contains a single variable. Typically the first letters of the file name designate the variable. The variables are converted to values, and variable names, appropriate for CRHM when they are extracted.

NetCDF parameter netCDF units CRHM Variable CRHM units
pr - hourly precip mm/s p mm
tas - surface air temp. K t C
huss - specific humidity dimensionless qair dimensionless
sfcWind - surface (10m) wind speed m/s u10 m/s
ps - surface pressure Pa ps Pa
rsds - incoming SW radiation W/^2 Qsi W/^2
rlds - incoming LW radiation W/^2 Qli W/^2

Usage

CanRCM4unadjustedGetNearestTimeseries(
  netCDFfile = "",
  longitude = 0,
  latitude = 0,
  startDate = "1979-01-01",
  endDate = "2100-12-01",
  timezone = "Etc/GMT+7",
  logfile = ""
)

Arguments

netCDFfile

Required. The name of a NetCDF file containing a single variable.

longitude

Required. The longitude of the point being sought. Valid values appear to be between -90 and -142, but the input value is not checked for validity, in case the model extent changes.

latitude

Required. The latitude of the point being sought. Valid values appear to be between 45 and 75, but the input value is not checked for validity, in case the model extent changes.

startDate

Optional. Beginning date of data to be extracted. A string formatted as "yyyy-mm-dd". The default value of 1979-01-01 is the beginning of the data.

endDate

Optional. Beginning date of data to be extracted. A string formatted as "yyyy-mm-dd". The default value of 2100-12-01 is the end of the data.

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.

logfile

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

Value

If successful, returns a standard CRHMr data frame containing the datetime and the variable. If unsuccessful, returns the value FALSE.

Examples

## Not run:  f <- "CanRCM4_r8i2p1r1_hist+fut_1979_2100_huss.nc4"
r <- RCM4UnadjustedGetNearestTimeseries(f, longitude=-115.27, 
latitude=52.03,  startDate = "1980-01-01", endDate="1980-12-31")

## End(Not run)

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