<div dir="ltr">I might not be this but I remember coming across something similar in the tests for MDAL and it came down to this PR (I think it was this one) <a href="https://github.com/OSGeo/gdal/pull/5521" target="_blank">https://github.com/OSGeo/gdal/pull/5521</a><br><br>Basically - before GDAL was not reading all CRS metadata and after the change it is reading the CRS data more correctly.<br><br>I notice from the StackExchange post that you are defining the Spatial reference as UTM zone 36N (which is projected) but seem to be providing that individual coordinates as Lat Lng. I think the change in PR now means that GDAL is obeying the CRS you specified and trying to look at that data as being in UTM when it is not!<br><br>It kind of makes sense of the messages you receive.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 7 Oct 2022 at 13:04, Micha Silver <<a href="mailto:tsvibar@gmail.com" target="_blank">tsvibar@gmail.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>
<div style="direction:ltr">
<p><font size="4"><font face="Helvetica, Arial, sans-serif">Hello:</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif">I'm
using xarray and rioxarray in python to create a DataSet then
export to Netcdf. After saving, when I check the exported
files with gdalinfo using GDAL 3.2, I see the correct extent.
However, when using GDAL >=3.4 (i.e in a conda env) it
seems that the extents are lost, and the NetCDF dimensions
appear instead. This causes the resulting NetCDF to appear at
coords (0,0) - the wrong place - in QGIS (on a system with the
newer GDAL).<br>
</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><br>
</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif">Here is
the output with my system installed GDAL:</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><br>
</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><span style="font-family:monospace"><span style="font-weight:bold;color:rgb(84,255,84);background-color:rgb(255,255,255)">micha@RMS</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">:</span><span style="font-weight:bold;color:rgb(84,84,255);background-color:rgb(255,255,255)">Kinneret</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">$ gdalinfo
--version </span><br>
GDAL 3.2.2, released 2021/03/05 <br>
<span style="font-weight:bold;color:rgb(84,255,84);background-color:rgb(255,255,255)">micha@RMS</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">:</span><span style="font-weight:bold;color:rgb(84,84,255);background-color:rgb(255,255,255)">Kinneret</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">$ gdalinfo
NETCDF:"Kinneret_velocity.nc":v | grep -A 4 Corner
</span><br>
Warning 1: dimension #2 (x) is not a Longitude/X dimension.
<br>
Warning 1: dimension #1 (y) is not a Latitude/Y dimension. <br>
Warning 1: dimension #0 (z) is not a Time or Vertical
dimension. <br>
Corner Coordinates: <br>
Upper Left ( 735758.000, 3644806.000) ( 35d31'15.70"E,
32d54'57.98"N) <br>
Lower Left ( 735758.000, 3621606.000) ( 35d30'54.46"E,
32d42'25.30"N) <br>
Upper Right ( 754558.000, 3644806.000) ( 35d43'18.74"E,
32d54'42.80"N) <br>
</span></font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><span style="font-family:monospace">Lower Right ( 754558.000,
3621606.000) ( 35d42'55.82"E, 32d42'10.25"N) </span></font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><span style="font-family:monospace"><span style="font-weight:bold;color:rgb(84,255,84);background-color:rgb(255,255,255)"><br>
</span></span></font></font></p>
<p>However, in my conda environment, with a newer GDAL:<font size="4"><font face="Helvetica, Arial, sans-serif"><span style="font-family:monospace"><span style="font-weight:bold;color:rgb(84,255,84);background-color:rgb(255,255,255)"><br>
</span></span></font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><span style="font-family:monospace"><span style="font-weight:bold;color:rgb(84,255,84);background-color:rgb(255,255,255)"><br>
</span></span></font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><span style="font-family:monospace"><span style="font-weight:bold;color:rgb(84,255,84);background-color:rgb(255,255,255)">micha@RMS</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">:</span><span style="font-weight:bold;color:rgb(84,84,255);background-color:rgb(255,255,255)">Kinneret</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">$ conda
activate geo </span><br>
(geo) <span style="font-weight:bold;color:rgb(84,255,84);background-color:rgb(255,255,255)">micha@RMS</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">:</span><span style="font-weight:bold;color:rgb(84,84,255);background-color:rgb(255,255,255)">Kinneret</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">$ gdalinfo
--version </span><br>
GDAL 3.5.2, released 2022/09/02 <br>
(geo) <span style="font-weight:bold;color:rgb(84,255,84);background-color:rgb(255,255,255)">micha@RMS</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">:</span><span style="font-weight:bold;color:rgb(84,84,255);background-color:rgb(255,255,255)">Kinneret</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">$ gdalinfo
NETCDF:"Kinneret_velocity.nc":v | grep -A 4 Corner </span><br>
Warning 1: dimension #2 (x) is not a Longitude/X dimension.
<br>
Warning 1: dimension #1 (y) is not a Latitude/Y dimension. <br>
Warning 1: dimension #0 (z) is not a Time or Vertical
dimension. <br>
Corner Coordinates: <br>
Upper Left ( 0.0, 0.0) <br>
Lower Left ( 0.0, 58.0) <br>
Upper Right ( 47.0, 0.0) <br>
Lower Right ( 47.0, 58.0)<br>
</span><br>
</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif">What do
I need to add to the xarray Dataset so that the newer GDAL
gets the correct extent?</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif">In both
cases all the "grid_mapping" metadata entries point to
"spatial_ref", and the full spatial_ref details are available
in the NetCDF file.</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><br>
</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif">(Note:
double posted to GIS.stackexchange at
<a href="https://gis.stackexchange.com/questions/442323/changes-to-gdal-netcdf-driver-between-3-2-and-3-4" target="_blank">https://gis.stackexchange.com/questions/442323/changes-to-gdal-netcdf-driver-between-3-2-and-3-4</a>)<br>
</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif"><br>
</font></font></p>
<p><font size="4"><font face="Helvetica, Arial, sans-serif">Thanks</font></font></p>
<p></p>
<pre cols="72">--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
</div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></blockquote></div>