View source: R/WRFnearest2obs.R
WRFnearest2obs | R Documentation |
This function is intended to work with NetCDF created by the research group of Dr. Yanping Li of Global Water Futures gwf.usask.ca. This function creates a CRHMr data frame from a WRF NetCDF specified by their longitude and latitude, extracting values from the nearest location.
WRFnearest2obs( NetCDF = "", obsfile = "", longitude = 0, latitude = 0, airPressure = 0, returnRH = TRUE, restrictRH = TRUE, startDatetime = "2000-10-01 00:00", endDatetime = "2100-12-01 23:00", timezone = "", trim = TRUE, quiet = TRUE, logfile = "" )
NetCDF |
Required. The name of the netCDF file containing the WRF data. |
obsfile |
Optional. If specified the values are written to the |
longitude |
Required. The longitude of the point being sought. The input value is not checked for validity, in case the model extent changes. |
latitude |
Required. The latitude of the point being sought. The input value is not checked for validity, in case the model extent changes. |
airPressure |
Optional. The mean air pressure in Pa. If set to zero (the default) then the air pressure within the NetCDf file will be used for converting the specific humidity to relative humidity. Because the air pressure may be incorrect or missing, you may wish to specify a mean air pressure to be used for the conversion. Note that if there is no air pressure within the NetCDF and you do not specify an air pressure value, this will trigger an error message, and the RH cannot be calculated. |
returnRH |
Optional. If |
restrictRH |
Optional. If |
startDatetime |
Optional. Beginning date of data to be extracted. A string formatted as "yyyy-mm-dd hh:mm". The default value is 2000-10-01 00:00. |
endDatetime |
Optional. Ending date of data to be extracted. A string formatted as "yyyy-mm-dd hh:mm". The default value is 2100-12-01 23:00. |
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. |
trim |
Optional. If |
quiet |
Optional. Suppresses display of messages, except for errors. If you are calling this function in an R script, you will usually leave |
logfile |
Optional. Name of the file to be used for logging the action. Normally not used. |
If successful, returns either TRUE
(if an obs file is specified) or a CRHMr obs data frame (if no obs file is specified). The data frame will contain the standard CRHM variables: t, p, u, either rh or ea, qsi, and qli, depending on their presence in the NetCDF. Note that the precipitation is the accumulated value, because it can contain negative spikes and resets. To deaccumulate the precipitation, you will have to use the CRHMr weighing gauge functions, such as weighingGauge1
, to fill gaps, weighingGauge2
or weighingGauge5
to remove resets. You can use weighingGaugeInterval
to deaccumulate the values. Note that because these functions use thresholds to define missing values, spike and resets, they need to be used interatively. You can use the weighingGaugePlot
to see how well the data are being processed. You may also need to remove too-large precipitation events. If unsucessful, returns FALSE
.
Kevin Shook
WRFbyloc2obs
## Not run: f <- "wrf2d_tquvr.nc" r <- WRFnearest2obs(f, longitude=-115.27, latitude=52.03, startDatetime = "1980-01-01 00:00", endDatetime="1980-12-31 23:00") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.