Пример #1
0
  /** Creates the final database if the algorithm needs this step to be performed. */
  protected void createFinalDatabase() throws IOException, ProcessorException {
    getLogger().info(L3Constants.LOG_MSG_CREATE_FINAL_DB);

    finalDB = new TemporalBinDatabase(context, BinDatabaseConstants.FINAL_DB_NAME);
    finalDB.setNumVarsPerBand(context.getNumberOfInterpretedVarsPerBand());
    finalDB.create();

    getLogger().info(ProcessorConstants.LOG_MSG_SUCCESS);
  }
Пример #2
0
  /** Trigger base class to load the temporal bin database provided with the request file */
  protected void loadTemporalDatabase() throws IOException, ProcessorException {
    getLogger().info(L3Constants.LOG_MSG_LOAD_TEMP_DB);

    temporalDB = new TemporalBinDatabase(context, BinDatabaseConstants.TEMP_DB_NAME);
    temporalDB.setNumVarsPerBand(context.getNumberOfAccumulatingVarsPerBand());
    temporalDB.open();

    if (context.getProcessedProducts().length < 1) {
      handleError(L3Constants.LOG_MSG_EMPTY_DB);
    }
    getLogger().info(ProcessorConstants.LOG_MSG_SUCCESS);
  }
Пример #3
0
 /** Deletes the final database */
 protected void deleteFinalDatabase() throws IOException {
   if (finalDB != null && deleteDb) {
     getLogger().info(L3Constants.LOG_MSG_DELETE_FINAL_DB);
     finalDB.delete();
     getLogger().info(ProcessorConstants.LOG_MSG_SUCCESS);
   }
 }
Пример #4
0
 /** Deletes the temporal database if specified to do so */
 protected void deleteTemporalDatabase() throws IOException {
   if (deleteDb) {
     getLogger().info(L3Constants.LOG_MSG_DELETE_TEMP_DB);
     temporalDB.delete();
     getLogger().info(ProcessorConstants.LOG_MSG_SUCCESS);
     File databaseDir = context.getDatabaseDir();
     databaseDir.delete();
   }
 }
Пример #5
0
  /** Interpretes the bins of the temporal database if algorithm needs this to be done. */
  protected void processBinIterpretation(ProgressMonitor pm) throws IOException {
    getLogger().info(L3Constants.LOG_MSG_INTERPRETE_BIN_CONTENT);

    final int rowOffset = temporalDB.getRowOffset();
    final int colOffset = temporalDB.getColOffset();
    final int width = temporalDB.getWidth();
    final int height = temporalDB.getHeight();
    Point rowcol = new Point();
    Bin tempBin = temporalDB.createBin();
    Bin finalBin = finalDB.createBin();

    pm.beginTask(L3Constants.LOG_MSG_INTERPRETE_BIN_CONTENT, height - rowOffset);
    try {
      for (int row = rowOffset; row < rowOffset + height; row++) {
        rowcol.y = row;
        for (int col = colOffset; col < colOffset + width; col++) {
          rowcol.x = col;

          temporalDB.read(rowcol, tempBin);
          final L3Context.BandDefinition[] bandDefinitions = context.getBandDefinitions();
          for (int bandIndex = 0; bandIndex < bandDefinitions.length; bandIndex++) {
            final L3Context.BandDefinition bandDef = bandDefinitions[bandIndex];
            final Algorithm algo = bandDef.getAlgorithm();
            tempBin.setBandIndex(bandIndex);
            finalBin.setBandIndex(bandIndex);
            algo.interprete(tempBin, finalBin);
          }
          finalDB.write(rowcol, finalBin);
        }

        // update progressbar
        pm.worked(1);
        if (pm.isCanceled()) {
          getLogger().warning(L3Constants.LOG_MSG_PROC_CANCELED);
          setCurrentState(L3Constants.STATUS_ABORTED);
          break;
        }
      }

    } finally {
      pm.done();
      finalDB.flush();
    }

    getLogger().info(ProcessorConstants.LOG_MSG_SUCCESS);
  }