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.
- depths Bottom border depth of each layer
- layernr layer number (0 based)
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.
- depths Bottom border depth of each layer
- layernr layer number (0 based)
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.
- depths1 Bottom border depth of each layer of resolution 1
- layernr1 layer number in resolution 1
- depths2 Bottom border depth of each layer of resolution 2
- layernr2 layer number in resolution 1
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)
- sourceDepths Bottom border depth of each layer of source resolution
- targetDepths Bottom border depth of each layer of target resolution
- sourceValues Layer values of source resolution
- proportional Whether values are amounts or proportions
returns Layer values of target resolution
public static Double[]
resampleLayerAmounts(Double[] sourceDepths, Double[]
targetDepths, Double[] sourceValues);
Resamples layer values from one resolution to another
Values have to be amounts
(e.g. water content in mm)
- sourceDepths Bottom border depth of each layer of source resolution
- targetDepths Bottom border depth of each layer of target resolution
- sourceValues Layer values of source resolution
returns Layer values of target resolution
public static Double[]
resampleLayerProportions(Double[] sourceDepths,
Double[] targetDepths, Double[] sourceValues);
Resamples layer values from one resolution to another
Values have to be proportions
(e.g. water content in mm or volumetric water content in mm^3/mm^3)
- sourceDepths Bottom border depth of each layer of source resolution
- targetDepths Bottom border depth of each layer of target resolution
- sourceValues Layer values of source resolution
returns Layer values of target resolution
}