@Override public boolean processAlgorithm() throws GeoAlgorithmExecutionException { m_LowerGrid = m_Parameters.getParameterValueAsRasterLayer(LGRID); m_UpperGrid = m_Parameters.getParameterValueAsRasterLayer(UGRID); m_LowerGrid.setWindowExtent(m_AnalysisExtent); m_UpperGrid.setWindowExtent(m_AnalysisExtent); m_iNX = m_LowerGrid.getNX(); m_iNY = m_LowerGrid.getNY(); return calculateVolumes(); }
@Override public boolean processAlgorithm() throws GeoAlgorithmExecutionException { int x, y; int iN; int iNX, iNY; double dValue; double dProb; boolean bCDF; final IRasterLayer layer = m_Parameters.getParameterValueAsRasterLayer(INPUT); bCDF = m_Parameters.getParameterValueAsBoolean(CDF); dProb = m_Parameters.getParameterValueAsDouble(P); iN = m_Parameters.getParameterValueAsInt(N); layer.setFullExtent(); final AnalysisExtent gridExtent = new AnalysisExtent(layer); final IRasterLayer result = getNewRasterLayer( PROBABILITY, Sextante.getText("Probability__binomial"), IRasterLayer.RASTER_DATA_TYPE_DOUBLE, gridExtent); iNX = layer.getNX(); iNY = layer.getNY(); for (y = 0; y < iNY && setProgress(y, iNY); y++) { for (x = 0; x < iNX; x++) { dValue = layer.getCellValueAsDouble(x, y); if (!layer.isNoDataValue(dValue)) { if (bCDF) { result.setCellValue(x, y, PDF.binomialCDF(dProb, iN, (int) dValue)); } else { result.setCellValue(x, y, PDF.binomial(dProb, iN, (int) dValue)); } } else { result.setNoData(x, y); } } } return !m_Task.isCanceled(); }
@Override public boolean processAlgorithm() throws GeoAlgorithmExecutionException { int x, y; int iNX, iNY; double dValue; double dMean, dStdDev; boolean bCDF; final IRasterLayer window = m_Parameters.getParameterValueAsRasterLayer(INPUT); bCDF = m_Parameters.getParameterValueAsBoolean(CDF); dMean = m_Parameters.getParameterValueAsDouble(MEAN); dStdDev = m_Parameters.getParameterValueAsDouble(STDDEV); window.setFullExtent(); final AnalysisExtent gridExtent = new AnalysisExtent(window); final IRasterLayer result = getNewRasterLayer( PROBABILITY, Sextante.getText("Probability__exponential"), IRasterLayer.RASTER_DATA_TYPE_DOUBLE, gridExtent); iNX = window.getNX(); iNY = window.getNY(); for (y = 0; y < iNY && setProgress(y, iNY); y++) { for (x = 0; x < iNX; x++) { dValue = window.getCellValueAsDouble(x, y); if (!window.isNoDataValue(dValue)) { if (bCDF) { result.setCellValue(x, y, PDF.exponentialCDF(dMean, dStdDev, dValue)); } else { result.setCellValue(x, y, PDF.exponential(dMean, dStdDev, dValue)); } } else { result.setNoData(x, y); } } } return !m_Task.isCanceled(); }