net.simplace.sim.transformers.SoilLayerTransformer

Distributes values of n layers of arbitrary thickness to m layers with uniform thickness.

Description

Original resolution is taken from an array that contains the depth of the lower boundary of each layer. The input depthfieldid is used to name the resource variable that contains the depth information.

To to specify the output data resolution either the layercount or the layerthickness input can be set. If layercount is given, then layerthickness is ignored, otherwise layercount is calculated by dividing the maximum soil depth by the layerthickness.

Output will be written as follows: Scalar variables like CHAR,DOUBLE,INT,... are kept as they are. Array variables (layers) like DOUBLEARRAY and INTARRAY are transformed to an array of layercount elements.

There are different modes how to determine the values of the target layer:

For numeric values (DOUBLEARRAY and INTARRAY) there are two additional methods available

Notice

If the values of a variable are amounts and not proportions, then they have to be summed up / partitioned for the new layers. Therefore one has to supply the mode attribute for the specific variable: mode="SUM". (If the source layer overlaps several target layers, then the source layer value is partitioned to the target layers, if the target layer overlaps several source layers, then the source layers are summed up for the target layer.)

Configuration

<transform id="soil_transform" interface="simpool" resource="soil"
class="net.simplace.sim.transformers.SoilLayerTransformer" >
<header>
<res id="soiltype" datatype="CHAR"  key="vSoiltype" />
<res id="depth" unit="m" datatype="DOUBLEARRAY"/>
...
<res id="drainagerate" unit="cm3*cm-3" datatype="DOUBLE"/>
...
<res id="clay" unit="g/100g" datatype="DOUBLEARRAY"/>
<res id="nitrogen" unit="g/m^2" datatype="DOUBLEARRAY" mode="SUM"/>
</header>
<input id="depthfieldid">depth</input>
<input id="layercount" />
<input id="layerthickness">0.03</input>
</transform>

The variable depth contains the depth information for the initial layers, therefore the input depthfieldid is set to depth.

Scalar values like drainagerate are not transformed, they are just passed unchanged to the transformer's output.

The variable nitrogen contains amounts (absolute values), therefore the values from overlapping layers have to be summed up / partitioned.

The resource variables to be transformed have to be all in the transformed resource soil. Only those variables mentioned in the transformer will be transformed.



See also: net.simplace.sim.components.util.helper.ArrayHelper




public class SoilLayerTransformer extends
net.simplace.sim.io.resources.FWSimResourceTransformer {
// Public Constructors
public SoilLayerTransformer(FWSimSession aSession, Element aResourceElement,
Integer aOrderNumber);
public SoilLayerTransformer(FWSimSession aSession, Integer aOrderNumber);


// Public Instance Methods
public HashMap createVariables(); // Defines
net.simplace.sim.io.FWSimIOAdapter


public FWSimResourceCache getData(FWSimVarMap aVarMap)
throws MissingSimResourceException; // Defines
net.simplace.sim.io.resources.FWSimInputAdapter


standard method from outside
public FWSimResourceCache getData(FWSimVarMap aVarMap, FWSimResourceCache
aResourceCache) throws MissingSimResourceException;

used by test cases
returns delivered new data from transformer
public FWSimResourceCache resampleSoilLayers(FWSimVariable
aThicknessOfLayers, FWSimVariable aLayerCount, FWSimVariable
aDepthFieldName, String aProjectID, FWSimResourceCache aCache)
throws MisconfiguredTransformerException;

Rescales the soil layer
returns the new created {@link FWSimResourceCache}
public void updateFields(FWObservable aObservable);
// Defines net.simplace.sim.io.resources.FWSimResourceTransformer




}



Hierarchy: java.lang.Object - net.simplace.sim.io.FWSimIOAdapter (net.simplace.sim.util.FWSimFieldContainer) - net.simplace.sim.io.resources.FWSimInputAdapter - net.simplace.sim.io.resources.FWSimResourceTransformer - SoilLayerTransformer