Open wcornwell opened 1 week ago
my idea seems incompatible with this for loop: https://github.com/traitecoevo/saltbush/blob/ddbe1904eb71fa721c9a440915e4eeb66da51131/R/calculate_spectral_metrics.R#L169
i guess the issue is where site should come in (from a user perspective)
it could still be done within the function like wavelengths <- colnames(pixel_values)[2:(ncol(pixel_values) - 1)] however, i wonder if people rocked up with their own spectral dfs (ie. not from extract_pixel_values) and have different columns it wouldn't work. maybe wavelengths = NULL and if they have a different data structure they can provide their wavelength cols?
option 1: I guess we could leave it as it is and just say clearly in the documentation that the column names of the wavelengths must exactly match the inputs to the wavelengths variable. This isn't that different than how lm
works, but it does allow for user spelling error to be annoying. We should probably work a bit on the error messages if we leave it this way.
option 2: make it so that all columns in the input data frame (except for special cases like aoi_id
and site
) are assumed to be wavelengths and then the names from the columns are used in the function.
option 3: ????
seems like the wavelength names could be handled inside the function instead of as an input? or not?