<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hello Fabien<br>
    <br>
    Le 09/12/10 01:48, Fabien Carrion a &eacute;crit&nbsp;:
    <blockquote cite="mid:4D002774.20801@gmail.com" type="cite">
      <pre wrap="">I am trying to move my project from geotools to geotoolkit, but I have a
problem. In geotools, the class NetcdfImageReader has a method to
getStatistics min and max values of a variable, which doesn't exists in
geotoolkit.
</pre>
    </blockquote>
    Actually the information is still there, but in a different way. A
    more standard way to get this kind of information with the Image I/O
    API is using <tt>IIOMetadata</tt>. In Geotk, we defined a <tt>SpatialMetadataFormat</tt>
    as a subset of ISO 19115-2. You can see the format here:<br>
    <br>
    <a
href="http://www.geotoolkit.org/apidocs/org/geotoolkit/image/io/metadata/SpatialMetadataFormat.html#default-formats">http://www.geotoolkit.org/apidocs/org/geotoolkit/image/io/metadata/SpatialMetadataFormat.html#default-formats</a><br>
    <br>
    In the right column, there is <tt>minValue</tt> and <tt>maxValue</tt>
    attributes. You can access them as below:<br>
    <br>
    <blockquote><tt>NetcdfImageReader reader = ...,<br>
        SpatialMetadata metadata = reader.getImageMetadata(0);<br>
        <br>
        <i>// From that point, there is a choice. You can explore<br>
          // the metadata using the standard API like a XML tree.<br>
          // Or you can use the convenience methods below.<br>
        </i><br>
        List&lt;SampleDimension&gt; bands =
        metadata.getListForType(SampleDimension.class);<br>
        SampleDimension firstBand = bands.get(0);<br>
        Double minValue = firstBand.getMinValue(); <i>// WARNING: Can
          be null!</i><br>
      </tt><tt>Double maxValue = firstBand.getMaxValue(); <i>//
          WARNING: Can be null!</i></tt><br>
    </blockquote>
    <br>
    <b>Tip:</b> If you wish to explore visually the metadata of your
    NetCDF file, the following may be useful (the following widget is
    defined in the <tt>geotk-widgets-swing</tt> module).<br>
    <br>
    <blockquote><tt>ImageFileChooser chooser = new
        ImageFileChooser("NetCDF", true);<br>
        chooser.showOpenDialog(null);<br>
      </tt></blockquote>
    <br>
    Then select your NetCDF file, and click on the "Metadata" tabs on
    the right side. Select the metadata format in the combo box, and you
    should see the metadata tree just below.<br>
    <br>
    Regards,<br>
    <br>
    &nbsp;&nbsp;&nbsp; Martin<br>
    <br>
  </body>
</html>