<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:737438345;
mso-list-type:hybrid;
mso-list-template-ids:-1971258770 -79370996 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-start-at:450;
mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-CA">Hi, <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I am facing an issue with GRIB2 data, and the extent reported by a gdal_info command. Here is a sample data to test:
<a href="https://drive.google.com/file/d/1URvQs2qHXgRkq3YfC7ZR8VGYK3SKXB59/view?usp=drive_link">
https://drive.google.com/file/d/1URvQs2qHXgRkq3YfC7ZR8VGYK3SKXB59/view?usp=drive_link</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Here is what I am testing with: <o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-CA">Ubuntu 20.04.6 LTS<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-CA">GDAL 3.5.2, released 2022/09/02<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-CA">PROJ Rel. 8.2.0, November 1st, 2021<o:p></o:p></span></li></ul>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">So, using grib_dump, I see the longitude of the file should be from 0 to 360 degress:
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">grib_dump out.grib2 | grep shapeOfTheEarth -A 12<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> shapeOfTheEarth = 6;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> Ni = 2400;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> Nj = 1201;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> iScansNegatively = 0;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> jScansPositively = 1;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> jPointsAreConsecutive = 0;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> alternativeRowScanning = 0;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> latitudeOfFirstGridPointInDegrees = -90;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> <b>longitudeOfFirstGridPointInDegrees = 0;<o:p></o:p></b></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> latitudeOfLastGridPointInDegrees = 90;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> <b>longitudeOfLastGridPointInDegrees = 360;<o:p></o:p></b></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> iDirectionIncrementInDegrees = 0.15;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt"> jDirectionIncrementInDegrees = 0.15;<o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">But using gdal_info I see the extent as:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">gdal_info -proj4 out.grib2 | grep PROJ -A 9
<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">PROJ.4 string is:<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">'+proj=longlat +R=6371229 +no_defs'<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">Origin = (-0.075031263026261,90.075000000000003)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">Pixel Size = (0.150062526052522,-0.150000000000000)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">Corner Coordinates:<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">Upper Left ( -0.0750313, 90.0750000) ( 0d 4'30.11"W, 90d 4'30.00"N)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">Lower Left ( -0.0750313, -90.0750000) ( 0d 4'30.11"W, 90d 4'30.00"S)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">Upper Right ( 360.075, 90.075) (360d 4'30.11"E, 90d 4'30.00"N)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="font-size:10.0pt">Lower Right ( 360.075, -90.075) (360d 4'30.11"E, 90d 4'30.00"S)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="font-size:10.0pt">Center ( 180.0000000, 0.0000000) (180d 0' 0.00"E, 0d 0' 0.01"N)<o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="FR-CA"><o:p> </o:p></span></p>
<p class="MsoNormal">I would expect the gdal_info extent to be also from 0 to 360 degrees (2400 pixels * 0.15 = 360). From reading various source, I see the issue is potentially that the GRIB2 files define the extent using the center of the pixel while gdal
assumes it is the top left corner. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My question: Is there a way to change this behavior in gdal, or this expected, or a bug ?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">LP<o:p></o:p></p>
</div>
</body>
</html>