<div dir="ltr">Thanks Even!<div><br></div><div>For my case, max(data types) is good enough, but I see that for the general case calling this function might be a better option.</div><div><br></div><div>I couldn't find a reference for GDALWarpResolveWorkingDataType in the python wrappers, or the warp tester:</div><div><a href="https://github.com/OSGeo/gdal/blob/master/autotest/alg/warp.py">https://github.com/OSGeo/gdal/blob/master/autotest/alg/warp.py</a><br></div><div><br></div><div>Looking at <a href="https://github.com/OSGeo/gdal/blob/master/autotest/cpp/test_alg.cpp#L89">https://github.com/OSGeo/gdal/blob/master/autotest/cpp/test_alg.cpp#L89</a></div><div>I couldn't find a test that is considering two bands with different data types.</div><div><br></div><div>I was expecting that, at least in the python version, gdal.Warp will call this function internally before warping and not take the first data type as a default.</div><div><br></div><div>Idan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 23 Aug 2021 at 11:51, Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Idan,</p>
    <p>The warping kernel works on a multiple band dataset by using a
      single working data type, which should be the "max" of the types
      of the input bands, so here int16. I believe this is working, but
      here the issue is more at the creation of the dataset itself than
      during the warping. This is due to
<a href="https://github.com/OSGeo/gdal/blob/3302b5c9cb62191df3409676aa97fced07c92c3b/gdal/apps/gdalwarp_lib.cpp#L3017" target="_blank">https://github.com/OSGeo/gdal/blob/3302b5c9cb62191df3409676aa97fced07c92c3b/gdal/apps/gdalwarp_lib.cpp#L3017</a>
      . GDALWarpResolveWorkingDataType() should likely be used instead<br>
    </p>
    <p>Even<br>
    </p>
    <div>Le 23/08/2021 à 00:58, Idan Miara a
      écrit :<br>
    </div>
    <blockquote type="cite">
      <div dir="auto">Hi all,
        <div dir="auto"><br>
        </div>
        <div dir="auto">I was trying to warp a ds with a byte band and
          an int16 band and got a ds with two byte band.</div>
        <div dir="auto">Is warp using the first band data type for all
          the output bands?</div>
        <div dir="auto">Is that a bug? </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">If multiple band types are not supported - maybe
          max(band types) could be a better default (assuming no
          explicit output type) ?</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Kind regards, </div>
        <div dir="auto">Idan </div>
        <div dir="auto"><br>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </div>

</blockquote></div>