isciences / exactextract

Fast and accurate raster zonal statistics
Apache License 2.0
246 stars 32 forks source link

Coverage fraction #40

Closed hellkite500 closed 10 months ago

hellkite500 commented 1 year ago

This PR introduces two mechanics for getting coverage fraction reports from the core lib -- it can be asked for as an operation alongside other stats, or from the CLI it can be provided as a strategy which will only write the coverage fraction and cell number.

Tests coverage was added to the catch tests for the coverage fraction.

Am happy to discuss any implementation details.

dbaston commented 10 months ago

I'm working through this at long last, @hellkite500 . Are you OK with me pushing commits to this branch?

it can be asked for as an operation alongside other stats, or from the CLI it can be provided as a strategy which will only write the coverage fraction and cell number.

I'm inclined to retain the second approach only, rather than modify the first approach to only store the coverage fractions in RasterStats if we need them. This more closely resembles the R interface, where you can get either stats or the raw coverage fractions, but not both in the same call. Since calculating the coverage fractions is usually quick relative to I/O I wouldn't predict a strong performance advantage to outputting stats and coverage fractions in a single pass.

dbaston commented 10 months ago

Adapted, committed in e943d7d. Thanks!

hellkite500 commented 10 months ago

Sorry I missed the notification that you were working on this! Glad it was useful in some capacity!