Class ResamplingDiagnostic

java.lang.Object
noaa.coastwatch.util.ResamplingDiagnostic
All Implemented Interfaces:
ResamplingMapFactory

public class ResamplingDiagnostic extends Object implements ResamplingMapFactory
A ResamplingDiagnostic generates statistics on the difference between a resampling map and the ideal resampling between a source and destination transform. The diagnostic is designed to be injected into the reampling operation using the Proxy pattern. The diagnostic catches calls made to a ResamplingMapFactory and stores information about the resampling for later analysis. To perform a diagnostic of the resampling, create a new diagnostic object using the resampling map factory that is going to be used in an actual resampling operation, and then pass the diagnostic object to the resampling instead of the actual factory. The diagnositc will accumulate data about the resampling. Then call complete() to finish the diagnostic. The diagnostic results are obtained from getDistErrorStats() and getOmegaStats().
Since:
3.5.0
Author:
Peter Hollemans
See Also:
  • Constructor Details

    • ResamplingDiagnostic

      public ResamplingDiagnostic(EarthTransform sourceTrans, ResamplingSourceImp sourceImp, EarthTransform destTrans, ResamplingMapFactory mapFactory, double factor)
      Creates a new diagnostic object.
      Parameters:
      sourceTrans - the source transform for resampling.
      sourceImp - the source-specific object to use for resampling queries.
      destTrans - the destination transform for resampling.
      mapFactory - the map factory being used to create resampling maps.
      factor - the diagnostic sampling factor in the range (0..1]. The pixel remapping will be sampled according to the factor where 0 is none of the pixels, and 1 is all of the pixels. A factor of 0.01 will sample 1% of the pixels, which is recommended.
  • Method Details

    • create

      public ResamplingMap create(int[] start, int[] length)
      Description copied from interface: ResamplingMapFactory
      Creates a new resampling map that covers a specified set of destination coordinates.
      Specified by:
      create in interface ResamplingMapFactory
      Parameters:
      start - the starting rectangle coordinates in the destination space as [row, col].
      length - the size of the rectangle in destination space as [rows, cols].
      Returns:
      a resampling object that covers the specified destination rectangle or null if the destination rectangle has no corresponding coordinates in the source space.
    • complete

      public void complete()
      Completes the diagnostic by finding the optimal resampled pixels in the source transform and generating statistics on the actual versus optimal resampling.
    • getDistStats

      public DoubleSummaryStatistics getDistStats()
      Gets the statistics for the distance in kilometers from the center of the destination pixel to the center of mapped source pixel.
      Returns:
      the statistics object.
    • getDistErrorStats

      public DoubleSummaryStatistics getDistErrorStats()
      Gets the statistics for (dist - opt) over all diagnostic samples, where dist is the distance in kilometers from the center of the destination pixel to the center of mapped source pixel, and opt is the distance in kilometers from the center of the destination pixel to the center of the optimal source pixel -- ie: the one that has the least distance possible to the destination pixel of all pixels in the source transform.
      Returns:
      the statistics object.
    • getOmegaStats

      public DoubleSummaryStatistics getOmegaStats()
      Gets the statistics for the omega normalized error index over all diagnostic samples. Omega is defined as 1 - (dist-opt)/(dist+opt) where dist and opt are as defined in getDistErrorStats(). Omega is a normalized error, whose value is 1 when the pixel chosen for the remapping is the optimal pixel, or < 1 otherwise. If both the distance and optimal distance are zero, omega is 1.
      Returns:
      the statistics object.
    • getSampleCount

      public int getSampleCount()
      Gets the diagnostic sample count, that is the number of remapped pixels used to generate statistics.
      Returns:
      the sample count.
    • getSuboptimalCount

      public int getSuboptimalCount()
      Gets the suboptimal pixel count, that is the number of remapped pixels that did not match their optimal pixel.
      Returns:
      the suboptimal pixel count.
    • getSuboptimalDiagnosticList

      public List<ResamplingDiagnostic.DiagnosticInfo> getSuboptimalDiagnosticList()
      Gets a list of the suboptimal diagnositic info objects. These are the diagnostic samples for which the actual mapped pixel did not match the optimal pixel from the source transform.
      Returns:
      the list of suboptimal diagnositic info objects.
      See Also: