double yRes = env.getHeight() / worldToGrid.getHeight();
JGrassRegion region = new JGrassRegion(env.getMinX(), env.getMaxX(), env.getMinY(), env
.getMaxY(), xRes, yRes);
GrassBinaryImageWriterSpi writerSpi = new GrassBinaryImageWriterSpi();
GrassBinaryImageWriter writer = new GrassBinaryImageWriter(writerSpi, monitor);
RenderedImage renderedImage = gridCoverage2D.view(ViewType.GEOPHYSICS)
.getRenderedImage();
writer.setOutput(output, region);
writer.write(renderedImage);