read_grid | R Documentation |
read_grid
is a generic function to read gridded data from a file. A
transformation can optionally be applied to those data.
read_grid(
file_name,
parameter,
is_forecast = TRUE,
dttm = NULL,
file_format = NULL,
file_format_opts = list(),
vertical_coordinate = c("pressure", "model", "height", NA),
lead_time = NULL,
members = NULL,
transformation = c("none", "interpolate", "regrid", "xsection", "subgrid"),
transformation_opts = list(),
param_defs = get("harp_params"),
show_progress = TRUE,
data_frame = FALSE,
readable_times = TRUE,
spread_members = FALSE,
...
)
read_grid_interpolate(file_name, parameter, file_format = NULL, ...)
file_name |
A character string with the (full) file name. |
parameter |
The parameter to be read. |
is_forecast |
Logical. If TRUE (the default), data are filtered based on the forecast initialization time and the lead time. If FALSE, the data are filtered on the valid time. |
dttm |
A vector of date time strings of the form YYYYMMDD, YYYYMMDDhh,
YYYYMMDDhhmm, or YYYYMMDDhhmmss. For forecast data these would be the
forecast initialization times. |
file_format |
The file format. Possible values include grib, netcdf, FA, hdf5... Whatever the value is, it is supposed to correspond to a function "read_XXX" that can deal with the format. If not specified, the format can often be guessed correctly from file extension or the first few bytes. |
file_format_opts |
Options for the file format as generated by one of
the options functions, e.g. |
vertical_coordinate |
The vertical coordinate for upper air data. May be "pressure" for pressure levels, "model" for model levels or "height" for height levels. |
lead_time |
The lead times to read from a forecast file. If set to NULL, all lead times will be read from the file. |
members |
For ensemble data, the ensemble members to read from the file. If set to NULL all members will be read. |
transformation |
The transformation to apply to the gridded data. Can be "none", "interpolate", "regrid" or "xsection". |
transformation_opts |
Options for the transformation as generated by
|
param_defs |
A list of parameter definitions that includes the file
format to be read. By default the built in list |
show_progress |
Show progress when reading large amounts of data. |
data_frame |
Logical. For compatibility with current version of harpSpatial, make sure only a geofield is returned rather than a data frame when set to FALSE. |
readable_times |
When |
spread_members |
When |
... |
All arguments passed to the specified reader function. |
A geofield or (possibly) a plain matrix.
if (requireNamespace("Rgrib2", quietly = TRUE) & requireNamespace("harpData", quietly = TRUE)) {
read_grid(
system.file(
"grib/AROME_Arctic/2018/07/10/00/fc2018071000+000grib_fp",
package = "harpData"
),
parameter = "T2m"
)
read_grid(
system.file(
"grib/AROME_Arctic/2018/07/10/00/fc2018071000+000grib_fp",
package = "harpData"
),
parameter = "S10m"
)
read_grid(
system.file(
"grib/AROME_Arctic/2018/07/10/00/fc2018071000+000grib_fp",
package = "harpData"
),
parameter = "tcc"
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.