<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Bill,</p>
    <p>here you upsample from a 3x3 to a 5x5 array. Consequently each
      target pixel averages 5/3 x 5/3 contributing source pixels , not 2
      x 2.  This way the total sum of the values of the target array is
      preserved compared to to the sum of the values of the source
      array, if you multiply the sum by 3/5 * 3/5.</p>
    <p>To get what you expect you should work with even-sized arrays</p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 27/09/2023 à 19:44, Bill Myers via
      gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAA6+mXW5Obj1W1G7ZVFtwcoRXMhiZYDvvH16GKCwy27RD=h-2g@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hi,
          <div>I am new to working with GDAL. We are trying to spatially
            interpolate Numerical Weather Prediction (NWP) model data to
            an arbitrary location, i.e. lat/lon. We have been using
            gdal_translate but have been getting unexpected results. </div>
          <div>We have used the resampling method called "average". In
            this toy example, we are trying to resample to a grid with
            twice the density of the input data set. As can be seen in
            the image in the link below, the values at the points that
            match the input points agree with the input values. That's
            good. However, the interpolated values do not match our
            expectations. We would expect the interpolated value at the
            midpoint (directly between two input points) to be the
            average of those two input points. As can be seen, this is
            not the case.</div>
          <div>Can someone please help us understand what we might be
            doing incorrectly? Also, does GDAL have the functionality
            that we are looking for?</div>
          <div>Thanks for your help.</div>
          <font color="#888888">
            <div>-b</div>
          </font></div>
        <a href="https://pasteboard.co/uumLD4JtNmp3.png"
          moz-do-not-send="true" class="moz-txt-link-freetext">https://pasteboard.co/uumLD4JtNmp3.png</a><br>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </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>