GLM's hydrodynamic namelist file has historically been named glm3.nml,
but newer GLM releases may write e.g. glm4.nml instead. AEME treats any
file matching glm<version>.nml in the top level of a glm_aed model
directory as the hydrodynamic nml, so the rest of the package works the
same regardless of which GLM version produced it. If more than one such
file is present, the choice between them is resolved by
.preferred_glm_major_version() (see Details).
Value
character; full path to the matching file, or NA_character_ if
must_exist = FALSE and none was found.
Details
When multiple glm<version>.nml files are found in the same directory
(e.g. a leftover glm3.nml alongside a newer glm4.nml), the one to use
is chosen in priority order:
The GLM version pinned via the
AEME.glm_versionoption (set byinstall_glm_aed(), or by the caller directly).Whichever GLM version is actually installed locally (see
glm_exe_path()), checked directly rather than trusting session state.If neither can be determined, the highest version number among the files present (e.g.
glm4.nmloverglm3.nml).
A message reports which file was picked and why, since an unused
glm<version>.nml sitting in the directory is otherwise easy to miss.
Examples
glm_dir <- file.path(tempdir(), "glm_aed")
dir.create(glm_dir, showWarnings = FALSE)
file.create(file.path(glm_dir, "glm3.nml"))
#> [1] TRUE
find_glm_nml(glm_dir)
#> [1] "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\RtmpqAKjog/glm_aed/glm3.nml"
