Problem
drift assumes projected CRS (metre-based terra::res()) for area calculations. This blocks use on geographic CRS rasters like climate data (WorldClim, PRISM, ERA5) which ship in EPSG:4326 at coarse resolution over large extents that cross UTM zones.
#15 adds a guard that errors on geographic CRS. This issue tracks the enhancement to support it.
Proposed Solution
Use terra::cellSize() to compute true per-cell area in m² when the CRS is geographic. This handles:
- Geographic CRS (degree-based pixels with varying area by latitude)
- Cross-UTM-zone projected rasters (minor distortion at zone edges)
Implementation options:
- Auto-detect geographic CRS and switch to
cellSize() internally
- Add a parameter (e.g.,
exact_area = FALSE) that users opt into for large/geographic rasters
Option 1 is more user-friendly. cellSize() adds computation but is negligible compared to STAC fetch.
Affected functions: dft_rast_transition(), dft_rast_summarize().
Context
Climate data use case: comparing last 10 years of max temp / annual precip to the preceding 65 years across large watersheds. These AOIs routinely cross UTM zones, making single-zone projection inadequate.
Relates to #15
Problem
drift assumes projected CRS (metre-based
terra::res()) for area calculations. This blocks use on geographic CRS rasters like climate data (WorldClim, PRISM, ERA5) which ship in EPSG:4326 at coarse resolution over large extents that cross UTM zones.#15 adds a guard that errors on geographic CRS. This issue tracks the enhancement to support it.
Proposed Solution
Use
terra::cellSize()to compute true per-cell area in m² when the CRS is geographic. This handles:Implementation options:
cellSize()internallyexact_area = FALSE) that users opt into for large/geographic rastersOption 1 is more user-friendly.
cellSize()adds computation but is negligible compared to STAC fetch.Affected functions:
dft_rast_transition(),dft_rast_summarize().Context
Climate data use case: comparing last 10 years of max temp / annual precip to the preceding 65 years across large watersheds. These AOIs routinely cross UTM zones, making single-zone projection inadequate.
Relates to #15