Because climr:::calc_Eref()
and and climr:::calc_CMD()
are expected to
work on vectors, they don't work with a raster in memory.
Details
terra::app()
is very slow as it applies a function to every cell, where as
even if we extract the raster values to memory, being able to apply things in
parallel is much faster.
Therefore we extract raster values calculate the Eref and CMD and then return as a raster. It's faster if we omit the NAs for these calculations.