Klasse LayerAggregationTransformer
- Alle implementierten Schnittstellen:
net.simplace.sim.util.FWSimFieldContainer
It can compute the sum for absolute values (e.g. N content in g/m^2). It can compute the avg for relative values (as volumetric water content m^3/m^3).
Configuration
- method - general aggregation method (sum, avg, first, last, min, max or center)
- depthfieldname - name of the field, that contains the depth \(d_i\) (lower boundary) of each layer
- maxdepthfield - optional: name of the field, that contains the maximum depth \(m\), up to which values should be aggregated
- lowerboundary - optional: if the depth information does not contain the bottom of the layer, but the top, then the bottom of the last layer has to be specified.
Calculation details
The transformer transforms all DOUBLEARRAY entries of the original resource and outputs the resulting doubles in the same order. The aggregation method is applied to all entries, as long as they don't have a mode attribute. With the mode attribute on each variable one can specify individual aggregation methods.
The layer thickness d is calculated as \(t_0=d_0\) and \(t_i = d_{i}-d_{i-1}\) for \(i>0\). If lowerboundary is given, then the depth is shifted by one, using the lowerboundary as depth of the bottom layer. \(t_0=d_1\), \(t_i = d_{i+1}-d_{i}\) for \(n>i>0\) and \(t_n=lowerboundary - d_{n}\).
As user-specified maxdepth can be smaller than the soil profile depth, for each layer the remaining depth is calculated \(r_i = max(m-d_{i-1},0)\), which is zero if the actual layer is completely below maxdepth. If maxdepthfieldid is omitted, then all layers are aggregated.
Sum of absolute values
Values from all layers, that are above maxdepth are summed up. From the layer that contains maxdepth, only the fraction from the upper boundary to maxdepth is summed up. \[\sum_{i=0}^{n-1}V_i \frac{min(t_i,r_i)}{t_i}\]
Average of relative values
Average values over the layers that are above maxdepth are computed by multiplying relative values with layer thickness d. From the layer that contains maxdepth, only the fraction from the upper boundary to maxdepth is used as weighing factor. Then the sum is divided by maxdepth m (or the total depth, if maxdepth m exceeds the soil profile depth). \[\frac{\sum_{i=0}^{n-1}V_i min(t_i,r_i)}{min(m,d_{n-1})}\]
First, Last, Min, Max, Center
Utilisation
The transformer is used by soilwater models that need soil properties per layer as well as aggregated properties for a specific depth, that contains multiple layers, e.g. HillFlow1D
It can also be used to aggregate hourly data, given as arrays. For depth one should use the hour column. If hours run from 0 to 23, then one has to set lowerboundary to 24.
Notice
The transformer is mainly designed for layered soil properties, but can be used also for other layered data that has a kind of 'depth' information (e.g. air temperature at different heights).
It transforms all numeric arrays of the resource and outputs them in the same order as they are specified in the resource. Non-array data in the resource is omitted in the transformer (except the keys).
Each variable can be aggregated only once. If one needs different methods (e.g. min and max), then one has to use multiple instances of the transformer.
- Autor:
- Gunther Krauss, Andreas Enders
Component Variables
| Content Type | Name | Description | Data Type | Unit | Min Value | Max Value | Default Value |
|---|---|---|---|---|---|---|---|
| constant | IdField | - | CHAR | - | - | ||
| constant | depthfieldid | Name of the field (column) in the original resource that contains depth values. | CHAR | - | - | ||
| constant | lowerboundary | - | DOUBLE | 0.0 | - | - | |
| constant | maxdepthfieldid | Name of the field (column) in the original resource that contains the value for the maximal depth that should be used for aggregation | CHAR | - | - | ||
| constant | method | - | CHAR | - | - | sum |
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.FWSimIOAdapter.FREQUENCE -
Feldübersicht
Von Klasse geerbte Felder net.simplace.sim.io.resources.FWSimResourceTransformer
iFieldMap, iIntColumnMap, iLastInputValuesMap, iLastProjectID, iLastUniqueID, iPoolName, iSourceNameVon Klasse geerbte Felder net.simplace.sim.io.resources.FWSimInputAdapter
iJexlScript, iShouldCacheToDBVon Klasse geerbte Felder net.simplace.sim.io.FWSimIOAdapter
iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungused for ClassForNameLayerAggregationTransformer(net.simplace.sim.FWSimSession aSession, Integer aOrderNumber) LayerAggregationTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungnet.simplace.sim.io.resources.FWSimResourceCachecalculateAggregatedData(net.simplace.sim.util.FWSimVariable<String> aDepthField, net.simplace.sim.util.FWSimVariable<String> aMaxdepthField, net.simplace.sim.util.FWSimVariable<String> aMethod, String aProjectID, net.simplace.sim.io.resources.FWSimResourceCache aCache) net.simplace.sim.io.resources.FWSimResourceCachegetData(net.simplace.sim.util.FWSimVarMap aVarMap) standard method from outsidenet.simplace.sim.io.resources.FWSimResourceCachegetData(net.simplace.sim.util.FWSimVarMap aVarMap, net.simplace.sim.io.resources.FWSimResourceCache aResourceCache) used by test casesprotected Object[]MergeKeysAndValues(int aKeyFieldCount, Object aKeys, Object[] aValues) voidupdateFields(net.simplace.core.FWObservable aObservable) Von Klasse geerbte Methoden net.simplace.sim.io.resources.FWSimResourceTransformer
addVariable, createFormFields, createResourceTransformer, createResourceTransformer, createResourceTransformer, createSimTransformer, fillVarMap, getCreateFormXML, getEditFormXML, getSourceResourceCache, getVariable, isUpdated, toDocXML, toXMLVon Klasse geerbte Methoden net.simplace.sim.io.resources.FWSimInputAdapter
getContentType, getInputVariables, getJexlScript, getOutputVariables, getVarMap, isTransformer, shouldCacheToDB, toHTMLTablestringVon Klasse geerbte Methoden net.simplace.sim.io.FWSimIOAdapter
addProcessTime, checkCondition, createFormFields, finalize, getFieldMap, getFrequence, getHeaderVariables, getHeaderXML, getInterface, getJexlRule, getKeyMap, getName, getOrderNumber, isArrayMode, isConditionCheck, removeVariable, setInterface, setOrderNumber, toString, writeHeaderList
-
Konstruktordetails
-
LayerAggregationTransformer
public LayerAggregationTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber) - Parameter:
aSession-aResourceElement-aOrderNumber-
-
LayerAggregationTransformer
- Parameter:
aSession-aOrderNumber-
-
LayerAggregationTransformer
public LayerAggregationTransformer()used for ClassForName
-
-
Methodendetails
-
createVariables
- Angegeben von:
createVariablesin Schnittstellenet.simplace.sim.util.FWSimFieldContainer- Setzt außer Kraft:
createVariablesin Klassenet.simplace.sim.io.FWSimIOAdapter
-
getData
public net.simplace.sim.io.resources.FWSimResourceCache getData(net.simplace.sim.util.FWSimVarMap aVarMap) throws net.simplace.sim.exceptions.MissingSimResourceException standard method from outside- Angegeben von:
getDatain Klassenet.simplace.sim.io.resources.FWSimInputAdapter- Löst aus:
net.simplace.sim.exceptions.MissingSimResourceException- Siehe auch:
-
getData
public net.simplace.sim.io.resources.FWSimResourceCache getData(net.simplace.sim.util.FWSimVarMap aVarMap, net.simplace.sim.io.resources.FWSimResourceCache aResourceCache) throws net.simplace.sim.exceptions.MissingSimResourceException used by test cases- Parameter:
aVarMap- variable mapaResourceCache- Cached resources (soil data)- Gibt zurück:
- delivered new data from transformer
- Löst aus:
net.simplace.sim.exceptions.MissingSimResourceException
-
calculateAggregatedData
public net.simplace.sim.io.resources.FWSimResourceCache calculateAggregatedData(net.simplace.sim.util.FWSimVariable<String> aDepthField, net.simplace.sim.util.FWSimVariable<String> aMaxdepthField, net.simplace.sim.util.FWSimVariable<String> aMethod, String aProjectID, net.simplace.sim.io.resources.FWSimResourceCache aCache) throws net.simplace.sim.exceptions.MissingSimResourceException - Parameter:
aDepthField-aMaxdepthField-aMethod-aProjectID-aCache-- Gibt zurück:
- the transformed resource cache
- Löst aus:
net.simplace.sim.exceptions.MissingSimResourceException
-
updateFields
public void updateFields(net.simplace.core.FWObservable aObservable) - Angegeben von:
updateFieldsin Klassenet.simplace.sim.io.resources.FWSimResourceTransformer- Siehe auch:
-
MergeKeysAndValues
- Parameter:
aKeyFieldCount-aKeys-aValues-- Gibt zurück:
-