-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Statistics #60
Statistics #60
Conversation
Pull Request Test Coverage Report for Build 1654875142
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @fhelen
I don't find the meaning of force and approximate to be very clear. In practice I think we need to be able to expose this functionality:
- getPrecomputedStatistics() => return true/false if present
- recomputeStatistics(approxOK)
- clear/set as is in your proposal
mixing force and approx in getStatistics is ambiguous (i.e. does force mean you need to recompute if the cached version is approximated, if the cached version is absent, or everytime?)
Hello Flo and Thomas, On a functional scope, I argue it is important to never recompute stats using the whole raster unless explicitly requested by the user. This is why I think the wording For example: bnd.Histogram(godal.Approximate()) will recompute the histogram using the whole raster: Line 798 in 42a03dc
This may or may not be the intended behavior, but it caught me last week. There are three ways to get stats:
To avoid pitfalls like the one I mentionned, I suggest the following API:
By default, stats, ok := bnd.Statistics()
if !ok {
stats, _ = bnd.Statistics(godal.Approximate())
} At least the API is explicit. I suggest similar changes to the Histogram feature: hist, ok := bnd.Histogram() // only approximate - don't think there is cached hist in GDAL
if !ok {
hist, _ = bnd.Histogram(godal.Accurate())
} We could even call Thomas |
I agree, except I would be even more strict about this and remove the "using the whole raster" part, as depending on the dataset even an approximation might induce a full read.
good to know, thanks for alerting. This needs to be fixed.
|
Hello @tbonfort & @thomascoquet
|
No description provided.