get_filenames: Get filename(s) for meteorological data

View source: R/get_filenames.R

get_filenamesR Documentation

Get filename(s) for meteorological data

Description

[Deprecated]

This function was deprecated as generate_filenames is superior.

Usage

get_filenames(
  file_path = getwd(),
  file_date = Sys.Date(),
  start_date = NULL,
  end_date = NULL,
  by = "6h",
  lags = NULL,
  parameter = NULL,
  det_model = NULL,
  eps_model = NULL,
  sub_model = NULL,
  lead_time = seq(0, 48, 3),
  members = NA_character_,
  file_template = "fctable_eps",
  filenames_only = TRUE,
  ...
)

Arguments

file_path

The static path to the data.

file_date

A single date - may be YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm. If it is not specified and start_date is not specified then the system date is used with a time of 00:00.

start_date

If specified it is assumed a range of dates will be requested and end_date must also be specified. The range is given by start_date and end_date with the frequency given by by. If start_date is passed then file_date is ignored. The format is the same as that for file_date.

end_date

The end of a date range. Same format as for file_date.

by

The frequency of the date range. Should be a string of a number followed by a letter, where the letter gives the units - may be d for days, h for hours or m for minutes.

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, with a number followed by a letter giving the units. The avialable units are d, h, m, s for days, hours, minutes and seconds. If {MBRx} is in the template, it must be the same length as members.

parameter

If {parameter} exists in the the template this must be specified.

det_model

If {det_model} exists in the the template this must be specified.

eps_model

If {eps_model} exists in the the template this must be specified.

sub_model

If {sub_model} exists in the the template this must be specified.

lead_time

The lead times to be included in the file names if {LDTx} is in the template. Given as a vector of numbers.

members

The members to be included in the file names of {MBRx} is in the template

file_template

The file type to generate the template for. Can be any of the build in templates from show_file_templates. If anything else is passed, it is returned unmodified. In this case substitutions can be used. 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 and {MBRx} for ensemble member 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.

filenames_only

Logical. Set to TRUE to return a vector of unique file names. Set to FALSE to return a detailed data frame.

...

Not used

Value

If filenames_only is TRUE, a vector of unique file names. If filenames_only is FALSE, a tibble with columns eps_model, sub_model, fcdate, file_name, lead_time and member.

Examples

get_filenames("/my/path", eps_model = "my_eps", parameter = "T2m")

get_filenames("/my/path", start_date = 20170101, end_date = 20170131, by
= "1d", eps_model = "my_eps", parameter = "T2m", file_template =
"harmonie_grib")

get_filenames("/my/path", start_date = 20170101, end_date = 20170131, by
= "1d", eps_model = "my_eps", parameter = "T2m", members = seq(0, 2),
file_template = "harmoneps_grib_fp")

get_filenames("/my/path", file_date = 20170101, parameter = "T2m",
members = seq(0, 2), file_template = "harmoneps_grib_fp")

get_filenames("/my/path", start_date = 20170101, end_date = 20170105, by
= "6h", eps_model = "my_eps", parameter = "T2m", members = seq(0,3),
lead_time = seq(0, 24, 6), file_template =
"{eps_model}/{YYYY}{MM}{DD}{HH}_mbr{MBR2}+{LDT}h")


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