>From my experience working with NetCDF files in GDAL, your best option is to write your own tools to work between NetCDF and other raster formats.  Specifically, I would use the API to read the NetCDF, and explicitly define the georeferencing of your output file using whatever logic you know to be correct for your input data.  All of the variables in the NetCDF file are accessible via GDAL, but in my experience the built-in utilities do not always use them in the way you want.  I too believe this is a failure of the NetCDF format, and not in GDAL. <br>
<br>Best of luck,<br><br>Roger<br>--<br><br><div class="gmail_quote">On Mon, Apr 5, 2010 at 11:26 PM, Michael Sumner <span dir="ltr">&lt;<a href="mailto:mdsumner@gmail.com">mdsumner@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I believe that NetCDF generally uses cell centres to specify pixel<br>
coordinates, and there is no way to specify cell corners except by<br>
adding metadata about the actual dimensions boundaries (this is more<br>
problematic again if coordinates are not regular since you cannot<br>
assume a regular half cell).<br>
<br>
My understanding is that GDAL assumes cell centres for NetCDF, and<br>
from the data I&#39;ve seen this is reasonable. The data model in NetCDF<br>
is more general than GDAL in some ways and it&#39;s simply not possible to<br>
answer this issue completely.  The unhappy news is that there is no<br>
easy answer but IMO GDAL is not incorrect here.<br>
<br>
In that example file the first longitude is 0 and all subsequent<br>
values are regularly spaced from there up to one cell less than 360,<br>
so the cell bounds at [0,360] are obvious - but this is not always the<br>
case. The latitudes are not regular and what was intended cannot<br>
always be determined in many cases (although in this file the<br>
boundaries are fairly obviously at [-90,90] offset from the min/max<br>
values of -87.8638  87.8638 )<br>
<br>
For some more background there was a discussion about the possible<br>
need for a distinction in NetCDF between cell and corner registration<br>
here:<br>
<br>
<a href="http://mailman.cgd.ucar.edu/pipermail/cf-metadata/2009/002721.html" target="_blank">http://mailman.cgd.ucar.edu/pipermail/cf-metadata/2009/002721.html</a><br>
<br>
In particular this statement is one confirmation I found of the lack<br>
of cell/corner distinction apart from boundary metadata.<br>
<br>
&quot;Coordinate bounds allow edges to be explicit, and you could ask the<br>
application developer to look<br>
for those. When not specified, I put the edges halfway between the<br>
coordinates.&quot;<br>
<br>
Cheers, Mike.<br>
<div><div></div><div class="h5"><br>
On Tue, Apr 6, 2010 at 3:32 PM, Pinner, Luke<br>
&lt;<a href="mailto:Luke.Pinner@environment.gov.au">Luke.Pinner@environment.gov.au</a>&gt; wrote:<br>
&gt; The NetCDF driver computes the pixel centre from lat/lon variables (see<br>
&gt; <a href="http://trac.osgeo.org/gdal/ticket/1506" target="_blank">http://trac.osgeo.org/gdal/ticket/1506</a>).<br>
&gt;<br>
&gt; Is this correct or should it compute pixel upper-left?<br>
&gt;<br>
&gt; Using the example NetCDF dataset attached to the above ticket<br>
&gt; (<a href="http://trac.osgeo.org/gdal/attachment/ticket/1506/out.nc" target="_blank">http://trac.osgeo.org/gdal/attachment/ticket/1506/out.nc</a>), gdalinfo<br>
&gt; reports the min longitude value to be -1.40625 which is not a valid<br>
&gt; longitude (it&#39;s 1/2 a pixel less than 0 which is the min value in the<br>
&gt; NetCDF lon variable).<br>
&gt;<br>
&gt; gdalinfo <a href="http://out.nc" target="_blank">out.nc</a><br>
&gt; $ gdalinfo -nomd <a href="http://out.nc" target="_blank">out.nc</a><br>
&gt; Warning 1: Latitude grid not spaced evenly.<br>
&gt; Seting projection for grid spacing is within 0.1 degrees threshold.<br>
&gt;<br>
&gt; Driver: netCDF/Network Common Data Format<br>
&gt; Files: <a href="http://out.nc" target="_blank">out.nc</a><br>
&gt; Size is 128, 64<br>
&gt; Coordinate System is `&#39;<br>
&gt; Origin = (-1.406250000000000,89.258462312871046)<br>
&gt; Pixel Size = (2.812500000000000,-2.789326947277220)<br>
&gt; Corner Coordinates:<br>
&gt; Upper Left  (  -1.4062500,  89.2584623)<br>
&gt; Lower Left  (  -1.4062500, -89.2584623)<br>
&gt; Upper Right (     358.594,      89.258)<br>
&gt; Lower Right (     358.594,     -89.258)<br>
&gt; Center      ( 178.5937500,   0.0000000)<br>
&gt; Band 1 Block=128x1 Type=Float32, ColorInterp=Undefined<br>
&gt;  NoData Value=9.96920996838686905e+36<br>
&gt;<br>
&gt; Regards<br>
&gt; Luke<br>
&gt;<br>
&gt;<br>
&gt; ------<br>
&gt; If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments.<br>

&gt;<br>
&gt;<br>
&gt;<br>
&gt; Please consider the environment before printing this email.<br>
&gt;<br>
&gt; ------<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; gdal-dev mailing list<br>
&gt; <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
&gt;<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br>