示例#1
0
  /** Loads the bitmask expression for an AATSR product from the request */
  private void loadAatsrBitmaskExpression() {
    Request request = getRequest();
    Parameter paramNadir = request.getParameter(SmacConstants.BITMASK_NADIR_PARAM_NAME);
    if (paramNadir != null) {
      _bitMaskExpression = paramNadir.getValueAsText();
    } else {
      _bitMaskExpression = "";
    }

    Parameter paramForward = request.getParameter(SmacConstants.BITMASK_FORWARD_PARAM_NAME);
    if (paramForward != null) {
      _bitMaskExpressionForward = paramForward.getValueAsText();
    } else {
      _bitMaskExpressionForward = "";
    }
  }
示例#2
0
  private void updateLogParameter(final Request request) {
    Parameter param;
    Parameter toUpdate;

    param = request.getParameter(LOG_PREFIX_PARAM_NAME);
    final ParamGroup paramGroup = getParamGroup();
    if (param != null) {
      toUpdate = paramGroup.getParameter(LOG_PREFIX_PARAM_NAME);
      toUpdate.setValue(param.getValue(), null);
    }

    param = request.getParameter(LOG_TO_OUTPUT_PARAM_NAME);
    if (param != null) {
      toUpdate = paramGroup.getParameter(LOG_TO_OUTPUT_PARAM_NAME);
      toUpdate.setValue(param.getValue(), null);
    }
  }
示例#3
0
  // Creates the appropriate <code>Product</code> for the current request and assembles a list of
  // <code>RsBands</code>
  // to be processed. This method does NOT load the tie point ADS because these are product
  // specific.
  private void loadInputProduct() throws IOException, ProcessorException {
    Request request = getRequest();
    Band band;
    Parameter bandParam;
    String[] bandNames;

    // clear vector of bands
    // ---------------------
    _inputBandList.clear();

    // only the first product - there might be more but these will be ignored
    // ----------------------------------------------------------------------
    _inputProduct = loadInputProduct(0);

    // check what product type the input is and load the appropriate tie point ADS
    // ---------------------------------------------------------------------------
    _sensorType = SmacUtils.getSensorType(_inputProduct.getProductType());
    if (ObjectUtils.equalObjects(_sensorType, SensorCoefficientManager.MERIS_NAME)) {
      loadMerisBitmaskExpression();
      loadMERIS_ADS(_inputProduct);
    } else if (ObjectUtils.equalObjects(_sensorType, SensorCoefficientManager.AATSR_NAME)) {
      loadAatsrBitmaskExpression();
      loadAATSR_ADS(_inputProduct);
      _useMerisADS = false; // then we must set this to false anyway
    } else {
      throw new ProcessorException(SmacConstants.LOG_MSG_UNSUPPORTED_SENSOR);
    }

    // set up the bands we need for this request
    // -----------------------------------------
    bandParam = request.getParameter(SmacConstants.BANDS_PARAM_NAME);
    checkParamNotNull(bandParam, "bands");
    bandNames = (String[]) bandParam.getValue();

    if ((bandNames == null) || (bandNames.length < 1)) {
      throw new ProcessorException(SmacConstants.LOG_MSG_NO_INPUT_BANDS);
    }

    for (String bandName : bandNames) {
      band = _inputProduct.getBand(bandName);
      if (band == null) {
        _logger.warning(
            "The requested band '" + bandName + "' is not contained in the input product!");
      } else {
        if (band.getSpectralBandIndex() != -1) {
          _inputBandList.add(band);
        } else {
          _logger.warning(
              "The requested band '"
                  + bandName
                  + "' is not a spectral band! It is excluded from processing");
        }
      }
    }
  }
示例#4
0
 private void updateParamOutputFormat(final Request request) {
   final Parameter parameter = request.getParameter(OUTPUT_FORMAT_PARAM_NAME);
   if (parameter != null) {
     final String format = parameter.getValueAsText();
     final ProductIOPlugInManager instance = ProductIOPlugInManager.getInstance();
     final String[] allowedformats = instance.getAllProductWriterFormatStrings();
     if (ArrayUtils.isMemberOf(format, allowedformats)) {
       getParamGroup().getParameter(OUTPUT_FORMAT_PARAM_NAME).setValue(format, null);
     }
   }
 }