View source: R/CanRCM4adjustedGetNearestTimeseries.R
CanRCM4adjustedGetNearestTimeseries | R Documentation |
This function extracts a time series of 3-hourly values from a NetCDF file of CanRCM4 data, which has been bias-corrected using the WFDEI 3-hour reanalysis values. The values are stored at a spatial resolution of 0.125 degees, so the closest point to the specified location will be used. Note that because the reanalysis data omit February 29, the values returned by this function will have NA
values for leap days. You will have to fill these values yourself.
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 - 3hr 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 |
CanRCM4adjustedGetNearestTimeseries( netCDFfile = "", longitude = 0, latitude = 0, startDate = "1979-01-01", endDate = "2100-12-01", timezone = "", logfile = "" )
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. Ending 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. |
If successful, returns a standard CRHMr data frame containing the datetime and the variable. If unsuccessful, returns the value FALSE
.
## Not run: f <- "ps_CanRCM4_hist+fut_1979_2100.nc4" r <- RCM4adjustedGetNearestTimeseries(f, longitude=-115.27, latitude=52.03, startDate = "1980-01-01", endDate="1980-12-31") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.