<!DOCTYPE html><html><head><title></title><style type="text/css">#qt p.qt-MsoNormal{margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:0cm;font-size:11pt;font-family:Calibri, sans-serif;}
#qt a:link{color:blue;text-decoration-line:underline;text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;}
#qt li.qt-MsoListParagraph{margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:36pt;font-size:11pt;font-family:Calibri, sans-serif;}
#qt ul{margin-bottom:0cm;}
p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div style="font-family:Arial;">Hi Jukka,<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">If GDAL shuffled around the pixels in that file, you wouldn't be able to notice it by comparing the GRIB and the TIFF, because both would be shuffled.<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">My suggestion was to convert the GRIB to a NC or even CSV using xarray, then comparing the GDAL output against that.<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">Laurentiu</div><div style="font-family:Arial;"><br></div><div>On Thu, Feb 1, 2024, at 13:18, Rahkonen Jukka via gdal-dev wrote:<br></div><blockquote type="cite" id="qt" style="overflow-wrap:break-word;"><div class="qt-WordSection1"><p class="qt-MsoNormal"><span style="">Hi,</span><br></p><p class="qt-MsoNormal"><span style=""> </span><br></p><p class="qt-MsoNormal"><span lang="EN-US" style="">I used the gdal_compare script <a href="https://gdal.org/programs/gdalcompare.html">https://gdal.org/programs/gdalcompare.html</a></span><br></p><p class="qt-MsoNormal"><span lang="EN-US" style=""><br>gdalcompare st4_pr.2017092016.01h st4_pr.2017092016.01h.tif<br></span></p><p class="qt-MsoNormal"><span lang="EN-US" style="">and it reports three differences:</span><br></p><ul style="margin-top:0cm;" type="disc"><li class="qt-MsoListParagraph" style="margin-left:0cm;"><span lang="EN-US" style="">Files differ at the binary level (normal, GRIB and tif are not the same)</span><br></li><li class="qt-MsoListParagraph" style="margin-left:0cm;"><span lang="EN-US" style="">Difference in SRS (but they are alike, * IsSame() reports them as equivalent.)</span><br></li><li class="qt-MsoListParagraph" style="margin-left:0cm;"><span lang="EN-US" style="">Difference in Dataset metadata key count ( ['AREA_OR_POINT'] added)<br></span></li></ul><p class="qt-MsoNormal"><span lang="EN-US" style="">So if I read the report right the pixels in the files are identical. All I can conclude is that gdal_compare and your R script are doing something in different ways.</span><br></p><p class="qt-MsoNormal"><span lang="EN-US" style=""> </span><br></p><p class="qt-MsoNormal"><span lang="EN-US" style="">-Jukka Rahkonen-</span><br></p><p class="qt-MsoNormal"><span lang="EN-US" style=""> </span><br></p><div><div style="border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-right-style:none;border-bottom-style:none;border-left-style:none;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;border-top-width:1pt;border-top-style:solid;border-top-color:rgb(225, 225, 225);padding-top:3pt;padding-right:0cm;padding-bottom:0cm;padding-left:0cm;"><p class="qt-MsoNormal"></p><div><b>Lähettäjä:</b> gdal-dev <gdal-dev-bounces@lists.osgeo.org> <b>Puolesta </b>Furuya, Takahiro via gdal-dev<br></div><div> <b>Lähetetty:</b> torstai 1. helmikuuta 2024 1.53<br></div><div> <b>Vastaanottaja:</b> gdal-dev@lists.osgeo.org<br></div><div> <b>Aihe:</b> [gdal-dev] gdal_translate shifted values<br></div><p></p></div></div><p class="qt-MsoNormal"> <br></p><div><p class="qt-MsoNormal">Hi gdal-dev, I am Takahiro, a student who is using gdal_translate.<br></p><div><p class="qt-MsoNormal">I have an issue with gdal_translate and would like to ask a question.<br></p></div><div><p class="qt-MsoNormal">I used gdal_translate to transform a NCEP GRIB file (downloadable from <a href="https://data.eol.ucar.edu/cgi-bin/codiac/fgr_form/id=21.093">https://data.eol.ucar.edu/cgi-bin/codiac/fgr_form/id=21.093</a>, or attached to this email) to
GeoTiff, and compare those 2 data formats. The command I used is<br></p></div><div><div><p class="qt-MsoNormal"><span class="font" style="font-family:Menlo, serif;"><span class="size" style="font-size:8.5pt;">>gdal_translate -of GTiff st4_pr.2017092016.01h st4_pr.2017092016.01h.tif</span></span><br></p></div></div><div><p class="qt-MsoNormal"> <br></p></div><div><p class="qt-MsoNormal">(The GRIB file I used was st4_pr.2017092016.01h, which can be downloaded from the above link by specifying “Begin Date/Time” to “20170920”/“15:00:00” and “End Date/Time” to “20170920”/“15:59:59”.)<br></p></div><div><p class="qt-MsoNormal"> <br></p></div><div><p class="qt-MsoNormal">Then I read the 2 data files in R and checked if the original value at a certain grid cell in the GRIB file remained at the same grid cell in the GeoTiff file, but the value was shifted by 6 rows (the value I checked was 9.75 [mm/hour]
that was stored in index [100,86] in the original GRIB file, but it was shifted to [106,86] in the GeoTiff file).<br></p></div><div><p class="qt-MsoNormal"> <br></p></div><div><p class="qt-MsoNormal">You can see the Python script used for reading the original GRIB file here: <a href="https://bpa.st/ZNOSI">https://bpa.st/ZNOSI</a><br></p></div><div><p class="qt-MsoNormal">The R script used for checking the tif-translated data: <a href="https://bpa.st/WZLSY">https://bpa.st/WZLSY</a><br></p></div><div><p class="qt-MsoNormal"> <br></p></div><div><p class="qt-MsoNormal">The version of gdal_translate I used is 3.0.2.<br></p></div><div><p class="qt-MsoNormal">Is this a known issue of gdal_translate? Or is this issue not supposed to happen (is this the mistake of my side?)?<br></p></div><div><p class="qt-MsoNormal"> <br></p><div><div><p class="qt-MsoNormal">Best regards,<br></p></div><div><p class="qt-MsoNormal">Takahiro<br></p></div></div></div></div><div><div><div><p class="qt-MsoNormal"> <br></p></div><p class="qt-MsoNormal"> <br></p></div><p class="qt-MsoNormal"> <br></p></div></div><div>_______________________________________________<br></div><div>gdal-dev mailing list<br></div><div><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br></div><div><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></div><div><br></div></blockquote></body></html>