R/resolve_cultivar.R
cache_apsim_cultivars.RdThis function caches cultivar definitions from APSIM Next Generation
by reading user-supplied APSIM resource files or raw GitHub URLs
pointing explicitly to the Models/Resources directory.
cache_apsim_cultivars(
apsim_resources_dir,
crop = NULL,
dest_dir = NULL,
overwrite = FALSE
)Character scalar. A user-supplied path or URL
pointing explicitly to the APSIM Next Generation Models/Resources
directory (for example, a raw GitHub URL at a specific commit).
Character vector. Crop names for which cultivar definitions
should be cached. If NULL, all crops defined in
agrillm_options$get("crops") are processed.
Character scalar. Directory in which cached cultivar files
will be stored. Defaults to
file.path(agrillm_options$get("cache_dir"), "cultivars").
Logical. If FALSE (default), existing cached cultivar
files are preserved. If TRUE, cached files will be replaced.
Invisibly returns the cache directory used to store cultivar files.
The function does not discover, infer, or download APSIM resources on behalf
of the user. Instead, users must explicitly supply a valid APSIM resource
location (e.g. a raw GitHub URL or equivalent local path) that they are
licensed to access. Cached files are stored locally (by default under the
project-level .agrillm/ cache) to support reproducibility.
Cached cultivar lists are intended for use by resolve_cultivar() and
related functions. No APSIM artefacts are redistributed with the agrillm
package.
This function is deliberately conservative to ensure transparent provenance and licence responsibility. The user is responsible for supplying APSIM resources they are authorised to use and for complying with the APSIM licence.
For reproducibility, users are strongly encouraged to reference APSIM
resources using a specific commit hash rather than a moving branch
(e.g. refs/heads/master).
if (FALSE) { # \dontrun{
cache_apsim_cultivars(
apsim_resources_dir =
"https://raw.githubusercontent.com/APSIMInitiative/ApsimX/<commit>/Models/Resources",
crop = c("wheat", "barley")
)
} # }