net.simplace.sim.components.util.helper.ArrayHelper

Methods for dealing with arrays of layers

Includes methods for resampling layers of different vertical resolution.




public class ArrayHelper {
// Public Constructors
public ArrayHelper();


// Class Methods
public static double depth(Double[] depths, int layernr);

Returns the depth of the bottom border of a layer Deals also with layernr that are out of the layers bounds. If layernr is smaller than 0 return 0, if layernr is bigger than the maximal layer number, return the depth of last layer.
returns depth of layer
public static double thickness(Double[] depths, int layernr);

Returns the thickness of a layer Deals also with layernr that are out of the layer bounds. If layernr is smaller than 0 or bigger then maximal layernr then return 0.
returns thickness of layer
public static double overlap(Double[] depths1, int layernr1, Double[]
depths2, int layernr2);

Returns the overlap of two layers from different resolutions. If the two layers do not overlap, 0 is returned.
returns thicknes of overlap of the two layers
public static Double[] resampleLayers(Double[] sourceDepths, Double[]
targetDepths, Double[] sourceValues, boolean proportional);

Resamples layer values from one resolution to another One has to specify, whether the values are amounts or proportions (e.g. water content in mm or volumetric water content in mm^3/mm^3)
returns Layer values of target resolution
public static Double[] resampleLayerAmounts(Double[] sourceDepths, Double[]
targetDepths, Double[] sourceValues);

Resamples layer values from one resolution to another by summing up Values have to be amounts (e.g. water content in mm)
returns Layer values of target resolution
public static Double[] resampleLayerProportions(Double[] sourceDepths,
Double[] targetDepths, Double[] sourceValues);

Resamples layer values from one resolution to another by averaging Values have to be proportions (e.g. water content in mm or volumetric water content in mm^3/mm^3)
returns Layer values of target resolution
public static Object[] redistributeLayersFirst(Double[] sourceDepths, Double[]
targetDepths, Object[] sourceValues, Object[] targetValues);

Resamples layer values from one resolution to another by taking the value of first overlapping layer Values have to be proportions (e.g. water content in mm or volumetric water content in mm^3/mm^3)
returns Layer values of target resolution
public static Object[] redistributeLayersLast(Double[] sourceDepths, Double[]
targetDepths, Object[] sourceValues, Object[] targetValues);

Resamples layer values from one resolution to another by taking the value of last overlapping layer Values have to be proportions (e.g. water content in mm or volumetric water content in mm^3/mm^3)
returns Layer values of target resolution
public static Object[] redistributeLayersCenter(Double[] sourceDepths,
Double[] targetDepths, Object[] sourceValues, Object[] targetValues);

Resamples layer values from one resolution to another by taking the value of the source layer hitting the center of target layer Values have to be proportions (e.g. water content in mm or volumetric water content in mm^3/mm^3)
returns Layer values of target resolution
public static Double[] resampleLayers(Double[] sourceDepths, Double[]
targetDepths, Double[] sourceValues, ArrayHelper.RESAMPLE_MODE mode);

Resamples numeric layer values from one resolution to another The target value of each layer is calculated from the overlapping source layers, depending on the mode: - AVG - average of source values weighted by the overlap proportion - SUM - sum of source values multiplied by the overlap proportion - FIRST - value of first source layer that overlaps with the target layer - LAST - value of last source layer that overlaps with the target layer - CENTER - value of the source layer that overlaps the center of the target layer
returns Layer values of target resolution
public static String[] resampleLayers(Double[] sourceDepths, Double[]
targetDepths, String[] sourceValues, ArrayHelper.RESAMPLE_MODE mode);

Resamples string layer values from one resolution to another
returns Layer values of target resolution The target value of each layer is calculated from the overlapping source layers, depending on the mode: - FIRST - value of first source layer that overlaps with the target layer - LAST - value of last source layer that overlaps with the target layer - CENTER - value of the source layer that overlaps the center of the target layer
public static double maxLayerDepth(Double[] depthOfLayers, double maxdepth);

Calculates the minimum of layer depth and a given maxdepth
returns minimum of maxdepth and depth of last layer
public static int maxLayerIndex(Double[] depthOfLayers, double maxdepth);

Calculates the array index (layernr) of the depth array that coresponds to the maxdepth
returns highest layer nr where maxdepth falls in
public static Double[] thicknessOfLayers(Double[] depthOfLayers, double
maxdepth);

Calculates the thickness of layers from given depths up to a maximum depth Thickness of layers beyond maxdepth are set to 0.
returns thickness of layers
public static Double[] thicknessOfLayers(Double[] depthOfLayers);

Calculates the thickness of layers from given depths
returns thickness of layers
public static Double[] depthOfLayers(Double[] thicknessOfLayers, double
maxdepth);

Calculates the depth of layers from thickness of each layer up to maxdepth Once maxdepth is reached, all following layer depths are set to maxdepth
returns bottom depths of layers
public static Double[] depthOfLayers(Double[] thicknessOfLayers);

Calculates depths of layer from given thickness per layer
returns bottom depths of layers
public static Double[] coverageOfLayers(Double[] depthOfLayers, double
maxdepth);

public static double sumOfLayers(Double[] layervalues, Double[]
depthOfLayers, double maxdepth);

public static double averageOfLayerProportions(Double[] layervalues, Double[]
depthOfLayers, double maxdepth);

public static double averageOfLayerMasses(Double[] layervalues, Double[]
depthOfLayers, double maxdepth);

public static Double[] averagedLayerProportions(Double[] layervalues, Double[]
depthOfLayers, double maxdepth);

public static Double[] partialAveragedLayerProportions(Double[] layervalues,
Double[] depthOfLayers, double maxdepth, double part);

public static Double[] partialAveragedLayerAmounts(Double[] layervalues,
Double[] depthOfLayers, double maxdepth, double part);



// Inner Classes
public static final class ArrayHelper.RESAMPLE_MODE extends java.lang.Enum
}