/** * get the number of line in the whole scene * @return lines in the scene */ public int getSceneHeight() { return _lonGrid.getSceneRasterHeight(); }
private PodGeoCoding(TiePointGrid latGrid, TiePointGrid lonGrid, GeoApproximation[] approximations) { super(latGrid, lonGrid); this.approximations = approximations; final PlanarImage lonImage = lonGrid.getGeophysicalImage(); latImage = latGrid.getGeophysicalImage(); final Rectangle bounds = new Rectangle(0, 0, lonGrid.getSceneRasterWidth(), lonGrid.getSceneRasterHeight()); pixelPosEstimator = new PixelPosEstimator(approximations, bounds); pixelFinder = new PodPixelFinder(lonImage, latImage, null, 0.025); // slightly more than 2 km, half a border pixel }
/** * Gets a raster data holding this tie-point's interpolated pixel data for an entire product scene. <p/> * <p/> * In opposite to the <code>getRasterData</code> method, this method returns raster data that has at least * <code>getBandOutputRasterWidth()*getBandOutputRasterHeight()</code> elements of the given data type to store * the scene's pixels. * * @return raster data covering the pixels for a complete scene * * @see #getRasterData * @see #getRasterWidth * @see #getRasterHeight * @see #getSceneRasterWidth * @see #getSceneRasterHeight */ @Override public ProductData getSceneRasterData() { int width = getSceneRasterWidth(); int height = getSceneRasterHeight(); ProductData data = createCompatibleRasterData(width, height); final float[] elems = (float[]) data.getElems(); // getPixels will interpolate between tie points getPixels(0, 0, width, height, elems, ProgressMonitor.NULL); return data; }
/** * Returns the latitude and longitude value for a given pixel co-ordinate. * * @param pixelPos the pixel's co-ordinates given as x,y * @param geoPos an instance of <code>GeoPos</code> to be used as retun value. If this parameter is * <code>null</code>, the method creates a new instance which it then returns. * * @return the geographical position as lat/lon. */ @Override public GeoPos getGeoPos(final PixelPos pixelPos, GeoPos geoPos) { if (geoPos == null) { geoPos = new GeoPos(); } if (pixelPos.x < 0 || pixelPos.x > latGrid.getSceneRasterWidth() || pixelPos.y < 0 || pixelPos.y > latGrid.getSceneRasterHeight()) { geoPos.setInvalid(); } else { geoPos.lat = latGrid.getPixelFloat(pixelPos.x, pixelPos.y); geoPos.lon = lonGrid.getPixelFloat(pixelPos.x, pixelPos.y); } return geoPos; }
final int gcStripeSceneWidth = lonGrid.getSceneRasterWidth(); final int tpRasterHeight = lonGrid.getRasterHeight(); final int sceneHeight = lonGrid.getSceneRasterHeight(); final int stripeH; if (isHighResolution(sceneHeight, tpRasterHeight)) {
@Override public void encode(ProfileWriteContext ctx, Product p) throws IOException { boolean doFlip = getYFlippedProperty(ctx); for (TiePointGrid tiePointGrid : p.getTiePointGrids()) { final int h = tiePointGrid.getSceneRasterHeight(); final int w = tiePointGrid.getSceneRasterWidth(); final Object data = tiePointGrid.getSourceImage().getData().getDataElements(0, 0, w, h, null); ProductData productData = ProductData.createInstance(ProductData.TYPE_FLOAT32, data); String variableName = ReaderUtils.getVariableName(tiePointGrid); ctx.getNetcdfFileWriteable().findVariable(variableName).write(0, 0, w, h, doFlip, productData); } }
int subsetStepY = 1; final int srcSceneRasterWidth = sourceTiePointGrid.getSceneRasterWidth(); final int srcSceneRasterHeight = sourceTiePointGrid.getSceneRasterHeight(); int subsetWidth = srcSceneRasterWidth; int subsetHeight = srcSceneRasterHeight;
sourceOffsetY = (sourceTiePointGrid.getSceneRasterHeight() - (height - 1) * sourceStepY) - sourceOffsetY; for (int y = 0; y < height; y++) { System.arraycopy(sourcePoints, (height - y - 1) * width, targetPoints, y * width, width); sourceOffsetY = (sourceTiePointGrid.getSceneRasterHeight() - (height - 1) * sourceStepY) - sourceOffsetY; for (int y = 0; y < height; y++) { final int lineIndex = height - y - 1;
public void testAttributeQueries() { TiePointGrid grid = new TiePointGrid("x", 3, 5, 0, 0, 4, 2, _tiePoints); assertEquals("x", grid.getName()); assertEquals(3, grid.getRasterWidth()); assertEquals(5, grid.getRasterHeight()); assertEquals(9, grid.getSceneRasterHeight()); assertEquals(9, grid.getSceneRasterWidth()); assertEquals(9, grid.getSceneRasterHeight()); assertEquals(0, grid.getOffsetX(), 1e-6F); assertEquals(0, grid.getOffsetY(), 1e-6F); assertEquals(4, grid.getSubSamplingX(), 1e-6F); assertEquals(2, grid.getSubSamplingY(), 1e-6F); assertNotNull(grid.getTiePoints()); assertSame(grid.getTiePoints(), _tiePoints); assertEquals(15, grid.getTiePoints().length); for (int i = 0; i < 15; i++) { assertEquals(_tiePoints[i], grid.getTiePoints()[i], 1e-10F); } }
createScalarAttribute(datasetID, "scene_raster_height", grid.getSceneRasterHeight()); createScalarAttribute(datasetID, "offset_x", grid.getOffsetX()); createScalarAttribute(datasetID, "offset_y", grid.getOffsetY());