get_data_filename: Gets the filename of a forecast file from the date, cycle and...

Description Usage Arguments Value Examples

View source: R/get_data_filename.R

Description

Gets the filename of a forecast file from the date, cycle and lead time. A template can be passed as an argument.

Usage

1
2
3
4
get_data_filename(data_date, data_cycle,
  data_source = "operational meps", experiment_name = NULL,
  parameter = NULL, lead_time = NULL, members = seq(0, 9),
  static_path = "", template = "harmoneps_grib")

Arguments

data_date

The required forecast date. Maybe YYYYMMDD or YYYY-MM-DD or any date object.

data_cycle

The forecast cycle. Can be numeric or a string.

data_source

If "operational meps" (the default) will find MEPS data. Otherwise "expt" must be used and template should be specified.

experiment_name

The experiment name - can be used in template.

parameter

If the parameter is in a surfex file, for example, it must be given so that the correct file is found. Otherwise an extracted file is assumed.

lead_time

The lead time must be given in hours for NetCDF. If template contains $LDTx 'lead_time' must be specified.

members

The members to get filenames for if template contains $MBRx.

static_path

The static path for filenames. The full path is assumed to be static_path/template.

template

A template for filenames. Standard templates are "harmoneps_grib", "harmoneps_grib_fp", "haramoneps_grib_sfx", and the same with "harmonie" in place of "harmoneps" for deterministic files.
Otherwise, a template can be given with substitutions expressed as $substitution. Available substitutions are ${YYYY}, $MM, $DD, $HH, $LDTx, $MBRx, where x is the number of charcters in the string with leading zeros added. YYYY = year (4 digits), MM = month (2 digits with leading zero if < 10), DD = day (2 digits with leading zero if < 10), HH = hour (2 digits with leading zero if < 10), LDT = lead time, MBR = ensemble member. $static_path and $experiment_name can also be used if specified.

Value

The full path(s) to the forecast file(s).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
get_data_filename(20180101, 0)
get_data_filename(20180101, 0, parameter = "SST")
get_data_filename("2018-01-01", "06")

my_static_path <- "/lustre/storeB/users/andrewts/surfacePerturbations/grib"
my_expt <- "MEPS_summer2017_sfcPertRef"
my_template <- file.path(
  "${YYYY}${MM}${DD}${HH}",
  "${experiment_name}",
  "mbr${MBR3}/fc${YYYY}${MM}${DD}${HH}+${LDT3}.grib"
)
get_data_filename(
  20170527, 0, data_source = "expt",
  static_path = my_static_path,
  experiment_name = my_expt,
  template = my_template,
  lead_time = 3, members = seq(0, 10)
)

andrew-MET/mepsr documentation built on Nov. 9, 2019, 6:30 a.m.