Reads user-set parameters for package marshmap.
Details
User parameters are set in two distinct locations:
The initialization file, in the user's home directory,
~/marshmap.yml. This file should contain five lines:basedir: c:/Work/etc/marshmapparsdir: parsparsfile: pars.ymlscratchdir: c:/Work/etc/marshmap/data/scratcha.
basedirpoints to the base directoryb.
parsdiris the parameters subdirectory. It should beparsunless you have a good reason to change it.c.
parsfilepoints to the main parameter file. It should bepars.yml.d.
scratchdirpoints to the scratch drive, where thecachedirectory will be located. See notes on caching, below.Everything else, in
<basedir>/<parsdir>. The primary parameter file ispars.yml, which points to other parameters (such assites.txt).
These parameters include:
sitesthe name of the sites file,sites.txtby defaultclassesthe name of the classes file,classes.txtby defaultdirsalternative names for various subdirectories. The directories will keep the standard structure–you can change names here but not paths.gathera block of parameters forgather()
This approach splits the user- and platform-dependent parameters (marshmap.yml)
from parameters that are likely to be shared among users and across platforms (those in
parsdir). It allows multiple users on a shared machine (such as Unity cluster)
to set user-specific parameters if need be, while sharing other parameters.
This function reads the user parameters and adds them to the environment the with
all parameters. It is automatically run upon loading the package, and may be
rerun by the user if parameter files are changed.
You can change standard directory names (data, models, gis, flights, field,
shapefiles, samples, predicted, and cache) by setting each within a dirs: block in pars.yml.
Directories default to standard names, which is usually what you want.
To change parameters on the fly, you can set the components of the. If you change any elements of
dirs, you'll have to run set_dirs() afterwards. Note
that parameters changed on the fly will only persist until the next call to init(),
which can be called on demand but also happens automatically when the package is loaded.
For example:
the$sites <- 'newsites' the$dirs$cache <- 'newcache' the$dirs$samples <- 'samples99' set_dirs()
Notes on caching. A cache directory is required when sourcedrive = google or sftp. The cache
directory should be larger than the total amount of data processed–this code isn't doing any quota
management. This is not an issue when using a
scratch drive on Unity,
as the limit is 50 TB. There's no great need to carry over cached data over long periods, as downloading
from Google or SFTP to Unity is very fast. Be polite and release the scratch workspace when you're done.
See comments in get_file() for more notes on caching.