Function to search for a file containing a specific variable in a specific directory.
find_varfile(searchdir, variable = "grid", strict = FALSE)Directory where to look for the variable file.
Single character string containing the variable to search for
Boolean. If set to TRUE, file must be named "variable.",
where "" is one or two file extensions with 3 or 4 characters, e.g.
"grid.bin.json" if variable = "grid". If set to FALSE, the function
will first try to match the strict pattern. If unsuccessful, any filename
that starts with "variable" will be matched.
Character string with the file name of a matched file, including the full path.
This function looks for file names in searchdir that match the
pattern parameter in its list.files() call. Files of type "meta" are
preferred. Files of type "clm" are also accepted. The function returns an
error if no suitable file or multiple files are found.