<div dir="ltr">Thanks Chris for your reply.<div><br></div><div>I forgot to mention I'm not using GDAL with Python.</div><div>I use it with C++ and/or C#.</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><br>
<br>
Paul<br>
<br>
<div style="font-size:13.3px;font-family:Verdana,Arial,Helvetica,sans-serif"><div style="border:1px solid #e5e5e5;background-color:#f8f8f8;padding:0.8em 0.8em 0.3em 0.8em"><div style="margin:0 0 8px 0"><p style="margin:0"><span><b><img style="float:left;margin-left:5px;margin-right:5px" src="http://www.bontepaarden.nl/bontepaarden/images/newButton.png" alt="" height="120" width="160">Paul Meems </b><br><span>Release manager, configuration manager</span><br><span>and forum moderator of MapWindow GIS.</span><br><a href="http://www.mapwindow.org/" target="_blank"><span>www.mapwindow.org</span></a><br><br><span>Owner of MapWindow.nl - Support for</span><br><span>Dutch speaking users.</span><br><a href="http://www.mapwindow.nl/" target="_blank"><span>www.mapwindow.nl</span></a><br></span></p>
<p style="margin:0px"><b><br></b></p><p style="margin:0px"><b>The MapWindow GIS project has moved to <a href="https://github.com/MapWindow" target="_blank">GitHub</a>!</b></p><p style="font-size:13.3px;margin:0px"><br><a href="https://github.com/MapWindow/MapWinGIS/releases" target="_blank">Download the latest MapWinGIS mapping engine.</a><br></p><p style="font-size:13.3px;margin:0px"><span style="font-size:13.3px"><a href="https://github.com/MapWindow/MapWindow5/releases" target="_blank">Download the latest MapWindow 5 open source desktop application.</a></span></p></div></div><img src="http://p1.wisestamp.com/pixel.png?p=mozilla&v=3.9.12&t=1322134056890&u=482737fd0c4ca423" height="1" width="1"></div>
</div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">2017-08-03 20:05 GMT+02:00 Chris Waigl <span dir="ltr"><<a href="mailto:cwaigl@alaska.edu" target="_blank">cwaigl@alaska.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I would not use gdal for this particular task. I presume you have the band data in a 2D numpy array. Then I’d get the 80th percentile for example with np.percentile() and use a boolean expression to generate a mask for the array (droneraster > perc80value ).<div><br></div><div>Chris<div><div><br><div>
<span class="m_-167853682444867102Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Consolas;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px"><div style="word-wrap:break-word"><span class="m_-167853682444867102Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px"><div style="word-wrap:break-word"><span class="m_-167853682444867102Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px"><div style="word-wrap:break-word"><span class="m_-167853682444867102Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px"><div style="word-wrap:break-word"><div><span class="m_-167853682444867102Apple-style-span" style="font-family:monospace">-- </span></div><div><span class="m_-167853682444867102Apple-style-span" style="font-family:monospace">Christine (Chris) Waigl - <a href="mailto:cwaigl@alaska.edu" target="_blank">cwaigl@alaska.edu</a> - <a href="tel:(907)%20474-5483" value="+19074745483" target="_blank">+1-907-474-5483</a> - Skype: cwaigl_work</span></div><div><span class="m_-167853682444867102Apple-style-span" style="font-family:monospace">Geophysical Institute, </span><span class="m_-167853682444867102Apple-style-span" style="font-family:monospace">UAF, </span><span class="m_-167853682444867102Apple-style-span" style="font-family:monospace">903 Koyukuk Drive, </span><span class="m_-167853682444867102Apple-style-span" style="font-family:monospace">Fairbanks, AK 99775-7320, USA</span></div><div><br></div></div></span><br class="m_-167853682444867102Apple-interchange-newline"></div></span><br class="m_-167853682444867102Apple-interchange-newline"></div></span><br class="m_-167853682444867102Apple-interchange-newline"></div></span><br class="m_-167853682444867102Apple-interchange-newline"><br class="m_-167853682444867102Apple-interchange-newline">
</div>
<br><div><blockquote type="cite"><div><div class="h5"><div>On Aug 3, 2017, at 5:43 AM, Paul Meems <<a href="mailto:bontepaarden@gmail.com" target="_blank">bontepaarden@gmail.com</a>> wrote:</div><br class="m_-167853682444867102Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr">I have a drone raster file which I want to use for some calculation.<div>Before the calculation, I need to loose some extreme values.</div><div>I want to do something like a percentile calculation where you get all values, order them and loose the top 10%.</div><div>For this, I need to get all values first which can be slow when using a large file.</div><div><br></div><div>I looked at the statistics (band.GetStatistics) but that doesn't work well.</div><div>I thought I could use 2 times the standard deviation added to the mean to get roughly 97%.</div><div>But with these statistics:</div><div><div><font face="monospace, monospace"> STATISTICS_MAXIMUM=33.<wbr>186080932617</font></div><div><font face="monospace, monospace"> STATISTICS_MEAN=24.<wbr>840205979603</font></div><div><font face="monospace, monospace"> STATISTICS_MINIMUM=1.<wbr>5951598882675</font></div><div><font face="monospace, monospace"> STATISTICS_STDDEV=4.<wbr>7285348016053</font></div><div>Mean + 2*std is larger than the max.</div><div><br></div><div>So I moved to the histogram. It is also very fast, but I'm not sure how to use it.</div><div>I have this:</div><div><div><font face="monospace, monospace"> 256 buckets from 1.53322 to 33.248:</font></div><div><font face="monospace, monospace"> 410 77 66 66 65 58 56 45 42 87 57 72 61 65 68 70 73 82 93 ...</font></div></div><div><div class="m_-167853682444867102gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Does this mean, bucket 1 = 410 that I have 410 pixels of value 1.53322 and the second bucket means I have 77 pixels between 1.53322 and 1.657? 1.657 = 1.53322 + ((33.248 - 1.53322)/256)</div><div dir="ltr"><br></div><div dir="ltr">Is this a good approach? Or can/should I use a different one.</div><div dir="ltr"><br></div><div dir="ltr">Thanks,<br>
<br>Paul<br>
</div></div></div></div></div></div>
</div></div></div></div>
______________________________<wbr>_________________<br>gdal-dev mailing list<br><a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/gdal-dev</a></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>