<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<p>Hello Brian<br>
</p>
<p>I just commited a missing code logic in Geotk. In about 5 hours
from now, you should have an updated geotk-SNAPSHOT with it.
Please give a new try to your code. You should now see the
following header in the ASCII file:</p>
<pre>NCOLS 5083
NROWS 4067
XLLCORNER 422960.2775983825
YLLCORNER 4118889.9067777675
CELLSIZE 50.0</pre>
<p>The "<tt>NODATA_VALUE</tt>" attribute is missing because it was
not declared in the first place (the NetCDF file contains NaN
values instead, which is fine). Geotk used -9999 by default as
documented there:</p>
<ul>
<li><a class="moz-txt-link-freetext" href="http://www.geotoolkit.org/apidocs/org/geotoolkit/image/io/plugin/AsciiGridWriter.html">http://www.geotoolkit.org/apidocs/org/geotoolkit/image/io/plugin/AsciiGridWriter.html</a></li>
</ul>
<p>However you can have more control on the metadata to be written
by overloading the following method:</p>
<pre> @Override
protected void completeImageMetadata(IIOMetadata metadata, GridCoverage coverage) throws IOException {
System.out.println(metadata);
}</pre>
<p></p>
<p>You should see a tree like below:</p>
<pre>geotk-coverageio_3.07
├───RectifiedGridDomain
│ ├───origin="422960.2775983825 4118889.9067777675"
│ ├───CoordinateReferenceSystem
│ │ ├───name="EPSG:WGS 84 / UTM zone 10N"
│ │ ├───type="projected"
│ │ ├───Datum
│ │ │ ├───name="EPSG:World Geodetic System 1984"
│ │ │ ├───type="geodetic"
│ │ │ ├───Ellipsoid
│ │ │ │ ├───name="EPSG:WGS 84"
│ │ │ │ ├───axisUnit="m"
│ │ │ │ ├───semiMajorAxis="6378137.0"
│ │ │ │ └───inverseFlattening="298.257223563"
│ │ │ └───PrimeMeridian
│ │ │ ├───name="EPSG:Greenwich"
│ │ │ ├───greenwichLongitude="0.0"
│ │ │ └───angularUnit="deg"
│ │ ├───CoordinateSystem
│ │ │ ├───name="EPSG:Cartesian 2D CS. Axes: easting, northing (E,N). Orientations: east, north. UoM: m."
│ │ │ ├───type="cartesian"
│ │ │ ├───dimension="2"
│ │ │ └───Axes
│ │ │ ├───CoordinateSystemAxis
│ │ │ │ ├───name="EPSG:Easting"
│ │ │ │ ├───axisAbbrev="E"
│ │ │ │ ├───direction="east"
│ │ │ │ └───unit="m"
│ │ │ └───CoordinateSystemAxis
│ │ │ ├───name="EPSG:Northing"
│ │ │ ├───axisAbbrev="N"
│ │ │ ├───direction="north"
│ │ │ └───unit="m"
│ │ └───Conversion
│ │ ├───name="EPSG:UTM zone 10N"
│ │ ├───method="Transverse Mercator"
│ │ └───Parameters
│ │ ├───ParameterValue
│ │ │ ├───name="central_meridian"
│ │ │ └───value="-123.0"
│ │ ├───ParameterValue
│ │ │ ├───name="scale_factor"
│ │ │ └───value="0.9996"
│ │ └───ParameterValue
│ │ ├───name="false_easting"
│ │ └───value="500000.0"
│ ├───OffsetVectors
│ │ ├───OffsetVector
│ │ │ └───values="50.0 0.0"
│ │ └───OffsetVector
│ │ └───values="0.0 -50.0"
│ └───Limits
│ ├───low="0 0"
│ └───high="5082 4066"
├───SpatialRepresentation
│ ├───numberOfDimensions="2"
│ ├───centerPoint="550035.2775983824 4017214.9067777675"
│ └───pointInPixel="upperLeft"
└───ImageDescription
└───Dimensions
└───Dimension
├───descriptor="z"
├───scaleFactor="1.0"
└───offset="0.0"</pre>
<p><br>
To add an explicit fill value, use the following code:</p>
<pre> @Override
protected void completeImageMetadata(IIOMetadata metadata, GridCoverage coverage) throws IOException {
MetadataAccessor accessor = new MetadataAccessor(metadata, SpatialMetadataFormat.FORMAT_NAME, "ImageDescription/Dimensions", "Dimension");
accessor.selectChild(0); // 0 is the band number (only one in this case)
accessor.setAttribute("fillSampleValues", -9999);
}</pre>
<p><br>
Martin</p>
<p><br>
</p>
</body>
</html>