Generating observation data files from a data.frame

gen_obs(
  df,
  out_dir,
  usms_list = NULL,
  obs_table = lifecycle::deprecated(),
  out_path = lifecycle::deprecated()
)

Arguments

df

A data frame containing the values of the observations to use (see Details).

out_dir

Path of the directory where to generate the file(s).

usms_list

An optional list of usms names to be used for selecting which files to generate from the obs_table

obs_table

[Deprecated] obs_table is no longer supported, use df instead.

out_path

[Deprecated] out_path is no longer supported, use out_dir instead.

Value

A return logical status indicating if any error when writing files (FALSE), TRUE when no errors.

Details

df is a data.frame with the following format:

usm_nameianmojojuldensitelai(n)masec(n)azomes
USM_2017_T1_CI201796249NANA0.3127.07395
USM_2017_T1_CI2017920263NANA0.6027.90000
USM_2018_T120171020293NA0.1NANA
USM_2018_T12018515482NA1.2NANA
  • usm_name column contains usms names which are used as output .obs files names

  • ian, mo, jo and jul are mandatory (year, month, day and julian date)

  • Other columns one per variable contain observations values or NA

@seealso get_var_info for getting variable right syntax or searching a variable name.

Examples

xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx")
#> Warning: inputs_stics_example.xlsx already exists in  /var/folders/n2/pt_35rc53tdgkld9531s2tfh0000gn/T//Rtmp7KS4Yk 
#> Consider to set overwrite = TRUE to overwrite (it | them )
obs_df <- read_params_table(file = xl_path, sheet_name = "Obs")
gen_obs(df = obs_df, out_dir = "/path/to/dest/dir")
#> Warning: The directory does not exist /path/to/dest/dir