private void addVector(String name, MetadataElement orbitVectorListElem, BinaryRecord platformPosRec, int num) { final MetadataElement orbitVectorElem = new MetadataElement(name + num); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, getOrbitTime(platformPosRec, num)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, platformPosRec.getAttributeDouble("Position vector X " + num)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, platformPosRec.getAttributeDouble("Position vector Y " + num)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, platformPosRec.getAttributeDouble("Position vector Z " + num)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, platformPosRec.getAttributeDouble("Velocity vector X' " + num)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, platformPosRec.getAttributeDouble("Velocity vector Y' " + num)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, platformPosRec.getAttributeDouble("Velocity vector Z' " + num)); orbitVectorListElem.addElement(orbitVectorElem); }
final float lonLR = Float.parseFloat(str.substring(str.indexOf(',') + 1, str.lastIndexOf(','))); absRoot.setAttributeDouble(AbstractMetadata.first_near_lat, latUL); absRoot.setAttributeDouble(AbstractMetadata.first_near_long, lonUL); absRoot.setAttributeDouble(AbstractMetadata.first_far_lat, latUR); absRoot.setAttributeDouble(AbstractMetadata.first_far_long, lonUR); absRoot.setAttributeDouble(AbstractMetadata.last_near_lat, latLL); absRoot.setAttributeDouble(AbstractMetadata.last_near_long, lonLL); absRoot.setAttributeDouble(AbstractMetadata.last_far_lat, latLR); absRoot.setAttributeDouble(AbstractMetadata.last_far_long, lonLR);
private void addVector(String name, MetadataElement orbitVectorListElem, MetadataElement srcElem, int num) { final MetadataElement orbitVectorElem = new MetadataElement(name + num); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, ReaderUtils.getTime(srcElem, "timeUTC", standardDateFormat)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, srcElem.getAttributeDouble("posX", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, srcElem.getAttributeDouble("posY", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, srcElem.getAttributeDouble("posZ", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, srcElem.getAttributeDouble("velX", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, srcElem.getAttributeDouble("velY", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, srcElem.getAttributeDouble("velZ", 0)); orbitVectorListElem.addElement(orbitVectorElem); }
final float lonLR = Float.parseFloat(str.substring(str.indexOf(',') + 1, str.lastIndexOf(','))); absRoot.setAttributeDouble(AbstractMetadata.first_near_lat, latUL); absRoot.setAttributeDouble(AbstractMetadata.first_near_long, lonUL); absRoot.setAttributeDouble(AbstractMetadata.first_far_lat, latUR); absRoot.setAttributeDouble(AbstractMetadata.first_far_long, lonUR); absRoot.setAttributeDouble(AbstractMetadata.last_near_lat, latLL); absRoot.setAttributeDouble(AbstractMetadata.last_near_long, lonLL); absRoot.setAttributeDouble(AbstractMetadata.last_far_lat, latLR); absRoot.setAttributeDouble(AbstractMetadata.last_far_long, lonLR);
private void addVector(final String name, final MetadataElement orbitVectorListElem, final MetadataElement orbitElem, final int num) { final MetadataElement orbitVectorElem = new MetadataElement(name + num); final MetadataElement positionElem = orbitElem.getElement("position"); final MetadataElement velocityElem = orbitElem.getElement("velocity"); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, ReaderUtils.getTime(orbitElem, "time", sentinelDateFormat)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, positionElem.getAttributeDouble("x", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, positionElem.getAttributeDouble("y", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, positionElem.getAttributeDouble("z", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, velocityElem.getAttributeDouble("x", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, velocityElem.getAttributeDouble("y", 0)); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, velocityElem.getAttributeDouble("z", 0)); orbitVectorListElem.addElement(orbitVectorElem); }
final float[] lonCorners = new float[]{lonUL, lonUR, lonLL, lonLR}; absRoot.setAttributeDouble(AbstractMetadata.first_near_lat, latUL); absRoot.setAttributeDouble(AbstractMetadata.first_near_long, lonUL); absRoot.setAttributeDouble(AbstractMetadata.first_far_lat, latUR); absRoot.setAttributeDouble(AbstractMetadata.first_far_long, lonUR); absRoot.setAttributeDouble(AbstractMetadata.last_near_lat, latLL); absRoot.setAttributeDouble(AbstractMetadata.last_near_long, lonLL); absRoot.setAttributeDouble(AbstractMetadata.last_far_lat, latLR); absRoot.setAttributeDouble(AbstractMetadata.last_far_long, lonLR);
orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, xPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, yPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, zPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, xVelECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, yVelECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, zVelECEF);
public static void addLookDirection(final String name, final MetadataElement lookDirectionListElem, final int index, final int num, final int sourceImageWidth, final int sourceImageHeight, final double firstLineUTC, final double lineTimeInterval, final boolean nearRangeOnLeft, final GeoCoding geoCoding) { final MetadataElement lookDirectionElem = new MetadataElement(name + index); int xHead, xTail, y; if (num == 1) { y = sourceImageHeight / 2; } else if (num > 1) { y = (index - 1) * sourceImageHeight / (num - 1); } else { throw new OperatorException("Invalid number of look directions"); } final double time = firstLineUTC + y * lineTimeInterval; lookDirectionElem.setAttributeUTC("time", new ProductData.UTC(time)); if (nearRangeOnLeft) { xHead = sourceImageWidth - 1; xTail = 0; } else { xHead = 0; xTail = sourceImageWidth - 1; } final GeoPos geoPosHead = geoCoding.getGeoPos(new PixelPos(xHead, y), null); final GeoPos geoPosTail = geoCoding.getGeoPos(new PixelPos(xTail, y), null); lookDirectionElem.setAttributeDouble("head_lat", geoPosHead.lat); lookDirectionElem.setAttributeDouble("head_lon", geoPosHead.lon); lookDirectionElem.setAttributeDouble("tail_lat", geoPosTail.lat); lookDirectionElem.setAttributeDouble("tail_lon", geoPosTail.lon); lookDirectionListElem.addElement(lookDirectionElem); }
orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, xPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, yPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, zPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, xVelECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, yVelECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, zVelECEF);
warpDataElem.addElement(gcpElem); gcpElem.setAttributeDouble("mst_x", warpData.getXMasterCoord(i)); gcpElem.setAttributeDouble("mst_y", warpData.getYMasterCoord(i)); gcpElem.setAttributeDouble("slv_x", warpData.getXSlaveCoord(i)); gcpElem.setAttributeDouble("slv_y", warpData.getYSlaveCoord(i)); gcpElem.setAttributeDouble("rms", warpData.getRMS(i)); warpDataElem.setAttributeDouble("rmsStd", warpData.getRMSStd()); warpDataElem.setAttributeDouble("rmsMean", warpData.getRMSMean()); warpDataElem.setAttributeDouble("rowResidualStd", warpData.getRowResidualStd()); warpDataElem.setAttributeDouble("rowResidualMean", warpData.getRowResidualMean()); warpDataElem.setAttributeDouble("colResidualStd", warpData.getColResidualStd()); warpDataElem.setAttributeDouble("colResidualMean", warpData.getColResidualMean());
private void addVector(String name, MetadataElement orbitVectorListElem, MetadataElement srcElem, int num) { final MetadataElement orbitVectorElem = new MetadataElement(name + num); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, ReaderUtils.getTime(srcElem, "timeStamp", standardDateFormat)); final MetadataElement xpos = srcElem.getElement("xPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, xpos.getAttributeDouble("xPosition", 0)); final MetadataElement ypos = srcElem.getElement("yPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, ypos.getAttributeDouble("yPosition", 0)); final MetadataElement zpos = srcElem.getElement("zPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, zpos.getAttributeDouble("zPosition", 0)); final MetadataElement xvel = srcElem.getElement("xVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, xvel.getAttributeDouble("xVelocity", 0)); final MetadataElement yvel = srcElem.getElement("yVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, yvel.getAttributeDouble("yVelocity", 0)); final MetadataElement zvel = srcElem.getElement("zVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, zvel.getAttributeDouble("zVelocity", 0)); orbitVectorListElem.addElement(orbitVectorElem); }
private void addVector(String name, MetadataElement orbitVectorListElem, MetadataElement srcElem, int num) { final MetadataElement orbitVectorElem = new MetadataElement(name + num); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, ReaderUtils.getTime(srcElem, "timeUTC", standardDateFormat)); final MetadataElement xpos = srcElem.getElement("posX"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, xpos.getAttributeDouble("posX", 0)); final MetadataElement ypos = srcElem.getElement("posY"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, ypos.getAttributeDouble("posY", 0)); final MetadataElement zpos = srcElem.getElement("posZ"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, zpos.getAttributeDouble("posZ", 0)); final MetadataElement xvel = srcElem.getElement("velX"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, xvel.getAttributeDouble("velX", 0)); final MetadataElement yvel = srcElem.getElement("velY"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, yvel.getAttributeDouble("velY", 0)); final MetadataElement zvel = srcElem.getElement("velZ"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, zvel.getAttributeDouble("velZ", 0)); orbitVectorListElem.addElement(orbitVectorElem); }
orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, xPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, yPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, zPosECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, xVelECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, yVelECEF); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, zVelECEF);
private void addVector(String name, MetadataElement orbitVectorListElem, MetadataElement srcElem, int num) { final MetadataElement orbitVectorElem = new MetadataElement(name + num); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, ReaderUtils.getTime(srcElem, "timeStamp", standardDateFormat)); final MetadataElement xpos = srcElem.getElement("xPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, xpos.getAttributeDouble("xPosition", 0)); final MetadataElement ypos = srcElem.getElement("yPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, ypos.getAttributeDouble("yPosition", 0)); final MetadataElement zpos = srcElem.getElement("zPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, zpos.getAttributeDouble("zPosition", 0)); final MetadataElement xvel = srcElem.getElement("xVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, xvel.getAttributeDouble("xVelocity", 0)); final MetadataElement yvel = srcElem.getElement("yVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, yvel.getAttributeDouble("yVelocity", 0)); final MetadataElement zvel = srcElem.getElement("zVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, zvel.getAttributeDouble("zVelocity", 0)); orbitVectorListElem.addElement(orbitVectorElem); }
private void addVector(String name, MetadataElement orbitVectorListElem, MetadataElement srcElem, int num) { final MetadataElement orbitVectorElem = new MetadataElement(name + num); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, ReaderUtils.getTime(srcElem, "timeStamp", standardDateFormat)); final MetadataElement xpos = srcElem.getElement("xPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, xpos.getAttributeDouble("xPosition", 0)); final MetadataElement ypos = srcElem.getElement("yPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, ypos.getAttributeDouble("yPosition", 0)); final MetadataElement zpos = srcElem.getElement("zPosition"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, zpos.getAttributeDouble("zPosition", 0)); final MetadataElement xvel = srcElem.getElement("xVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, xvel.getAttributeDouble("xVelocity", 0)); final MetadataElement yvel = srcElem.getElement("yVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, yvel.getAttributeDouble("yVelocity", 0)); final MetadataElement zvel = srcElem.getElement("zVelocity"); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, zvel.getAttributeDouble("zVelocity", 0)); orbitVectorListElem.addElement(orbitVectorElem); }
warpDataElem.addElement(gcpElem); gcpElem.setAttributeDouble("mst_x", velocityData.mstGCPx[i][j]); gcpElem.setAttributeDouble("mst_y", velocityData.mstGCPy[i][j]); gcpElem.setAttributeDouble("slv_x", velocityData.slvGCPx[i][j]); gcpElem.setAttributeDouble("slv_y", velocityData.slvGCPy[i][j]); k++;
private void addOrbitStateVectors(final MetadataElement absRoot, final MetadataElement globalElem) { final MetadataElement orbitVectorListElem = absRoot.getElement(AbstractMetadata.orbit_state_vectors); final ProductData.UTC referenceUTC = ReaderUtils.getTime(globalElem, "Reference_UTC", standardDateFormat); final int numPoints = globalElem.getAttributeInt("Number_of_State_Vectors"); for (int i = 0; i < numPoints; i++) { final double stateVectorTime = globalElem.getAttribute("State_Vectors_Times").getData().getElemDoubleAt(i); final ProductData.UTC orbitTime = new ProductData.UTC(referenceUTC.getMJD() + stateVectorTime / Constants.secondsInDay); final ProductData pos = globalElem.getAttribute("ECEF_Satellite_Position").getData(); final ProductData vel = globalElem.getAttribute("ECEF_Satellite_Velocity").getData(); final double satellitePositionX = pos.getElemDoubleAt(3 * i); final double satellitePositionY = pos.getElemDoubleAt(3 * i + 1); final double satellitePositionZ = pos.getElemDoubleAt(3 * i + 2); final double satelliteVelocityX = vel.getElemDoubleAt(3 * i); final double satelliteVelocityY = vel.getElemDoubleAt(3 * i + 1); final double satelliteVelocityZ = vel.getElemDoubleAt(3 * i + 2); final MetadataElement orbitVectorElem = new MetadataElement(AbstractMetadata.orbit_vector + (i + 1)); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, orbitTime); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, satellitePositionX); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, satellitePositionY); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, satellitePositionZ); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, satelliteVelocityX); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, satelliteVelocityY); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, satelliteVelocityZ); orbitVectorListElem.addElement(orbitVectorElem); } }
private void addOrbitStateVectors(final MetadataElement absRoot, final MetadataElement globalElem) { final MetadataElement orbitVectorListElem = absRoot.getElement(AbstractMetadata.orbit_state_vectors); final ProductData.UTC referenceUTC = ReaderUtils.getTime(globalElem, "Reference_UTC", standardDateFormat); final int numPoints = globalElem.getAttributeInt("Number_of_State_Vectors"); AbstractMetadata.setAttribute(absRoot, AbstractMetadata.STATE_VECTOR_TIME, referenceUTC); for (int i = 0; i < numPoints; i++) { final double stateVectorTime = globalElem.getAttribute("State_Vectors_Times").getData().getElemDoubleAt(i); final ProductData.UTC orbitTime = new ProductData.UTC(referenceUTC.getMJD() + stateVectorTime / Constants.secondsInDay); final ProductData pos = globalElem.getAttribute("ECEF_Satellite_Position").getData(); final ProductData vel = globalElem.getAttribute("ECEF_Satellite_Velocity").getData(); final double satellitePositionX = pos.getElemDoubleAt(3 * i); final double satellitePositionY = pos.getElemDoubleAt(3 * i + 1); final double satellitePositionZ = pos.getElemDoubleAt(3 * i + 2); final double satelliteVelocityX = vel.getElemDoubleAt(3 * i); final double satelliteVelocityY = vel.getElemDoubleAt(3 * i + 1); final double satelliteVelocityZ = vel.getElemDoubleAt(3 * i + 2); final MetadataElement orbitVectorElem = new MetadataElement(AbstractMetadata.orbit_vector + (i + 1)); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, orbitTime); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, satellitePositionX); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, satellitePositionY); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, satellitePositionZ); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, satelliteVelocityX); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, satelliteVelocityY); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, satelliteVelocityZ); orbitVectorListElem.addElement(orbitVectorElem); } }
/** * Create target product. */ private void createTargetProduct() { targetProduct = new Product(sourceProduct.getName() + PRODUCT_SUFFIX, sourceProduct.getProductType(), sourceImageWidth, sourceImageHeight); addSelectedBands(); ProductUtils.copyProductNodes(sourceProduct, targetProduct); final MetadataElement absTgt = AbstractMetadata.getAbstractedMetadata(targetProduct); if (externalDEMFile != null && fileElevationModel == null) { // if external DEM file is specified by user AbstractMetadata.setAttribute(absTgt, AbstractMetadata.DEM, externalDEMFile.getPath()); } else { AbstractMetadata.setAttribute(absTgt, AbstractMetadata.DEM, demName); } absTgt.setAttributeString("DEM resampling method", demResamplingMethod); if (externalDEMFile != null) { absTgt.setAttributeDouble("external DEM no data value", externalDEMNoDataValue); } }
bandComponentElement.setAttributeDouble("offset", pass1[0]); productBand.setScalingOffset(pass1[0]); bandComponentElement.setAttributeDouble("scale", pass1[0]); productBand.setScalingFactor(pass1[0]);