Closed spadarian closed 7 months ago
I've incorporated some of the changes suggested by @metasim, including:
I did not merge the calls for GDALGetDefaultHistogram
and GDALGetRasterHistogram
since I think having a API more or less consistent with the C code is desirable. Open to change it if that is where the project is going @lnicola @jdroenner
@spadarian Take a look at this PR against your repo for an alternative naming and associated documentation, which I think clarifies things for a future contributor.
The other option (assuming VSIFree
is required instead of using drop
), is to have default_histogram
copy the allocated array into the same Vec
as used by histogram
, then VSIFree
the array. I personally like this approach, but I would expect some to balk at the extra copy. Makes no difference to the user tho.
We should also add set_default_histogram
, but it's fine to do it in another PR.
I addressed all the comments... but CI failed on a unrelated test ( raster::processing::dem::slope::tests::test_slope)
Error: CplError { class: 3, number: 1, msg: "/__w/gdal/gdal/target/dem-hills-slope.tiff, band 1: IReadBlock failed at X offset 0, Y offset 0: TIFFReadEncodedStrip() failed." }
:exclamation:
Ah, there's a race between tpi
and slope
. I can try to fix it tomorrow.
Should we use /vsimem/
here?
~@spadarian Will you accept this? https://github.com/spadarian/gdal/pull/12~
Thanks for merging! :)
@metasim isn't that already merged?
@metasim isn't that already merged?
Oops! Yes. Sorry. Was looking at a non-refreshed page.
little robustness fix in https://github.com/spadarian/gdal/pull/13
Rebased @lnicola
[x] I added an entry to
CHANGES.md
if knowledge of this change could be valuable to users.This PR exposes 2 GDAL methods to calculate band histograms (default and user-defined).