Closed
Description
Hello,
Thanks for the awesome package, I've been using it a ton for my work and it's helped exponentially increase my productivity!
I have an issue relating to calculating indices that require additional parameters, in this case EVI2 from Sentinel-2. I think the problem is that I can't seem to specify the 'g' and 'L' parameters required for the function - perhaps I am not understanding how the 'extra_objects' parameter is supposed to work? But it also gives the same error when I replace the 'g' and 'L' parameters and change the formula itself. I haven't had issues with the other indices I've tried to calculate (NDVI, BI, OSAVI).
I've pasted some code that I tried below:
> calculate_indices(
+ raster = xg.s2.rast,
+ indices = asi[asi$short_name == "EVI2", ],
+ output_filename = here("data", "rasters", "bigrast", "layers", "EVI2.tif"),
+ extra_objects = list(g=2.5, L=1)
+ )
Error in `calculate_indices()`:
! Some indices cannot be calculated using the available image bands.
Run `rlang::last_trace()` to see where the error occurred.
> names(xg.s2.rast)
[1] "A" "B" "G" "R" "RE1" "RE2" "RE3" "N" "N2" "WV" "S1" "S2"
> asi[asi$short_name == "EVI2", ]
# A tibble: 1 × 9
application_domain bands contributor date_of_addition formula long_name platforms reference short_name
<chr> <list> <chr> <chr> <chr> <chr> <list> <chr> <chr>
1 vegetation <chr [4]> https://github.com/davemlz 2021-04-07 g * (N - R) / (N + 2.4 * R + L) Two-Band Enhanced Vegetation Index <chr [6]> https://… EVI2
> asi[asi$short_name == "EVI2", ]$platforms
[[1]]
[1] "Sentinel-2" "Landsat-OLI" "Landsat-TM" "Landsat-ETM+" "MODIS" "Planet-Fusion"
# this results in the same error
asi[asi$short_name == "EVI2", ]$formula <- "2.5 * (N - R) / (N + 2.4 * R + 1)"
calculate_indices(
raster = xg.s2.rast,
indices = asi[asi$short_name == "EVI2", ],
output_filename = here("data", "rasters", "bigrast", "layers", "EVI2.tif")
)
Error in `calculate_indices()`:
! Some indices cannot be calculated using the available image bands.
Metadata
Metadata
Assignees
Labels
No labels