code: public static RandomIter getRandomIterator( GridCoverage2D coverage ) {
          if (coverage instanceof GrassLegacyGridCoverage2D) {
              GrassLegacyGridCoverage2D grassGC = (GrassLegacyGridCoverage2D) coverage;
              GrassLegacyRandomIter iter = new GrassLegacyRandomIter(grassGC.getData());
              return iter;
          }
          RenderedImage renderedImage = coverage.getRenderedImage();
          RandomIter iter = RandomIterFactory.create(renderedImage, null);
          return iter;
      }
docs: Creates a {@link RandomIter} for the given {@link GridCoverage2D}.
  
  <p>It is important to use this method since it supports also
  large GRASS rasters.
  
  @param coverage the coverage on which to wrap a {@link RandomIter}.
  @return the iterator.