Creates a function that converts a directory path to a flight name

uas_path2name_fun(idx_from_last = 1)

Arguments

idx_from_last

Indices of the directory path, see Details

Value

A function that returns a flight name

Details

This will return a function that will parse a directory path into its constituent pieces and construct a name from one or more of those pieces. This can be useful for automatically naming flights based on the directory path in which the images are saved when running uas_info.

idx_from_last are indices of the subdirectories in the path, starting from the end. Hence if you wanted to construct names for a flight based on the very subdirctory (only), let idx_from_last = 1. If you want the names to be constructed based on the 2nd to last subdirectory, let idx_from_last = 2, and so on. If more than one number is passed for idx_from_last, the name returned will concatenate the pieces separated by underscores.

Note that this function does not actually convert a directory path to a flight name, but returns a function that will do the conversion.

See also

Examples

if (FALSE) {
data_dir <- "D:/Drone_Data/HREC/PostRiverFire2020/imgs/ebX_Flt02_postproc/img/msp"
flight_name_fun <- uas_path2name_fun(c(5,3,1))
flight_name_fun(data_dir)
ebee_flt2_info <- uas_info(data_dir, fp = FALSE, path2name_fun = flight_name_fun)
}