public String[] createTickmarkTexts() { final ArrayList<String> tickNames = new ArrayList<>(times.length()); setName("Acquisition Date"); int numTicks = getNumMajorTicks(); double min = getMinValue(); double dist = getMajorTickMarkDistance(); for (int i = 0; i < numTicks; ++i) { final double mjd = min + (i * dist); final ProductData.UTC newTime = new ProductData.UTC(mjd); final String tickStr = dateFormat.format(newTime.getAsDate()); tickNames.add(tickStr); } return tickNames.toArray(new String[tickNames.size()]); } }
private String toDate(double time) { final ProductData.UTC newTime = new ProductData.UTC(time); return dateFormat.format(newTime.getAsDate()); }
for(int i=0; i < stackOverview.length; ++i) { double mstMJD = stackOverview[i].getMasterSlave()[0].getMasterMetadata().getMjd(); final String mstDate = dateFormat.format(new ProductData.UTC(mstMJD).getAsDate()); for(int j=0; j< stackOverview[i].getMasterSlave().length; ++j) { double slvMJD = stackOverview[i].getMasterSlave()[j].getSlaveMetadata().getMjd(); final String slvDate = dateFormat.format(new ProductData.UTC(slvMJD).getAsDate());
workReportElem.getAttributeString(workRep.getName().trim()), dateFormat2); final double diff = centreTime.getMJD() - startTime.getMJD(); workReportTime = new ProductData.UTC(startTime.getMJD() + (diff * 2.0)); final ProductData.UTC centreTime = AbstractMetadata.parseUTC(centreTimeStr.trim(), dateFormat1); final double diff = centreTime.getMJD() - startTime.getMJD(); return new ProductData.UTC(startTime.getMJD() + (diff * 2.0)); } catch (Exception e) { time = AbstractMetadata.NO_METADATA_UTC;
final ProductData.UTC startTime = new ProductData.UTC(referenceUTC + firstLineTime); final ProductData.UTC stopTime = new ProductData.UTC(referenceUTC + lastLineTime);
final ProductData.UTC startTime = new ProductData.UTC(referenceUTC + firstLineTime); final ProductData.UTC stopTime = new ProductData.UTC(referenceUTC + lastLineTime);
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); } }
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); }
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); } }
/** * Update metadata in the target product. */ private void updateTargetProductMetadata() { final MetadataElement absTgt = AbstractMetadata.getAbstractedMetadata(targetProduct); if (excludeMaster) { final String[] slaveNames = StackUtils.getSlaveProductNames(sourceProduct); absTgt.setAttributeString(AbstractMetadata.PRODUCT, slaveNames[0]); final ProductData.UTC[] times = StackUtils.getProductTimes(sourceProduct); targetProduct.setStartTime(times[1]); double lineTimeInterval = absTgt.getAttributeDouble(AbstractMetadata.line_time_interval); int height = sourceProduct.getSceneRasterHeight(); ProductData.UTC endTime = new ProductData.UTC(times[1].getMJD() + (lineTimeInterval * height) / Constants.secondsInDay); targetProduct.setEndTime(endTime); } else { // only if its a full coregistered stack including master band AbstractMetadata.setAttribute(absTgt, AbstractMetadata.coregistered_stack, 1); } }
private ProductData.UTC getSourceMeanTime() { ProductData.UTC startTime = sourceProduct.getStartTime(); ProductData.UTC endTime = sourceProduct.getEndTime(); ProductData.UTC meanTime; if (startTime != null && endTime != null) { meanTime = new ProductData.UTC(0.5 * (startTime.getMJD() + endTime.getMJD())); } else if (startTime != null) { meanTime = startTime; } else if (endTime != null) { meanTime = endTime; } else { meanTime = null; } return meanTime; }