<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">OK, it worked as vrt of a vrt.  Memory not an issue.<div class=""><br class=""></div><div class="">But I have a new problem.  One vrt I want to instead do > -29 (caspian sea, -29 in SRTM data).  The whole region evaluates to 1 (true).  It looks like the in_ar[] is getting truncated to an unsigned byte, 0-255, from its orignal Int16.  Testing some values, anything up to 254 gives me 0/1 areas matching the elevation values in the original DEM, but >255 returns 0 for the whole area (that is, everything >255 was truncated to 255, so nothing is >255).  Thus, > -29 is true for the whole area.</div><div class=""><br class=""></div><div class="">I tried using the python cmp() function, in case the () test was casting each value to Byte, but it complained that it's ambiguous for an array.  The error suggested to use a.any() or a.all(), but I don't know how to do that one.</div><div class=""><br class=""></div><div class="">Here is the script again:</div><div class=""><br class=""></div><div class=""><span style="font-family: Monaco; font-size: 14px;" class="">import numpy</span><br style="font-family: Monaco; font-size: 14px;" class=""><span style="font-family: Monaco; font-size: 14px;" class="">def land(in_ar, out_ar, xoff, yoff, xsize, ysize, raster_xsize, raster_ysize, buf_radius, gt, **kwargs):</span><br style="font-family: Monaco; font-size: 14px;" class=""><span class="Apple-tab-span" style="font-family: Monaco; font-size: 14px; white-space: pre;">    </span><span style="font-family: Monaco; font-size: 14px;" class="">out_ar[:] = (in_ar[0] > -29)</span><br style="font-family: Monaco; font-size: 14px;" class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 26, 2018, at 1:07 PM, William Kyngesburye <<a href="mailto:woklist@kyngchaos.com" class="">woklist@kyngchaos.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">So, if the gdal library queries for a region of the vrt (ie processing it in chunks), the numpy array will be just that region?  I'll give it a try.<div class=""><br class=""></div><div class="">What about something like viewing the whole vrt in QGIS - will it be read in chunks as well?  IOW, is it the GDAL library that breaks it into chunks at reading, or is it the responsibility of programs (gdal_translate, QGIS,...) to ask for chunks?</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 26, 2018, at 12:59 PM, Even Rouault <<a href="mailto:even.rouault@spatialys.com" class="">even.rouault@spatialys.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">On jeudi 26 avril 2018 12:56:10 CEST William Kyngesburye wrote:</div><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">> So, a vrt of a vrt?</div><p style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""> </p><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">Yes</div><p style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""> </p><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">> </div><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">> I wanted to avoid that, because as I understand the source, it reads each</div><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">> raster in the derived band as a single numpy array, which would be all the</div><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">> tiled rasters together.  </div><p style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""> </p><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">No, if you use gdal_translate, it will process the source by reasonable chunks, so you should be able to process arbitrarily large sources.</div><p style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""> </p><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">Even</div><p style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""> </p><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">-- </div><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">Spatialys - Geospatial professional services</div><div style="white-space: pre-wrap; font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><a href="http://www.spatialys.com/" class="">http://www.spatialys.com</a></div><span style="font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">gdal-dev mailing list</span><br style="font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:gdal-dev@lists.osgeo.org" style="font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">gdal-dev@lists.osgeo.org</a><br style="font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" style="font-family: 'Sans Serif'; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></div></blockquote></div><br class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-size: 14px; orphans: 2; widows: 2; margin: 0px;" class="">-----</div><div style="font-size: 14px; orphans: 2; widows: 2; margin: 0px;" class="">William Kyngesburye <kyngchaos*at*kyngchaos*dot*com></div><div style="font-size: 14px; orphans: 2; widows: 2; margin: 0px;" class=""><a href="http://www.kyngchaos.com/" class="">http://www.kyngchaos.com/</a></div><div style="font-size: 14px; orphans: 2; widows: 2;" class=""><br class="khtml-block-placeholder"></div><div style="font-size: 14px; orphans: 2; widows: 2; margin: 0px;" class="">"We can die but once, and that once we must die.  To be always fearing, then, would not avert it, and would make life miserable."</div><div style="font-size: 14px; orphans: 2; widows: 2; margin: 0px;" class=""><br class="khtml-block-placeholder"></div><span style="font-size: 14px; orphans: 2; widows: 2;" class="">- Tarzan, on death</span></div>
</div>

<br class=""></div></div>_______________________________________________<br class="">gdal-dev mailing list<br class=""><a href="mailto:gdal-dev@lists.osgeo.org" class="">gdal-dev@lists.osgeo.org</a><br class="">https://lists.osgeo.org/mailman/listinfo/gdal-dev</div></blockquote></div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; font-size: 14px; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal;"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div class="">-----</div><div class="">William Kyngesburye <kyngchaos*at*kyngchaos*dot*com></div><div class=""><a href="http://www.kyngchaos.com/" class="">http://www.kyngchaos.com/</a></div><div class=""><br class=""></div><div class="">First Pogril: Why is life like sticking your head in a bucket filled with hyena offal?</div><div class="">Second Pogril: I don't know.  Why IS life like sticking your head in a bucket filled with hyena offal?</div><div class="">First Pogril: I don't know either.  Wretched, isn't it?</div><div class=""><br class=""></div><div class="">-HitchHiker's Guide to the Galaxy</div><br class="Apple-interchange-newline"></span></span>
</div>
<br class=""></div></body></html>