Package ucar.unidata.data.grid
Class GridMath
java.lang.Object
ucar.unidata.data.grid.GridMath
A class to handle grid math. This handles math between grids on
different manifolds where possible.
- Author:
- IDV Development Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
axis identifier - Xstatic final String
axis identifier - Ystatic final String
function for the applyFunctionOverTime routinestatic final String
function for the timeStepFunc routinestatic final String
static final String
function for the applyFunctionOverTime routinestatic final String
function for the applyFunctionOverTime routinestatic final String
function for the applyFunctionOverTime routinestatic final String
function for the applyFunctionOverTime 10 base pow routinestatic final String
function for the applyFunctionOverTime routinestatic final String
function for the applyFunctionOverTime routinestatic final String
function for the applyFunctionOverTime routinestatic final String
function for the applyFunctionOverTime routinestatic final String
function for the applyFunctionOverTime routinestatic final Real
negative onestatic final int
cyclic optionstatic final int
missing optionstatic final int
symmetric optionstatic final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FieldImpl
Add two grids togetherstatic FieldImpl
Add two grids togetherstatic FieldImpl
static FieldImpl
applyFunctionOverGrid2D
(FieldImpl grid, String function, String statThreshold) Apply the function to the 2D grid.static FieldImpl
applyFunctionOverGrid2D
(FieldImpl grid, String function, FieldImpl grid1, String function1, float percentile) Evaluate the function of the grid and the function1 to the grid1.static FlatField
applyFunctionOverGrids
(FlatField[] grids, String function) Apply the function to the grids.static FlatField
applyFunctionOverGrids0
(FlatField[] grids, String function) static FieldImpl
applyFunctionOverGridsExt
(FieldImpl field, String function) static FieldImpl
applyFunctionOverLevels
(FieldImpl grid, String function) Apply the function to the time steps of the given grid over the levels.static FieldImpl
applyFunctionOverMembers
(FieldImpl grid, float statThreshold, float exptdLoBound, float exptdUpBound, String function) Apply the function to the ens members of the given grid.static FieldImpl
applyFunctionOverMembers
(FieldImpl grid, String function) Apply the function to the ens members of the given grid.static FieldImpl
applyFunctionOverMembers
(FieldImpl grid, String statThreshold, String exptdLoBoundIn, String exptdUpBoundIn, String function) Apply the function to the ens members of the given grid.static FieldImpl
applyFunctionOverTime
(FieldImpl grid, String function, boolean makeTimes) Apply the function to the time steps of the given grid.static FieldImpl
applyFunctionOverTime
(FieldImpl grid, String function, int startIdx, int idxStride, boolean makeTimes) Apply the function to the time steps of the given grid.static FieldImpl
applyFunctionToAxis
(FieldImpl grid, String function, String axis) Apply the function to the x or y of the given grid at each level.static FieldImpl
applyFunctionToLevels
(FieldImpl grid, String function) Apply the function to the time steps of the given grid at each level.static FieldImpl
Take the arctangent of two gridsstatic FieldImpl
Take the arctangent of two gridsstatic FieldImpl
averageOverMembers
(FieldImpl grid) Average the grid over memberstatic FieldImpl
averageOverTime
(FieldImpl grid, boolean makeTimes) Average the grid at each point over timestatic FieldImpl
calculateHelicity
(FieldImpl gridu, FieldImpl gridv, float bottom, float top, float ux, float vy) Calculate Helicity to the time steps of the given grid at each level.static float
calculateL1Norm
(float[] vector) static float
calculateL2Norm
(float[] vector) static FieldImpl
Take the partial derivative with respect to X of the given field.static FieldImpl
Take the partial derivative with respect to Y of the given field.static FieldImpl
This creates a field where D(T) = D(T)-D(0) Any time steps up to the offset time are set to missingstatic FieldImpl
Divide two gridsstatic FieldImpl
Divide two gridsstatic FieldImpl
ensemble grid max valuesstatic FieldImpl
ensemble grid min valuesstatic FieldImpl
ensembleModeValues
(FieldImpl grid) ensemble grid min valuesstatic FieldImpl
ensemblePercentileValues
(FieldImpl grid, int percent) ensemble grid min valuesstatic FieldImpl
ensemblePercentileValues
(FieldImpl grid, String percent) ensemble grid min valuesstatic FieldImpl
ensembleRangeValues
(FieldImpl grid) ensemble grid range valuesstatic FieldImpl
ensemble Standard Deviationstatic FieldImpl
ensembleUProbabilityValues
(FieldImpl grid, String logicalOp, float pValue, float exptdLoBound, float exptdUpBound) ensemble grid univariate probabilitystatic FieldImpl
ensembleUProbabilityValues
(FieldImpl grid, String logicalOp, String pValue, String exptdLoBound, String exptdUpBound) ensemble grid univariate probabilitystatic float
evaluateMode
(float[] data) evaluate mode valuestatic float
evaluatePercentile
(float[][] values, double p) static float
evaluatePercentile
(float[] values, double p) static float
evaluatePercentile
(float[] values, int begin, int length, double p) evaluate percentile valuestatic float
evaluateUProbability
(float[] values, float pValue, int length) evaluate univariate probability of "variable with n ensemble values" smaller than pValue code from $NAWIPS/gempak/source/diaglib/de/decprb.c used to make this function.static FieldImpl
maxOverTime
(FieldImpl grid, boolean makeTimes) Take the max value at each grid pointstatic FieldImpl
minOverTime
(FieldImpl grid, boolean makeTimes) Take the min value at each grid pointstatic FieldImpl
Multiply two gridsstatic FieldImpl
Multiply two gridsstatic FieldImpl
static FieldImpl
Take the partial derivative with respect variable at the domain index.static FlatField
powerTransformerFF
(FlatField grid, double lambda) static FlatField
powerTransformerFF
(FlatField grid, String lambda) static FlatField
static float[]
removeNaNFromArray
(float[] inputArray) static FieldImpl
replaceNegativeValue
(FieldImpl grid, float newValue) static FieldImpl
replacePositiveValue
(FieldImpl grid, float newValue) static FlatField
robustScalerFF
(FlatField grid) static FieldImpl
standardDeviationOverTime
(FieldImpl grid, boolean makeTimes) Compute the standard deviation of the grid at each point over timestatic edu.wisc.ssec.mcidasv.data.hydra.Statistics
statisticsFF
(FlatField grid) static FieldImpl
Subtract two gridsstatic FieldImpl
Subtract two gridsstatic FieldImpl
subtractExt
(FieldImpl grid, FieldImpl grid2d) substractExt subtract a grid2d from each level of the 3d gridstatic FieldImpl
sumFromBaseTime
(FieldImpl grid) This creates a field where D(T) = D(0)+D(1)+...+D(T-1)+D(T)static FieldImpl
sumOverTime
(FieldImpl grid, boolean makeTimes) Sum each grid pointstatic FieldImpl
timeRunningAverage
(FieldImpl grid, int nave, int opt) Create a running average across the time dimension.static FieldImpl
timeRunningAverage
(FieldImpl grid, int nave, int opt, boolean skipMissing) Create a running average across the time dimension.static FieldImpl
timeStepDifference
(FieldImpl grid, int offset) This creates a field where D(T) = D(T)-D(T+offset) Any time steps up to the offset time are set to missingstatic FieldImpl
timeStepFunc
(FieldImpl grid, int offset, String func) This creates a field where is either D(T) = D(T)-D(T+offset) or D(T) = D(T)+D(T+offset) depending on the value of the func argument Any time steps up to the offset time are set to missing.static FieldImpl
timeStepSum
(FieldImpl grid, int offset) This creates a field where D(T) = D(T)+D(T+offset) Any time steps up to the offset time are set to missingstatic FieldImpl
timeWeightedRunningAverage
(FieldImpl grid, float[] wgts, int opt) Create a running average across the time dimension.static FieldImpl
timeWeightedRunningAverage
(FieldImpl grid, float[] wgts, int opt, boolean skipMissing) Create a running average across the time dimension.static float[]
twoDConvert
(float[][] nums)
-
Field Details
-
FUNC_AVERAGE
function for the applyFunctionOverTime routine- See Also:
-
FUNC_STDEV
function for the applyFunctionOverTime routine- See Also:
-
FUNC_PRCNTL
function for the applyFunctionOverTime routine- See Also:
-
PRCNTL
- See Also:
-
FUNC_UPROB
function for the applyFunctionOverTime routine- See Also:
-
FUNC_SUM
function for the applyFunctionOverTime routine- See Also:
-
FUNC_MAX
function for the applyFunctionOverTime routine- See Also:
-
FUNC_MIN
function for the applyFunctionOverTime routine- See Also:
-
FUNC_RNG
function for the applyFunctionOverTime routine- See Also:
-
FUNC_MODE
function for the applyFunctionOverTime routine- See Also:
-
FUNC_EXP
- See Also:
-
FUNC_POW
function for the applyFunctionOverTime 10 base pow routine- See Also:
-
FUNC_DIFFERENCE
function for the timeStepFunc routine- See Also:
-
OPT_CYCLIC
public static final int OPT_CYCLICcyclic option- See Also:
-
OPT_MISSING
public static final int OPT_MISSINGmissing option- See Also:
-
OPT_SYMMETRIC
public static final int OPT_SYMMETRICsymmetric option- See Also:
-
AXIS_X
axis identifier - X- See Also:
-
AXIS_Y
axis identifier - Y- See Also:
-
NEGATIVE_ONE
negative one
-
-
Constructor Details
-
GridMath
public GridMath()
-
-
Method Details
-
add
Add two grids together- Parameters:
grid1
- first gridgrid2
- second grid- Returns:
- the sum of the grids
- Throws:
VisADException
- problem doing the math
-
add
Add two grids together- Parameters:
grid1
- first gridgrid2
- second griduseWA
- use WEIGHTED_AVERAGE for resampling- Returns:
- the sum of the grids
- Throws:
VisADException
- problem doing the math
-
subtract
Subtract two grids- Parameters:
grid1
- first gridgrid2
- second grid- Returns:
- the difference of the grids
- Throws:
VisADException
- problem doing the math
-
subtract
public static FieldImpl subtract(FieldImpl grid1, FieldImpl grid2, boolean useWA) throws VisADException Subtract two grids- Parameters:
grid1
- first gridgrid2
- second griduseWA
- true to use weighted average- Returns:
- the difference of the grids
- Throws:
VisADException
- problem doing the math
-
multiply
Multiply two grids- Parameters:
grid1
- first gridgrid2
- second grid- Returns:
- the product of the grids
- Throws:
VisADException
- problem doing the math
-
multiply
public static FieldImpl multiply(FieldImpl grid1, FieldImpl grid2, boolean useWA) throws VisADException Multiply two grids- Parameters:
grid1
- first gridgrid2
- second griduseWA
- true to use WEIGHTED_AVERAGE- Returns:
- the product of the grids
- Throws:
VisADException
- problem doing the math
-
divide
Divide two grids- Parameters:
grid1
- first gridgrid2
- second grid- Returns:
- the quotient of the grids
- Throws:
VisADException
- problem doing the math
-
divide
public static FieldImpl divide(FieldImpl grid1, FieldImpl grid2, boolean useWA) throws VisADException Divide two grids- Parameters:
grid1
- first gridgrid2
- second griduseWA
- true to use WEIGHTED_AVERAGE- Returns:
- the quotient of the grids
- Throws:
VisADException
- problem doing the math
-
atan2
Take the arctangent of two grids- Parameters:
grid1
- first gridgrid2
- second grid- Returns:
- the arctangent of the grids
- Throws:
VisADException
- problem doing the math
-
atan2
public static FieldImpl atan2(FieldImpl grid1, FieldImpl grid2, boolean useWA) throws VisADException Take the arctangent of two grids- Parameters:
grid1
- first gridgrid2
- second griduseWA
- true to use WEIGHTED_AVERAGE- Returns:
- the arctangent of the grids
- Throws:
VisADException
- problem doing the math
-
averageOverTime
Average the grid at each point over time- Parameters:
grid
- grid to averagemakeTimes
- If true then make a time field with the range being the same computed value If false then just return a single field of the computed values- Returns:
- the new field
- Throws:
VisADException
- On badness
-
standardDeviationOverTime
public static FieldImpl standardDeviationOverTime(FieldImpl grid, boolean makeTimes) throws VisADException Compute the standard deviation of the grid at each point over time- Parameters:
grid
- grid to compute stdmakeTimes
- If true then make a time field with the range being the same computed value If false then just return a single field of the computed values- Returns:
- the new field
- Throws:
VisADException
- On badness
-
averageOverMembers
Average the grid over member- Parameters:
grid
- ensemble grid to average- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensembleStandardDeviation
ensemble Standard Deviation- Parameters:
grid
- ensemble grid- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensembleLowestValues
ensemble grid min values- Parameters:
grid
- ensemble grid- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensembleHighestValues
ensemble grid max values- Parameters:
grid
- ensemble grid- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensembleRangeValues
ensemble grid range values- Parameters:
grid
- ensemble grid- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensemblePercentileValues
public static FieldImpl ensemblePercentileValues(FieldImpl grid, String percent) throws VisADException ensemble grid min values- Parameters:
grid
- ensemble gridpercent
- the percent- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensemblePercentileValues
ensemble grid min values- Parameters:
grid
- ensemble gridpercent
- the percent- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensembleUProbabilityValues
public static FieldImpl ensembleUProbabilityValues(FieldImpl grid, String logicalOp, float pValue, float exptdLoBound, float exptdUpBound) throws VisADException ensemble grid univariate probability- Parameters:
grid
- ensemble gridlogicalOp
- gt or lt for P(X > | invalid input: '<' pValue)pValue
- probability threshold value P(valueAtGridPoint invalid input: '<' pValue)exptdLoBound
- expected lo boundexptdUpBound
- expected hi bound- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensembleUProbabilityValues
public static FieldImpl ensembleUProbabilityValues(FieldImpl grid, String logicalOp, String pValue, String exptdLoBound, String exptdUpBound) throws VisADException ensemble grid univariate probability- Parameters:
grid
- ensemble gridlogicalOp
- gt or lt for P(X > | invalid input: '<' pValue)pValue
- probability threshold value P(valueAtGridPoint invalid input: '<' pValue)exptdLoBound
- expected lo boundexptdUpBound
- expected hi bound- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ensembleModeValues
ensemble grid min values- Parameters:
grid
- ensemble grid- Returns:
- the new field
- Throws:
VisADException
- On badness
-
timeStepDifference
This creates a field where D(T) = D(T)-D(T+offset) Any time steps up to the offset time are set to missing- Parameters:
grid
- grid to averageoffset
- time step offset. e.g., offset=-1 results in D(T)=D(T)-D(T-1)- Returns:
- the new field
- Throws:
VisADException
- On badness
-
timeStepSum
This creates a field where D(T) = D(T)+D(T+offset) Any time steps up to the offset time are set to missing- Parameters:
grid
- grid to averageoffset
- time step offset. e.g., offset=-1 results in D(T)=D(T)+D(T-1)- Returns:
- the new field
- Throws:
VisADException
- On badness
-
differenceFromBaseTime
This creates a field where D(T) = D(T)-D(0) Any time steps up to the offset time are set to missing- Parameters:
grid
- grid to average- Returns:
- the new field
- Throws:
VisADException
- On badness
-
sumFromBaseTime
This creates a field where D(T) = D(0)+D(1)+...+D(T-1)+D(T)- Parameters:
grid
- grid to sum- Returns:
- the new field
- Throws:
VisADException
- On badness
-
timeStepFunc
This creates a field where is either D(T) = D(T)-D(T+offset) or D(T) = D(T)+D(T+offset) depending on the value of the func argument Any time steps up to the offset time are set to missing. If offset == 0 then we use D(0) as the fixed operand foreach operator, e.g.: D(T) = D(T) - D(0)- Parameters:
grid
- grid to averageoffset
- time step offset.func
- which function to apply, SUM or DIFFERENCE- Returns:
- the new field
- Throws:
VisADException
- On badness
-
timeWeightedRunningAverage
public static FieldImpl timeWeightedRunningAverage(FieldImpl grid, float[] wgts, int opt) throws VisADException Create a running average across the time dimension.- Parameters:
grid
- grid to averagewgts
- weights per step (usually odd and add to 1)opt
- options for end pointsN = {last point in the series} xi = {input series} xo = {output series} nwgt = {number of wgts} opt invalid input: '<' 0 : utilize cyclic conditions e.g., nwgt = 2 xo(0) = w(0) * xi(0) + w(1) * xi(1) xo(N) = w(0) * xi(N) + w(1) * xi(0) e.g., nwgt = 3 xo(0) = w(0) * xi(N) + w(1) * xi(0) + w(2) * xi(1) xo(N) = w(0) * xi(N - 1) + w(1) * xi(N) + w(2) * xi(0) e.g., nwgt = 4 xo(0) = w(0) * xi(N) + w(1) * xi(0) + w(2) * xi(1) + w(3) * xi(2) xo(N) = w(0) * xi(N - 1) + w(1) * xi(N) + w(2) * xi(1) + w(3) * xi(2) opt = 0 : set unsmoothed beginning and end pts to x@_FillValue (most common) e.g., nwgt = 2 xo(0) = w(0) * xi(0) + w(1) * xi(1) xo(N) = xi@_FillValue e.g., nwgt = 3 xo(0) = xi@_FillValue xo(1) = w(0) * xi(0) + w(1) * xi(1) + w(2) * xi(2) xi(N) = xi@_FillValue e.g., nwgt = 4 xo(0) = xi@_FillValue xo(1) = w(0) * xi(0) + w(1) * xi(1) + w(2) * xi(2) + w(3) * xi(3) xo(N - 2) = w(0) * xi(N - 3) + w(1) * xi(N - 2) + w(2) * xi(N - 1) + w(3) * xi(N) xo(N - 1) = xi@_FillValue xo(N) = xi@_FillValue opt > 0 : utilize reflective (symmetric) conditions e.g., nwgt = 2 xo(0) = w(0) * xi(0) + w(1) * xi(1) xo(N) = w(0) * xi(N) + w(0) * xi(0) e.g., nwgt = 3 xo(0) = w(0) * xi(1) + w(1) * xi(0) + w(2) * xi(1) xo(N) = w(0) * xi(N - 1) + w(1) * xi(N) + w(2) * xi(N - 1) e.g., nwgt = 4 xo(0) = w(0) * xi(1) + w(1) * xi(0) + w(2) * xi(1) + w(3) * xi(2) xo(N) = w(0) * xi(N - 1) + w(1) * xi(N) + w(2) * xi(0) + w(3) * xi(2)
- Returns:
- the new field
- Throws:
VisADException
- On badness
-
timeWeightedRunningAverage
public static FieldImpl timeWeightedRunningAverage(FieldImpl grid, float[] wgts, int opt, boolean skipMissing) throws VisADException Create a running average across the time dimension.- Parameters:
grid
- grid to averagewgts
- weights per step (usually odd and add to 1)opt
- options for end pointsN = {last point in the series} xi = {input series} xo = {output series} nwgt = {number of wgts} opt invalid input: '<' 0 : utilize cyclic conditions e.g., nwgt = 2 xo(0) = w(0) * xi(0) + w(1) * xi(1) xo(N) = w(0) * xi(N) + w(1) * xi(0) e.g., nwgt = 3 xo(0) = w(0) * xi(N) + w(1) * xi(0) + w(2) * xi(1) xo(N) = w(0) * xi(N - 1) + w(1) * xi(N) + w(2) * xi(0) e.g., nwgt = 4 xo(0) = w(0) * xi(N) + w(1) * xi(0) + w(2) * xi(1) + w(3) * xi(2) xo(N) = w(0) * xi(N - 1) + w(1) * xi(N) + w(2) * xi(1) + w(3) * xi(2) opt = 0 : set unsmoothed beginning and end pts to x@_FillValue (most common) e.g., nwgt = 2 xo(0) = w(0) * xi(0) + w(1) * xi(1) xo(N) = xi@_FillValue e.g., nwgt = 3 xo(0) = xi@_FillValue xo(1) = w(0) * xi(0) + w(1) * xi(1) + w(2) * xi(2) xi(N) = xi@_FillValue e.g., nwgt = 4 xo(0) = xi@_FillValue xo(1) = w(0) * xi(0) + w(1) * xi(1) + w(2) * xi(2) + w(3) * xi(3) xo(N - 2) = w(0) * xi(N - 3) + w(1) * xi(N - 2) + w(2) * xi(N - 1) + w(3) * xi(N) xo(N - 1) = xi@_FillValue xo(N) = xi@_FillValue opt > 0 : utilize reflective (symmetric) conditions e.g., nwgt = 2 xo(0) = w(0) * xi(0) + w(1) * xi(1) xo(N) = w(0) * xi(N) + w(0) * xi(0) e.g., nwgt = 3 xo(0) = w(0) * xi(1) + w(1) * xi(0) + w(2) * xi(1) xo(N) = w(0) * xi(N - 1) + w(1) * xi(N) + w(2) * xi(N - 1) e.g., nwgt = 4 xo(0) = w(0) * xi(1) + w(1) * xi(0) + w(2) * xi(1) + w(3) * xi(2) xo(N) = w(0) * xi(N - 1) + w(1) * xi(N) + w(2) * xi(0) + w(3) * xi(2)
skipMissing
- if true, missing timesteps will not be included in the average and the average will be done on the non-missing times- Returns:
- the new field
- Throws:
VisADException
- On badness
-
timeRunningAverage
Create a running average across the time dimension.- Parameters:
grid
- grid to averagenave
- number of steps to averageopt
- options for end pointsIn the following: N = {last point in the series, i.e. N = npts - 1} xi = {input series} xo = {output series} opt invalid input: '<' 0 : utilize cyclic conditions e.g., nave = 2 xo(0) = (xi(0) + xi(1))/nave xo(N) = (xi(N) + xi(0))/nave e.g., nave = 3 xo(0) = (xi(N) + xi(0) + xi(1)) / nave xo(N) = (xi(N - 1) + xi(N) + xi(0)) / nave e.g., nave = 4 xo(0) = (xi(N) + xi(0) + xi(1) + xi(2)) / nave xo(N) = (xi(N - 1) + xi(N) + xi(0) + xi(1)) / nave opt = 0 : set unsmoothed beginning and end pts to x@_FillValue [most common] e.g., nave = 2 xo(0) = (xi(0) + xi(1)) / nave xo(N) = xi@_FillValue e.g., nave = 3 xo(0) = xi@_FillValue xo(1) = (xi(0) + xi(1) + xi(2)) / nave xi(N) = xi@_FillValue e.g., nave = 4 xo(0) = xi@_FillValue xo(1) = (xi(0) + xi(1) + xi(2) + xi(3)) / nave xo(N - 2) = (xi(N - 3) + xi(N - 2) + xi(N - 1) + xi(N)) / nave xo(N - 1)= xi@_FillValue xo(N)= xi@_FillValue opt > 0 : utilize reflective (symmetric) conditions e.g., nave = 2 xo(0) = (xi(0) + xi(1)) / nave xo(N) = (xi(N) + xi(N-1)) / nave e.g., nave = 3 xo(0) = (xi(1) + xi(0) + xi(1)) / nave xo(N) = (xi(N - 1) + xi(N) + xi(N-1)) / nave e.g., nave = 4 xo(0) = (xi(2) + xi(1) + xi(0) + xi(1)) / nave xo(N) = (xi(N - 1) + xi(N) + xi(N - 1) + xi(N - 2)) / nave
- Returns:
- the new field
- Throws:
VisADException
- On badness
-
timeRunningAverage
public static FieldImpl timeRunningAverage(FieldImpl grid, int nave, int opt, boolean skipMissing) throws VisADException Create a running average across the time dimension.- Parameters:
grid
- grid to averagenave
- number of steps to averageopt
- options for end pointsIn the following: N = {last point in the series, i.e. N = npts - 1} xi = {input series} xo = {output series} opt invalid input: '<' 0 : utilize cyclic conditions e.g., nave = 2 xo(0) = (xi(0) + xi(1))/nave xo(N) = (xi(N) + xi(0))/nave e.g., nave = 3 xo(0) = (xi(N) + xi(0) + xi(1)) / nave xo(N) = (xi(N - 1) + xi(N) + xi(0)) / nave e.g., nave = 4 xo(0) = (xi(N) + xi(0) + xi(1) + xi(2)) / nave xo(N) = (xi(N - 1) + xi(N) + xi(0) + xi(1)) / nave opt = 0 : set unsmoothed beginning and end pts to x@_FillValue [most common] e.g., nave = 2 xo(0) = (xi(0) + xi(1)) / nave xo(N) = xi@_FillValue e.g., nave = 3 xo(0) = xi@_FillValue xo(1) = (xi(0) + xi(1) + xi(2)) / nave xi(N) = xi@_FillValue e.g., nave = 4 xo(0) = xi@_FillValue xo(1) = (xi(0) + xi(1) + xi(2) + xi(3)) / nave xo(N - 2) = (xi(N - 3) + xi(N - 2) + xi(N - 1) + xi(N)) / nave xo(N - 1)= xi@_FillValue xo(N)= xi@_FillValue opt > 0 : utilize reflective (symmetric) conditions e.g., nave = 2 xo(0) = (xi(0) + xi(1)) / nave xo(N) = (xi(N) + xi(N-1)) / nave e.g., nave = 3 xo(0) = (xi(1) + xi(0) + xi(1)) / nave xo(N) = (xi(N - 1) + xi(N) + xi(N-1)) / nave e.g., nave = 4 xo(0) = (xi(2) + xi(1) + xi(0) + xi(1)) / nave xo(N) = (xi(N - 1) + xi(N) + xi(N - 1) + xi(N - 2)) / nave
skipMissing
- if true, missing timesteps will not be included in the average and the average will be done on the non-missing times- Returns:
- the new field
- Throws:
VisADException
- On badness
-
sumOverTime
Sum each grid point- Parameters:
grid
- grid to analyzemakeTimes
- If true then make a time field with the range being the same computed value. If false then just return a single field of the computed values- Returns:
- the new field
- Throws:
VisADException
- On badness
-
minOverTime
Take the min value at each grid point- Parameters:
grid
- grid to analyzemakeTimes
- If true then make a time field with the range being the same computed value. If false then just return a single field of the computed values- Returns:
- the new field
- Throws:
VisADException
- On badness
-
maxOverTime
Take the max value at each grid point- Parameters:
grid
- grid to analyzemakeTimes
- If true then make a time field with the range being the same computed value. If false then just return a single field of the computed values- Returns:
- the new field
- Throws:
VisADException
- On badness
-
applyFunctionOverTime
public static FieldImpl applyFunctionOverTime(FieldImpl grid, String function, boolean makeTimes) throws VisADException Apply the function to the time steps of the given grid. The function is one of the FUNC_ enums- Parameters:
grid
- grid to averagefunction
- One of the FUNC_ enumsmakeTimes
- If true then make a time field with the range being the same computed value. If false then just return a single field of the computed values- Returns:
- the new field
- Throws:
VisADException
- On badness
-
applyFunctionOverTime
public static FieldImpl applyFunctionOverTime(FieldImpl grid, String function, int startIdx, int idxStride, boolean makeTimes) throws VisADException Apply the function to the time steps of the given grid. The function is one of the FUNC_ enums- Parameters:
grid
- grid to apply function tofunction
- One of the FUNC_ enumsstartIdx
- starting time indexidxStride
- stride for time indexmakeTimes
- If true then make a time field with the range being the same computed value. If false then just return a single field of the computed values- Returns:
- the new field
- Throws:
VisADException
- On badness
-
applyFunctionOverGrids
public static FlatField applyFunctionOverGrids(FlatField[] grids, String function) throws VisADException Apply the function to the grids. Grids must have the same domains The function is one of the FUNC_ enums- Parameters:
grids
- grids to apply function tofunction
- One of the FUNC_ enums- Returns:
- the new field
- Throws:
VisADException
- On badness
-
applyFunctionOverGrids0
public static FlatField applyFunctionOverGrids0(FlatField[] grids, String function) throws VisADException - Throws:
VisADException
-
applyFunctionOverMembers
public static FieldImpl applyFunctionOverMembers(FieldImpl grid, String statThreshold, String exptdLoBoundIn, String exptdUpBoundIn, String function) throws VisADException Apply the function to the ens members of the given grid. The function is one of the FUNC_ enums- Parameters:
grid
- grid to averagestatThreshold
- percent for FUNC_PRCNTL, probability threshold for FUNC_UPROBexptdLoBoundIn
- expected lo boundexptdUpBoundIn
- expected hi boundfunction
- One of the FUNC_ enums- Returns:
- the new field
- Throws:
VisADException
- On badness
-
applyFunctionOverMembers
public static FieldImpl applyFunctionOverMembers(FieldImpl grid, float statThreshold, float exptdLoBound, float exptdUpBound, String function) throws VisADException Apply the function to the ens members of the given grid. The function is one of the FUNC_ enums- Parameters:
grid
- grid to averagestatThreshold
- percent for FUNC_PRCNTL, probability threshold for FUNC_UPROBexptdLoBound
- expected lo boundexptdUpBound
- expected hi boundfunction
- One of the FUNC_ enums- Returns:
- the new field
- Throws:
VisADException
- On badness
-
applyFunctionOverMembers
public static FieldImpl applyFunctionOverMembers(FieldImpl grid, String function) throws VisADException Apply the function to the ens members of the given grid. The function is one of the FUNC_ enums- Parameters:
grid
- grid to averagefunction
- One of the FUNC_ enums- Returns:
- the new field
- Throws:
VisADException
- On badness
-
applyFunctionOverLevels
public static FieldImpl applyFunctionOverLevels(FieldImpl grid, String function) throws VisADException Apply the function to the time steps of the given grid over the levels. The function is one of the FUNC_ enums- Parameters:
grid
- grid to averagefunction
- One of the FUNC_ enums- Returns:
- the new field with the function applied at each point over the levels.
- Throws:
VisADException
- On badness
-
applyFunctionOverGrid2D
public static FieldImpl applyFunctionOverGrid2D(FieldImpl grid, String function, String statThreshold) throws VisADException Apply the function to the 2D grid. The function is one of the FUNC_ enums- Parameters:
grid
- grid to averagefunction
- One of the FUNC_ enumsstatThreshold
- percent for FUNC_PRCNTL, probability threshold for FUNC_UPROB- Returns:
- the new time series point field
- Throws:
VisADException
- On badness
-
applyFunctionOverGrid2D
- Throws:
VisADException
-
applyFunctionOverGrid2D
public static FieldImpl applyFunctionOverGrid2D(FieldImpl grid, String function, FieldImpl grid1, String function1, float percentile) throws VisADException Evaluate the function of the grid and the function1 to the grid1.- Parameters:
grid
- 2d grid to apply function (max, min, average)function
- One of the FUNC_ enumsgrid1
- 2d grid to apply function1 (percentile)function1
- another function name- Returns:
- the new time series point field
- Throws:
VisADException
- On badness
-
applyFunctionToLevels
public static FieldImpl applyFunctionToLevels(FieldImpl grid, String function) throws VisADException Apply the function to the time steps of the given grid at each level. The function is one of the FUNC_ enums- Parameters:
grid
- grid to averagefunction
- One of the FUNC_ enums- Returns:
- the new field
- Throws:
VisADException
- On badness
-
applyFunctionToAxis
public static FieldImpl applyFunctionToAxis(FieldImpl grid, String function, String axis) throws VisADException Apply the function to the x or y of the given grid at each level. The function is one of the FUNC_ enumerations- Parameters:
grid
- grid to applyfunction
- One of the FUNC_ enumerationsaxis
- the axis to apply the function (AXIS_X or AXIS_Y)- Returns:
- the new field
- Throws:
VisADException
- On badness
-
ddx
Take the partial derivative with respect to X of the given field.- Parameters:
grid
- grid to parialize- Returns:
- partialized grid
- Throws:
RemoteException
- Java RMI errorVisADException
- VisAD Error
-
ddy
Take the partial derivative with respect to Y of the given field.- Parameters:
grid
- grid to parialize- Returns:
- partialized grid
- Throws:
RemoteException
- Java RMI errorVisADException
- VisAD Error
-
partial
public static FieldImpl partial(FieldImpl grid, int domainIndex) throws VisADException, RemoteException Take the partial derivative with respect variable at the domain index.- Parameters:
grid
- grid to parializedomainIndex
- index of variable to use for derivative- Returns:
- partialized grid
- Throws:
RemoteException
- Java RMI errorVisADException
- VisAD Error
-
partial
- Throws:
VisADException
RemoteException
-
evaluatePercentile
public static float evaluatePercentile(float[] values, int begin, int length, double p) throws VisADException evaluate percentile value- Parameters:
values
- the valuesbegin
- the starting indexlength
- number of pointsp
- the percentage- Returns:
- the percentile
- Throws:
VisADException
- VisAD Error
-
removeNaNFromArray
public static float[] removeNaNFromArray(float[] inputArray) -
evaluatePercentile
- Throws:
VisADException
-
evaluatePercentile
- Throws:
VisADException
-
twoDConvert
public static float[] twoDConvert(float[][] nums) -
evaluateMode
public static float evaluateMode(float[] data) evaluate mode value- Parameters:
data
- the data- Returns:
- the percentile
-
evaluateUProbability
public static float evaluateUProbability(float[] values, float pValue, int length) throws VisADException evaluate univariate probability of "variable with n ensemble values" smaller than pValue code from $NAWIPS/gempak/source/diaglib/de/decprb.c used to make this function.- Parameters:
values
- the values, within the userspecified range, at a given grid point from an ensemble model runpValue
- the threshold used in the probability calculation - P(value smaller than pValue)length
- number of ensemble members (might not be the same as values.length)- Returns:
- prob the univariate probability that the value at the grid point is less than pValue
- Throws:
VisADException
- VisAD Error
-
applyFunctionOverGridsExt
public static FieldImpl applyFunctionOverGridsExt(FieldImpl field, String function) throws VisADException - Throws:
VisADException
-
calculateHelicity
public static FieldImpl calculateHelicity(FieldImpl gridu, FieldImpl gridv, float bottom, float top, float ux, float vy) throws VisADException Calculate Helicity to the time steps of the given grid at each level.- Parameters:
gridu
- u component gridgridv
- v component gridbottom
- in metertop
- in meterux
- average u windvy
- average v wind- Returns:
- the new field
- Throws:
VisADException
- On badness
-
subtractExt
public static FieldImpl subtractExt(FieldImpl grid, FieldImpl grid2d) throws VisADException, RemoteException substractExt subtract a grid2d from each level of the 3d grid- Parameters:
grid
- 3d gridgrid2d
- 2d grid- Returns:
- the new 3d grid
- Throws:
VisADException
- On badnessRemoteException
- for bad
-
replaceNegativeValue
public static FieldImpl replaceNegativeValue(FieldImpl grid, float newValue) throws VisADException, RemoteException - Throws:
VisADException
RemoteException
-
replacePositiveValue
public static FieldImpl replacePositiveValue(FieldImpl grid, float newValue) throws VisADException, RemoteException - Throws:
VisADException
RemoteException
-
statisticsFF
public static edu.wisc.ssec.mcidasv.data.hydra.Statistics statisticsFF(FlatField grid) throws VisADException - Throws:
VisADException
-
quantileTransformerFF
- Throws:
VisADException
-
powerTransformerFF
- Throws:
VisADException
-
powerTransformerFF
- Throws:
VisADException
-
robustScalerFF
- Throws:
VisADException
-
calculateL2Norm
public static float calculateL2Norm(float[] vector) -
calculateL1Norm
public static float calculateL1Norm(float[] vector)
-