<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi everyone, I’ve been using GetHistogram but I need to support rasters with alpha channels and those run through nearblack. I don’t see masked histogramming mentioned in the docs. I do see the masked read functions, but it looks like numpy’s masked array histogram
function is one of many ma functions that don't work correctly(?) (<a href="https://github.com/numpy/numpy/issues/10019" data-outlook-id="773dd14c-f6fe-4f70-8d70-4586eb50234c">https://github.com/numpy/numpy/issues/10019</a>)</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
Does anyone have any creative ideas to share?</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
For masked data, the simplest seems to be iteratively histogramming manually masked blocks.</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
It looks like nearblack can handle >4 bands, but I need multibyte dtypes. I was thinking of rasterizing a VRT that uses the new equations system to compute A | (A >> 8) or maybe a two step equivalent of bool(A) -> sum(A) and running that through nearblack
to make an alpha channel for the above method.</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
Appreciate everyone’s thoughts.</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
Will</div>
</body>
</html>