Read deterministic forecast files and interpolate to stations.
Source:R/read_det_interpolate.R
read_det_interpolate.Rd
This function was deprecated as read_forecast is much more flexible.
Usage
read_det_interpolate(
start_date,
end_date,
det_model,
parameter,
lead_time = seq(0, 48, 3),
by = "6h",
file_path = "",
file_format = "vfld",
file_template = "vfld_det",
stations = NULL,
correct_t2m = TRUE,
keep_model_t2m = FALSE,
lapse_rate = 0.0065,
vertical_coordinate = c("pressure", "model", "height", NA),
clim_file = NULL,
clim_format = file_format,
interpolation_method = "nearest",
use_mask = FALSE,
sqlite_path = NULL,
sqlite_template = "fctable_det",
sqlite_synchronous = c("off", "normal", "full", "extra"),
sqlite_journal_mode = c("delete", "truncate", "persist", "memory", "wal", "off"),
return_data = FALSE,
...
)
Arguments
- start_date
Date of the first forecast to be read in. Should be in YYYYMMDDhh format. Can be numeric or charcter.
- end_date
Date of the last forecast to be read in. Should be in YYYYMMDDhh format. Can be numeric or charcter.
- det_model
The name of the deterministic model. May be expressed as a vector if more than one model is wanted.
- parameter
The parameters to read as a character vector. For reading from vfld files, set to NULL to read all parameters, or set
veritcal_coordinate = NA
to only read surface parameters. Seeshow_harp_parameters
to get the possible parameters.- lead_time
The lead times to read as a numeric vector.
- by
The time between forecasts. Should be a string of a number followed by a letter (the defualt is "6h"), where the letter gives the units - may be d for days, h for hours or m for minutes.
- file_path
The path for the forecast files to read. file_path will, in most cases, form part of the file template.
- file_format
The format of the files to read. Can be "vfld", "grib", "netcdf", "fa", or "fatar".
- file_template
The file template for the files to be read. For available built in templates see
show_file_templates
. If anything else is passed, it is returned unmodified, or with substitutions made for dynamic values. Available substitutions are YYYY for year, {MM} for 2 digit month with leading zero, {M} for month with no leading zero, and similarly {DD} or {D} for day, {HH} or {H} for hour, {mm} or {m} for minute. Also {LDTx} for lead time where x is the length of the string including leading zeros - can be omitted or 2, 3 or 4. Note that the full path to the file will always be file_path/template.- stations
A data frame of stations with columns SID, lat, lon, elev. If this is supplied the forecasts are interpolated to these stations. In the case of vfld files, this is ignored and all stations found in the vfld are used. In the case of gridded files (e.g. grib, netcdf, FA), if no data frame of stations is passed a default list of stations is used. This list can be accessed via
station_list
.- correct_t2m
A logical value to tell the function whether to height correct the 2m temperature forecast, if it is included in the
parameter
argument, from the model elevation to the observation elevation. The default is TRUE.- keep_model_t2m
A logical value to tell the function whether to keep the original 2m temperature from the model as well as the height corrected values. If set to TRUE the this parameter gets the name "T2m_uncorrcted". The default is FALSE.
- lapse_rate
The lapse rate, in Kelvins per meter, to use when height correcting the 2m temperature. The defaul is 0.0065 K/m.
- vertical_coordinate
If upper air for multiple levels are to be read, the vertical coordinate of the data is given here. The default is "pressure", but can also be "model" for model levels, or "height" for height above ground /sea level.
- clim_file
The name of a file containing information about the model domain. Must include orography (surface geopotential), but can also include land-sea mask.
- clim_format
The file format of
clim_file
. Can be "grib", "fa", "fatar", or "netcdf".- interpolation_method
The interpolation method to use. Available methods are "bilinear", "bicubic", or "nearest". The default is "nearest", which takes the nearest grid points to the stations.
- use_mask
A logical value to tell the function whether to include a land-sea mask in the interpolation. The land-sea mask must exist in either the
clim_file
or in the forecast files.- sqlite_path
If not NULL, sqlite files are generated and written to the directory specified here.
- sqlite_template
The template for the filenames of the fctable files. See
show_file_templates
for available built in templates - for forecast sqlite files, these are templates beginning "fctable_". The default is "fctable_det".- sqlite_synchronous
The synchronus setting for sqlite files. The defualt is "off", but could also be "normal", "full", or "extra". See https://www.sqlite.org/pragma.html#pragma_synchronous for more information.
- sqlite_journal_mode
The journal mode for the sqlite files. The default is "delete", but can also be "truncate", "persist", "memory", "wal", or "off". See https://www.sqlite.org/pragma.html#pragma_journal_mode for more information.
- return_data
A logical indicating whether to return the read data to the calling environment. The default is FALSE to avoid memory overload.
- ...
Extra options depending on file format.