View source: R/transform_options.R
interpolate_opts | R Documentation |
When reading gridded data, three transformations are available: interpolate, regrid and xsection. Each of these transformations requires their own set of options, and these functions are used to generate those options.
interpolate_opts(
stations,
method = c("nearest", "bilinear", "bicubic", "closest"),
correct_t2m = TRUE,
keep_model_t2m = FALSE,
lapse_rate = 0.0065,
clim_file = NULL,
clim_file_format = NULL,
clim_file_opts = NULL,
clim_param = "sfc_geo",
use_mask = FALSE,
weights = NULL,
keep_raw_data = FALSE
)
regrid_opts(
new_domain = NULL,
method = "nearest",
clim_file = NULL,
clim_file_format = NULL,
clim_file_opts = NULL,
clim_param = "sfc_geo",
weights = NULL,
keep_raw_data = FALSE
)
xsection_opts(
a,
b,
horizontal_res = 2500,
vertical_res = log(10),
clim_file = NULL,
clim_file_format = NULL,
clim_file_opts = NULL,
clim_param = "sfc_geo",
method = "bilinear",
levels_ascending = TRUE,
keep_raw_data = FALSE,
...
)
subgrid_opts(x1, x2, y1, y2, ...)
stations |
A data frame of points to interpolate to. Must have the columns 'SID', for a station ID, lat for latitude and lon for longitude. |
method |
The interpolation method. Can be 'nearest' or 'closest' for
nearest neighbour interpolation, 'bilinear', or 'bicubic'. For
|
correct_t2m |
Logical. Whether to make a height correction to 2m temperature to account for differences between the model elevation and the station elevation. |
keep_model_t2m |
Logical. Whether to keep the uncorrected 2m temperature
if |
lapse_rate |
The lapse rate in K/m to use for the 2m temperature heigth correction. The default is the standard moist adiabitic lapse rate of 0.0065 K/m. |
clim_file |
A file containing model orography or surface geopential on the same grid as the data to be read in so that height corrections to 2m temperature can be made. It will also contain a land sea mask if masked interpolation is to be done. For initialising the domain, any parameter, passed in 'clim_param' can be used. |
clim_file_format |
The format of the clim_file. If set to NULL, a guess will be made. |
clim_file_opts |
Options for reading the clim_file, depending on the format of the clim_file. |
clim_param |
The parameter to read from 'clim_file'. If
|
use_mask |
Logical. Whether to use a mask in the interpolation. Requires that 'stations' has an 'lsm' column and clim_file includes a land-sea mask. |
weights |
Interpolation weights if they have already been calculated. |
keep_raw_data |
Logical. Whether to keep the untransformed full gridded data field. The default is FALSE. |
new_domain |
A geofield or geodomain object on the grid to which the data should be regridded. |
a |
A length 2 numeric vector with the longitude and latitude of the left hand edge of the cross section. |
b |
A length 2 numeric vector with the longitude and latitude of the right hand edge of the cross section. |
horizontal_res |
The horizontal grid length of the cross section in meters. The default is 2500m. |
vertical_res |
The vertical grid length of the cross section. For data on pressure levels or model levels this should be in hPa. For data on height levels this should be in meters. The default is log(10). |
levels_ascending |
The order of the level values. In the output the
levels are numbered for simple plotting. Set to |
x1 |
left x index of the subdomain |
x2 |
right x index of the subdomain |
y1 |
bottom y index of the subdomain |
y2 |
top y index of the subdomain |
interpolate_opts
generates options for interpolating gridded data to
points, or stations. If no stations are passed, a default list of stations,
accessed from the harpIO built in dataset stations_list is used. If 2m
temperature is to be read, the deafult behaviour is to attempt to height
correct for differences between the model elevation and the elevation at the
actual station. The default interpolation method is nearest-neighbour.
regrid_opts
generates options to regrid the data from its native grid
to a new grid. The new grid is specified either as a
geofield or geodomain object.
read_grid can be used to read a geofield, or
Make.domain can be used to make a geodomain. The default
interpolation method is nearest-neighbour.
xsection_opts
generates options to extract a vertical cross section
from three dimensional gridded data. a
and b
denote the left
and right hand extents of the vertical cross section. By defualt the cross
sections are interpolated horizontally to a 2.5 km grid length. In the
vertical, if data are on model levels or pressure levels, these are converted
to log(pressure) and by default interpolated to to log(10) hPa levels. The
default interpolation method is bilinear interpolation.
A list of options that will be used in the transformation.
interpolate_opts()
if (requireNamespace("Rgrib2", quietly = TRUE) & requireNamespace("harpData", quietly = TRUE)) {
new_domain = read_grid(
system.file(
"grib/AROME_Arctic/2018/07/10/00/fc2018071000+000grib_fp",
package = "harpData"
),
parameter = "T2m"
)
regrid_opts(new_domain = new_domain)
}
xsection_opts(a = c(5.3, 60.5), b = c(10.8, 59.9))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.