private TiePointGrid addTiePointGrid(Product product, String name, String units, int height, float[] data, int discontinuity) { final TiePointGrid grid = new TiePointGrid(name, TIE_POINT_GRID_WIDTH, height, TIE_POINT_OFFSET_X + 0.5f, 0.5f, TIE_POINT_SAMPLING_X, 1, data, discontinuity); grid.setUnit(units); product.addTiePointGrid(grid); return grid; }
/** * Parses a complete tie point grid and adds it to the tie poinzts grids vector */ private void parseTiePointGrid(String tiePtName, String description) throws IOException { TiePointGrid grid = null; int arraySize = ATSR_TIE_PT_GRID_WIDTH * ATSR_TIE_PT_GRID_HEIGHT; float[] fData = parseFloatArray(ANGLE_PARAMETER_SIZE, arraySize); grid = new TiePointGrid(tiePtName, ATSR_TIE_PT_GRID_WIDTH, ATSR_TIE_PT_GRID_HEIGHT, ATSR_TIE_PT_OFFS_X, 0, ATSR_TIE_PT_SUBS_X, ATSR_TIE_PT_SUBS_Y, fData); grid.setUnit(ANGLE_UNIT); if (description != null) { grid.setDescription(description); } _tiePointGrids.add(grid); } }
private static TiePointGrid createTiePointGrid(String name, int sceneW, int sceneH, int stepX, int stepY, int offX, int offY) { final int gridWidth = sceneW / stepX + 1; final int gridHeight = sceneH / stepY + 1; final float[] floats = new float[gridWidth * gridHeight]; for (int i = 0; i < floats.length; i++) { floats[i] = i * 3.54f; } final TiePointGrid tpg = new TiePointGrid(name, gridWidth, gridHeight, offX, offY, stepX, stepY, floats); tpg.setDescription(name + "-Description"); tpg.setUnit(name + "-unit"); return tpg; }
tiePointGrid.setUnit(gridInfo.getChildTextTrim(DimapProductConstants.TAG_TIE_POINT_PHYSICAL_UNIT)); product.addTiePointGrid(tiePointGrid);
private TiePointGrid createTiePointGrid(String name, int sceneW, int sceneH, float offX, float offY, float stepX, float stepY, boolean cyclic) { int gridWidth = Math.round((sceneW - 1) / stepX + 1); int gridHeight = Math.round((sceneH - 1) / stepY + 1); float[] floats = new float[gridWidth * gridHeight]; for (int i = 0; i < floats.length; i++) { floats[i] = (float) (20.0 + 10.0 * Math.random()); } TiePointGrid tpg = null; if (!cyclic) { tpg = new TiePointGrid(name, gridWidth, gridHeight, offX, offY, stepX, stepY, floats); } else { tpg = new TiePointGrid(name, gridWidth, gridHeight, offX, offY, stepX, stepY, floats, TiePointGrid.DISCONT_AT_180); } tpg.setDescription(name + "-Description"); tpg.setUnit(name + "-unit"); return tpg; }
latTiePoints); latGrid.setDescription(AtsrConstants.LATITUDE_DESCRIPTION); latGrid.setUnit(AtsrConstants.ANGLE_UNIT); _header.addTiePointGrid(latGrid); lonTiePoints, TiePointGrid.DISCONT_AT_180); lonGrid.setDescription(AtsrConstants.LONGITUDE_DESCRIPTION); lonGrid.setUnit(AtsrConstants.ANGLE_UNIT); _header.addTiePointGrid(lonGrid);
protected void addTiePointGrids() throws IOException { int tpSubsampling = avhrrFile.getTiePointSubsampling(); final int gridHeight = avhrrFile.getProductHeight() / tpSubsampling + 1; String[] tiePointNames = avhrrFile.getTiePointNames(); float[][] tiePointData = avhrrFile.getTiePointData(); final int numGrids = tiePointNames.length; TiePointGrid grid[] = new TiePointGrid[numGrids]; for (int i = 0; i < grid.length; i++) { grid[i] = createTiePointGrid(tiePointNames[i], TP_GRID_WIDTH, gridHeight, TP_OFFSET_X, TP_OFFSET_Y, tpSubsampling, tpSubsampling, tiePointData[i]); grid[i].setUnit(UNIT_DEG); product.addTiePointGrid(grid[i]); } GeoCoding geoCoding = new TiePointGeoCoding(grid[numGrids - 2], grid[numGrids - 1], Datum.WGS_72); product.setGeoCoding(geoCoding); }
public TiePointGrid cloneTiePointGrid() { final float[] srcTiePoints = this.getTiePoints(); final float[] destTiePoints = new float[srcTiePoints.length]; System.arraycopy(srcTiePoints, 0, destTiePoints, 0, srcTiePoints.length); TiePointGrid clone = new TiePointGrid(this.getName(), this.getRasterWidth(), this.getRasterHeight(), this.getOffsetX(), this.getOffsetY(), this.getSubSamplingX(), this.getSubSamplingY(), destTiePoints, this.getDiscontinuity()); clone.setUnit(getUnit()); clone.setDescription(getDescription()); return clone; }
tiePoints, sourceTiePointGrid.getDiscontinuity()); tiePointGrid.setUnit(sourceTiePointGrid.getUnit()); tiePointGrid.setDescription(sourceTiePointGrid.getDescription()); return tiePointGrid;
String units = NetCDFUtils.getNamedStringAttribute(unitAttribName, netCDFAttributes); if (units != null) { gridRet.setUnit(units);
targetPoints, sourceTiePointGrid.getDiscontinuity()); tiePointGrid.setUnit(sourceTiePointGrid.getUnit()); tiePointGrid.setDescription(sourceTiePointGrid.getDescription()); product.addTiePointGrid(tiePointGrid);
tiePoints); if (bandInfo.getPhysicalUnit() != null) { tiePointGrid.setUnit(bandInfo.getPhysicalUnit());
final TiePointGrid tiePointGrid1 = new TiePointGrid("tpg1n", 5, 4, 2, 3, 4, 5, tpg1tp); tiePointGrid1.setDescription("tpg1d"); tiePointGrid1.setUnit("tpg1u"); sourceProduct.addTiePointGrid(tiePointGrid1); final TiePointGrid tiePointGrid2 = new TiePointGrid("tpg2n", 4, 5, 1.2f, 1.4f, 5, 4, tpg2tp); tiePointGrid2.setDescription("tpg2d"); tiePointGrid2.setUnit("tpg2u"); sourceProduct.addTiePointGrid(tiePointGrid2);