Class ArrayResampler

java.lang.Object
net.simplace.sim.model.FWSimComponent
net.simplace.sim.components.util.ArrayResampler
All Implemented Interfaces:
net.simplace.sim.util.FWSimFieldContainer

public class ArrayResampler extends net.simplace.sim.model.FWSimComponent
Resamples array values from one resolution to another resolution

The resolutions of original dataset and resampled datasets are determined by the arrays iOriginalDepths ($D_o$) and iResampledDepths ($D_r$) which contains the depths of the layers' bottom. The values have to be unique and sorted ascending. ($D_o(i_1) < D_o(i_2) \text{ when } i_1 < i_2$)

The array of values iOriginalValues ($V_o$) must have same length as the iOriginalDepths array. Values are resampled to the new resolution and output to the array ResampledValues ($V_r$) which has same length as iResampledDepths array.

When we denote the overlap of layer $i$ of original dataset and layer $j$ of resampled dataset by $o(i,j)$ and the thickness of layers is by $t_o(i)$ resp. $t_r(j)$, then:

\[ \begin{eqnarray} t_o(i) & = & D_o[i] - D_o[i-1] \\ t_r(j) & = & D_r[j] - D_r[j-1] \\ o(i,j) & = & max(0, \quad min(D_o[i], D_r[j]) - max(D_o[i-1], D_r[j-i]) \end{eqnarray} \]

If cIsProportional is false (the default), the values from those layers $i$, that overlap with the new layer $j$ are summed up, weighted by the proportion of the overlap to the original layer thickness:

\[ \begin{eqnarray} V_r(j) &=& \sum_{i} V_o(i) \frac{o(i,j)}{t_o(i)} \end{eqnarray} \]

If cIsProportional is true, then the values from those layers $i$, that overlap with the new layer $j$ are converted to absolute values by multiplying with the overlap $o(i,j)$, summed up and then divided by the resampled layer thickness $t_r(j)$ to get relative values:

\[ \begin{eqnarray} V_r(j) &=& \frac{\sum_{i} V_o(i) o(i,j)}{t_r(j)} \end{eqnarray} \]

Specifying resampling mode explicitely

By setting cResamplingMode one can specify explicitely which method to use. cIsProportionalValue is then ignored.

  • AVG - takes the weighted average (corresponds to cIsProportionalValue true).
  • SUM - takes the weighted sum (corresponds to cIsProportionalValue false).
  • FIRST - takes the value from the first (upper) matching layer.
  • CENTER - takes the value from the source layer matching the midpoint of the target layer.
  • LAST - takes the value from the last (lower) matching layer.
Author:
Gunther Krauss, gk@uni-bonn.de
See Also:

Component Variables

Content TypeNameDescriptionData TypeUnitMin ValueMax ValueDefault Value
constantcIsProportionalValueWhether values are relative (proportions) or absolute (amounts) values.BOOLEAN--false
constantcResamplingModeSpecifies the resampling method explicitely - one of 'SUM', 'AVG', 'FIRST', 'CENTER', 'LAST'. If not set (default), then the method 'AVG' resp. 'SUM' is used, depending on cIsProportionalValueCHAR--
inputiOriginalDepthsBottom depth of each layer of the original dataset. Values must be unique and sorted ascending.DOUBLEARRAY---
inputiOriginalValuesValues of original layersDOUBLEARRAY---
inputiResampledDepthsBottom depth of each layer of the resampled dataset. Values must be unique and sorted ascending.DOUBLEARRAY---
outResampledValuesResampled valuesDOUBLEARRAY---
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.simplace.sim.model.FWSimComponent

    net.simplace.sim.model.FWSimComponent.TEST_STATE
  • Field Summary

    Fields inherited from class net.simplace.sim.model.FWSimComponent

    iFieldMap, iFrequence, iInputMap, iJexlRule, iMasterComponentGroup, iName, iOrderNumber, isComponentGroup, iSimComponentElement, iSimModel, iVarMap
  • Constructor Summary

    Constructors
    Constructor
    Description
    Empty constructor used by class.forName()
  • Method Summary

    Modifier and Type
    Method
    Description
    protected net.simplace.sim.model.FWSimComponent
    clone(net.simplace.sim.util.FWSimVarMap aVarMap)
     
    HashMap<String,net.simplace.sim.util.FWSimVariable<?>>
    Create the FWSimVariables as interface for this SimComponent
    HashMap<String,net.simplace.sim.util.FWSimVariable<?>>
    fillTestVariables(int aParamIndex, net.simplace.sim.model.FWSimComponent.TEST_STATE aDefineOrCheck)
    called for single component test to check the components algorithm.
    protected void
    Initializes the fields by getting input and output FWSimVariables from VarMap
    protected void
    Process the algorithm and write the results back to VarMap
    protected void
     

    Methods inherited from class net.simplace.sim.model.FWSimComponent

    addVariable, bind, checkCondition, createSimComponent, createSimComponent, createSimComponent, createSimComponent, doProcess, getConstantVariables, getContentType, getCreateFormXML, getDescription, getEditFormXML, getFieldMap, getFrequence, getFrequenceRuleScript, getInputs, getInputVariables, getMasterComponentGroup, getName, getOrderNumber, getOutputVariables, getVariable, getVariableField, getVarMap, initialize, isConditionCheck, isVariableAvailable, performLinks, performLinks, readInputs, removeVariable, reset, runComponentTest, setVariablesDefault, toComponentLinkingXML, toDocXML, toGroupXML, toOutputDefinitionXML, toResourcesDataXML, toResourcesDefinitionXML, toString, toXML, writeVarInfos

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ArrayResampler

      public ArrayResampler()
      Empty constructor used by class.forName()
  • Method Details

    • createVariables

      public HashMap<String,net.simplace.sim.util.FWSimVariable<?>> createVariables()
      Create the FWSimVariables as interface for this SimComponent
      Specified by:
      createVariables in interface net.simplace.sim.util.FWSimFieldContainer
      Specified by:
      createVariables in class net.simplace.sim.model.FWSimComponent
      See Also:
      • FWSimComponent.createVariables()
    • init

      protected void init()
      Initializes the fields by getting input and output FWSimVariables from VarMap
      Specified by:
      init in class net.simplace.sim.model.FWSimComponent
      See Also:
      • FWSimComponent.init()
    • process

      protected void process()
      Process the algorithm and write the results back to VarMap
      Specified by:
      process in class net.simplace.sim.model.FWSimComponent
      See Also:
      • FWSimComponent.process()
    • resampleArrays

      protected void resampleArrays()
    • fillTestVariables

      public HashMap<String,net.simplace.sim.util.FWSimVariable<?>> fillTestVariables(int aParamIndex, net.simplace.sim.model.FWSimComponent.TEST_STATE aDefineOrCheck)
      called for single component test to check the components algorithm.
      Specified by:
      fillTestVariables in class net.simplace.sim.model.FWSimComponent
      See Also:
      • net.simplace.sim.util.FWSimFieldContainer#fillTestVariables(int aParamIndex, TEST_STATE aDefineOrCheck)
    • clone

      protected net.simplace.sim.model.FWSimComponent clone(net.simplace.sim.util.FWSimVarMap aVarMap)
      Specified by:
      clone in class net.simplace.sim.model.FWSimComponent
      See Also:
      • FWSimComponent.clone(net.simplace.sim.util.FWSimVarMap)