read_eps_interpolate: Read ensemble forecast files and interpolate to stations.

View source: R/read_eps_interpolate.R

read_eps_interpolateR Documentation

Read ensemble forecast files and interpolate to stations.

Description

[Deprecated] This function was deprecated as read_forecast is much more flexible.

Usage

read_eps_interpolate(
  start_date,
  end_date,
  eps_model,
  parameter,
  lead_time = seq(0, 48, 3),
  members_in = seq(0, 9),
  members_out = members_in,
  lags = NULL,
  by = "6h",
  file_path = "",
  file_format = "vfld",
  file_template = "vfld_eps",
  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_eps",
  sqlite_synchronous = c("off", "normal", "full", "extra"),
  sqlite_journal_mode = c("delete", "truncate", "persist", "memory", "wal", "off"),
  remove_model_elev = FALSE,
  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.

eps_model

The name of the EPS model. Maybe expressed as a vector if more than one EPS model is wanted, or a list for multimodel EPS.

parameter

he 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. See show_harp_parameters to get the possible parameters.

lead_time

The lead times to read as a numeric vector.

members_in

The input member numbers. If only one EPS is set in eps_model then this is a vector. If more than one EPS is set in eps_model, or a multimodel EPS is wanted, then this is a list.

members_out

The ouput member numbers. Must be the same form as members_in. If not passed, members_out is set to the same as members_in.

lags

For reading files from a lagged forecast with members run at different times, the lag times are set here. The times are expressed as a character vector, or a named list of character vectors in the case of more than one model in eps_model, with a number followed by a letter giving the units. The avialable units are d, h, m, s for days, hours, minutes and seconds. The lags argument, if not set to NULL must have exactly the same dimensions as members_in.

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.

remove_model_elev

Set to TRUE to not include model elevation in the sqlite output files. For multi model ensembles, members having different model elevations from each other will make it impossible to include all members in the same row and thus break unique constraints for the row indexing.

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.

Value

A tibble with columns eps_model, sub_model, fcdate, lead_time, member, SID, lat, lon, .


andrew-MET/harpIO documentation built on March 7, 2024, 7:48 p.m.