<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 25/08/2021 à 13:12, Idan Miara a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEDrt3-XG4s7fK-K17C=NcBR2HapH5zN9bgZNxoXHNyRV-ts_A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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"
            moz-do-not-send="true">https://github.com/OSGeo/gdal/blob/master/autotest/alg/warp.py</a><br>
        </div>
      </div>
    </blockquote>
    It's not meant for general consumption. Mostly an implementation
    detail<br>
    <blockquote type="cite"
cite="mid:CAEDrt3-XG4s7fK-K17C=NcBR2HapH5zN9bgZNxoXHNyRV-ts_A@mail.gmail.com">
      <div dir="ltr">
        <div><br>
        </div>
        <div>Looking at <a
href="https://github.com/OSGeo/gdal/blob/master/autotest/cpp/test_alg.cpp#L89"
            moz-do-not-send="true">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>
    </blockquote>
    gdal.Warp() just calls the same logic as the gdalwarp binary. The
    fix shouldn't be too hard if you want to have a try. Otherwise
    please file a ticket about that<br>
    <blockquote type="cite"
cite="mid:CAEDrt3-XG4s7fK-K17C=NcBR2HapH5zN9bgZNxoXHNyRV-ts_A@mail.gmail.com">
      <div dir="ltr">
        <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"
            moz-do-not-send="true">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" moz-do-not-send="true">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" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
            </blockquote>
            <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank" moz-do-not-send="true">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>