<div dir="ltr"><div><div><div>Thanks for the tips Kyle and Even and for the quick fix!<br></div>Not a big netCDF user myself, but have noticed that it seems to be the standard format for many of my colleagues who work in climatology. So good to get this fixed!<br><br></div>Cheers,<br></div>Simon<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 27, 2015 at 6:08 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Le mardi 27 octobre 2015 16:54:56, Kyle Shannon a écrit :<br>
> Simon,<br>
><br>
> On Mon, Oct 26, 2015 at 5:04 PM, Simon Lyngby Kokkendorff<br>
><br>
> <<a href="mailto:silyko@gmail.com">silyko@gmail.com</a>> wrote:<br>
> > Hello list,<br>
> ><br>
> > Just observed a puzzling behaviour of the netCDF driver. When creating<br>
> > a<br>
> ><br>
> > netCDF dataset of Byte type, the netCDF driver seems to interpret the<br>
> > nodata value as a signed byte.<br>
> ><br>
> > For example a nodata value assigned with -a_nodata 200, will become -56.<br>
> > Of<br>
> ><br>
> > course one can work around this by simply casting the nodata value (as<br>
> > e.g. returned by band.GetNoDataValue()) to an unsigned byte.<br>
><br>
> It appears the driver has a sort of data type mis-match with no data<br>
> and the band type. A work around, if available, is to set FORMAT=NC4<br>
> as a creation option. I am not sure if it is in gdal or the netcdf<br>
> library at this point.<br>
<br>
</span>My understanding is netCDF 3 only supports signed byte and GDAL uses a special<br>
metadata item _Unsigned=True to correct the interpretation. But it failed to<br>
use it to interpret correctly the nodata value. Should be fixed by<br>
<a href="https://trac.osgeo.org/gdal/ticket/6175" rel="noreferrer" target="_blank">https://trac.osgeo.org/gdal/ticket/6175</a> (happy to have feedback from anyone<br>
more knowleagable)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</font></span></blockquote></div><br></div>