Exemplo n.º 1
0
  // Creates a MERIS bitmask term given the bitmask expression from the request. If no expression is
  // set, it uses the
  // default expression
  private void createMerisBitmaskTerm() throws ProcessorException {
    if ("".equalsIgnoreCase(_bitMaskExpression)) {
      _bitMaskTerm =
          ProcessorUtils.createTerm(SmacConstants.DEFAULT_MERIS_FLAGS_VALUE, _inputProduct);

      _logger.warning(SmacConstants.LOG_MSG_NO_BITMASK);
      _logger.warning(
          SmacConstants.LOG_MSG_DEFAULT_BITMASK + SmacConstants.DEFAULT_MERIS_FLAGS_VALUE);
    } else {
      _bitMaskTerm = ProcessorUtils.createTerm(_bitMaskExpression, _inputProduct);

      _logger.info(SmacConstants.LOG_MSG_BITMASK + _bitMaskExpression);
    }
  }
Exemplo n.º 2
0
  // Creates an AATSR bitmask term given the bitmask expression from the request. If no expression
  // is set, it uses the
  // default expression
  private void createAatsrBitmaskTerm() throws ProcessorException {
    if ("".equalsIgnoreCase(_bitMaskExpression)) {
      _bitMaskTerm =
          ProcessorUtils.createTerm(SmacConstants.DEFAULT_NADIR_FLAGS_VALUE, _inputProduct);
      _bitMaskTermForward =
          ProcessorUtils.createTerm(SmacConstants.DEFAULT_FORWARD_FLAGS_VALUE, _inputProduct);

      _logger.warning(SmacConstants.LOG_MSG_NO_BITMASK);
      _logger.warning(
          SmacConstants.LOG_MSG_DEFAULT_NADIR_BITMASK + SmacConstants.DEFAULT_NADIR_FLAGS_VALUE);
      _logger.warning(
          SmacConstants.LOG_MSG_DEFAULT_FORWARD_BITMASK
              + SmacConstants.DEFAULT_FORWARD_FLAGS_VALUE);
    } else {
      _bitMaskTerm = ProcessorUtils.createTerm(_bitMaskExpression, _inputProduct);
      _bitMaskTermForward = ProcessorUtils.createTerm(_bitMaskExpressionForward, _inputProduct);

      _logger.info(SmacConstants.LOG_MSG_NADIR_BITMASK + _bitMaskExpression);
      _logger.info(SmacConstants.LOG_MSG_FORWARD_BITMASK + _bitMaskExpressionForward);
    }
  }
Exemplo n.º 3
0
  // Creates the output product for the given request.
  private void createOutputProduct(ProgressMonitor pm) throws IOException, ProcessorException {

    // take only the first output product. There might be more but we will ignore
    // these in SMAC.
    ProductRef prod = getRequest().getOutputProductAt(0);
    checkParamNotNull(prod, "output product");

    String productType = _inputProduct.getProductType() + "_SMAC";
    String productName = getOutputProductNameSafe();
    int sceneWidth = _inputProduct.getSceneRasterWidth();
    int sceneHeight = _inputProduct.getSceneRasterHeight();
    _outputProduct = new Product(productName, productType, sceneWidth, sceneHeight);

    ProductWriter writer = ProcessorUtils.createProductWriter(prod);
    _outputProduct.setProductWriter(writer);

    // loop over bands and create them
    // -------------------------------
    if (ObjectUtils.equalObjects(_sensorType, SensorCoefficientManager.MERIS_NAME)) {
      addBandsToOutput("Atmosphere corrected MERIS band ", true);
    } else {
      addBandsToOutput("Atmosphere corrected band ");
    }
    ProductUtils.copyTiePointGrids(_inputProduct, _outputProduct);
    copyRequestMetaData(_outputProduct);
    copyFlagBands(_inputProduct, _outputProduct);

    // for MERIS FSG / FRG products
    copyBand(
        EnvisatConstants.MERIS_AMORGOS_L1B_CORR_LATITUDE_BAND_NAME, _inputProduct, _outputProduct);
    copyBand(
        EnvisatConstants.MERIS_AMORGOS_L1B_CORR_LONGITUDE_BAND_NAME, _inputProduct, _outputProduct);
    copyBand(EnvisatConstants.MERIS_AMORGOS_L1B_ALTIUDE_BAND_NAME, _inputProduct, _outputProduct);

    copyGeoCoding(_inputProduct, _outputProduct);

    // and initialize the disk represenation
    writer.writeProductNodes(_outputProduct, new File(prod.getFilePath()));
    copyBandData(getBandNamesToCopy(), _inputProduct, _outputProduct, pm);
  }
Exemplo n.º 4
0
  // Scans the current request for parameters needed by the algorithm. Sets these parameters to
  // fileds of the class
  private void loadRequestParams() throws ProcessorException {
    Parameter param;

    ProcessorUtils.setProcessorLoggingHandler(
        SmacConstants.DEFAULT_LOG_PREFIX,
        getRequest(),
        getName(),
        getVersion(),
        getCopyrightInformation());

    // get aerosol optical depth
    // DELETE
    param = getRequest().getParameter(SmacConstants.AEROSOL_OPTICAL_DEPTH_PARAM_NAME);
    checkParamNotNull(param, SmacConstants.AEROSOL_OPTICAL_DEPTH_PARAM_NAME);
    _tau_aero_550 = (Float) (param.getValue());
    // DELETE

    // check for MERIS ads flag
    // DELETE
    param = getRequest().getParameter(SmacConstants.USE_MERIS_ADS_PARAM_NAME);
    checkParamNotNull(param, SmacConstants.USE_MERIS_ADS_PARAM_NAME);
    _useMerisADS = (Boolean) param.getValue();
    // DELETE

    // load the other parameters only if needed
    // ----------------------------------------
    if (!_useMerisADS) {
      // DELETE
      // water vapour content
      param = getRequest().getParameter(SmacConstants.RELATIVE_HUMIDITY_PARAM_NAME);
      checkParamNotNull(param, SmacConstants.RELATIVE_HUMIDITY_PARAM_NAME);
      _u_h2o = (Float) (param.getValue());
      // DELETE

      // DELETE
      // ozone content
      param = getRequest().getParameter(SmacConstants.OZONE_CONTENT_PARAM_NAME);
      checkParamNotNull(param, SmacConstants.OZONE_CONTENT_PARAM_NAME);
      _u_o3 = (Float) (param.getValue());
      // DELETE

      // DELETE
      // surface pressure
      param = getRequest().getParameter(SmacConstants.SURFACE_AIR_PRESSURE_PARAM_NAME);
      checkParamNotNull(param, SmacConstants.SURFACE_AIR_PRESSURE_PARAM_NAME);
      _surf_press = (Float) (param.getValue());
      // DELETE
    }

    // DELETE
    // get aerosol type
    param = getRequest().getParameter(SmacConstants.AEROSOL_TYPE_PARAM_NAME);
    checkParamNotNull(param, SmacConstants.AEROSOL_TYPE_PARAM_NAME);
    setAerosolType((String) param.getValue());
    // DELETE

    // DELETE
    // get invalid pixel value
    param = getRequest().getParameter(SmacConstants.DEFAULT_REFLECT_FOR_INVALID_PIX_PARAM_NAME);
    if (param == null) {
      _logger.warning(ProcessorConstants.LOG_MSG_NO_INVALID_PIXEL);
      _logger.warning(ProcessorConstants.LOG_MSG_USING + "0.0");
      _invalidPixel = 0.f;
    } else {
      _invalidPixel = (Float) param.getValue();
    }
    // DELETE
  }
Exemplo n.º 5
0
 /*
  * Creates an output product reference for a request.
  */
 private ProductRef createOutputProductRef() {
   final ParamGroup paramGroup = getParamGroup();
   final String fileName = paramGroup.getParameter(OUTPUT_PRODUCT_PARAM_NAME).getValueAsText();
   final String fileFormat = paramGroup.getParameter(OUTPUT_FORMAT_PARAM_NAME).getValueAsText();
   return ProcessorUtils.createProductRef(fileName, fileFormat);
 }