ContourProcess sets NODATA range to (-Inf, Inf)
-----------------------------------------------

                 Key: GEOT-3864
                 URL: https://jira.codehaus.org/browse/GEOT-3864
             Project: GeoTools
          Issue Type: Bug
          Components: process
    Affects Versions: 8.0-M1
            Reporter: Michael Bedward
            Assignee: Michael Bedward
             Fix For: 8.0-M2


When no specific NODATA values are defined in the input grid coverage sample 
dimensions, the process ends up creating a jaitools Range object which 
corresponds to (-Inf, Inf). This results in an NPE in the jaitools 
ContourOpImage constructor.

The problem seems to be in this part of the ContourProcess.execute method:

{code}
            // handle also readers setting up nodata in a category with a 
specific name
            if (sd.getCategories() != null) {
                for (Category cat : sd.getCategories()) {
                    if (cat.getName().equals(NO_DATA)) {
                        final NumberRange<? extends Number> catRange = 
cat.getRange();
                        if (catRange.getMinimum() == catRange.getMaximum()) {
                            noDataList.add(catRange.getMinimum());
                        } else {
                            Range<Double> noData = new 
Range<Double>(catRange.getMinimum(),
                                    catRange.isMinIncluded(), 
catRange.getMaximum(),
                                    catRange.isMaxIncluded());
                            noDataList.add(noData);
                        }
                    }
                }
            }
{code}

For a coverage without NODATA values defined, cat.getRange() will return a 
range with Double.NaN as both min and max. The comparison catRange.getMinimum() 
== catRange.getMaximum() will return false in this case. As a result, a 
jaitools Range object is constructed with Double.NaN as both min and max. The 
resulting Range behaves as (-Inf, Inf).

I think this means ContourProcess hasn't been used much :)


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to