Class TimeSeriesMath
- All Implemented Interfaces:
IVerticalDatumOperations<TimeSeriesMath,
,HecMathException> Constants
- Direct Known Subclasses:
TimeSeriesMathVertDatum
TimeSeriesMath
class wraps around a
hec.io.TimeSeriesContainer
(time series data) and
provides the user the capability to perform
arithmetic and other operations on a time series. For example, each
value in a time series may be scaled by the value 3.0 using:
ts.multiply( 3.0 ) where ts is aTimeSeriesMath object
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from class hec.hecmath.HecMath
_curveNumber, _dc, _dssPath, ABS, ADD, COS, DIVIDE, EXPONENTIATION, INVERSE, LOG, LOG10, MULTIPLY, ROUND, SIN, SQRT, SUBTRACT, TAN, TRUNCATE
Fields inherited from interface hec.script.Constants
FALSE, ITS_DELETE_INSERT, ITS_MERGE, RTS_REPLACE_ALL, RTS_REPLACE_ALL_CREATE, RTS_REPLACE_ALL_DELETE, RTS_REPLACE_MISSING_VALUES_ONLY, RTS_REPLACE_WITH_NON_MISSING, TRUE, UNDEFINED, UNDEFINED_DOUBLE, UNDEFINED_FLOAT, UNDEFINED_INT, UNDEFINED_LONG, UNDEFINED_TIME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabs()
Derive a new time series composed of the absolute values of the current time series.Derive a new time series by computing a running accumulation of the current time series.acos()
Derive a new time series from arccosine of the values of the current time series.add
(double constant) Add a constant value to the values in current time series.Add the time series in the parameter,tsMath
, to the current time series.asin()
Derive a new time series from arcsine of the values of the current time series.atan()
Derive a new time series from arctangent of the values of the current time series.boolean
See if the unit system can be successfully determined from the units string.ceil()
Derive a new time series with values of the current time series rounded up to the nearest whole number that is greater to or equal to the value.centeredMovingAverage
(int numberToAverageOver, boolean onlyValidValues, boolean useReduced) Perform a centered moving average smoothing of the time series.static boolean
Perform basic checks on the TimeSeriesContainertsc
to ensure that there is data.boolean
Checks that the times in the TimeSeriesContainertsc
exactly match the times in the current time series.boolean
checkTimeSeriesMath
(HecMath math, String methodName) Checks to see ifmath
is an instance of hec.hecmath.TimeSeriesMath object.Returns a new TimeSeriesMath object constructed from this object if the internal data supports it, collapsing the internal data in the processprotected PairedDataMath[]
computeDurationAnalysis
(boolean standardMethod, String durationPeriodType, DurationPeriod[] durationPeriods, int binDistribution, int numberBins, double[] binLimits, int iplottingPointsMethod, double[] userDefinedPoints, int horizontalScale, int verticalScale) protected method for computing duration analysis for all condtionsDeprecated.Convert time series values to English units.convertToIrregular
(String blockSize) convertToIrregular
(String blockSize, boolean removeMissing) Convert time series values to metric (SI) units.copy()
Create a duplicate copy of the time series object.protected static void
copyHeaderInfo
(TimeSeriesContainer fromTsc, TimeSeriesContainer toTsc) copy basic header information from one TimeSeriesContainer to anothercorrelationCoefficients
(HecMath tsMath) Computes the linear regression correlation coefficients between data in current time series and the parameter time series,tsMath
.cos()
Derive a new time series from cosine of the values of the current time series.HecMath[]
Derive a set of cyclic statistics from the current regular interval time series.HecMath[]
cyclicAnalysis
(String startYear) decayingBasinWetnessParameter
(HecMath tsMath, double decayRate) Compute a time series decaying basin wetness parameter from the preciptation time seriestsMath
.divide
(double constant) Divide values in the current time series by a constant.Divide the current time series by the parameter time series,tsMath
.durationAnalysisBin
(String periodType, DurationPeriod[] durationPeriods, int binDistribution, int numberBins, double[] binLimits, int iplottingPointsMethod, double[] userDefinedPoints, int horizontalScale, int verticalScale) durationAnalysisStandard
(String periodType, DurationPeriod[] durationPeriods, int iplottingPointsMethod, double[] userDefinedPoints, int horizontalScale, int verticalScale) Perform A Standard Duration Analysis for time series.estimateForMissingPrecipValues
(int maxMissingAllowed) Linearly interpolate estimates for missing values in a cumulative precipitation time series.estimateForMissingValues
(int maxMissingAllowed) Linearly interpolate estimates for missing values in the time series.exp()
Derive a new time series which is the e raised to the values of the current time series.Returns a new TimeSeriesMathVertDatum object constructed from this object if the internal data supports it, expanding the internal data in the processexponentiation
(double constant) Raise values in the current time series to the power ofconstant
.exponentiation
(HecMath tsMath) Raise values in the current time series to the power of the parameter time series,tsMath
.extractTimeSeriesDataForTimeSpecification
(String timeLevelString, String rangeString, boolean isInclusive, int intervalWindow, boolean setAsIrregular) Extract data from the current regular or irregular interval time series according to the time specifications defined in the parameters.protected static int
findInterval
(int[] times, int time, int lastIndex) Find interval times array in which "time" lies in and return the index postion of the first point.protected int
findValidValue
(TimeSeriesContainer tsc, int index, boolean lookAfter) Given a time series container and an index, look before or after that index for a valid value.int
Find the date and time of the first valid time series value.double
Find the first valid value in the time series.floor()
Derive a new time series with values of the current time series rounded down to the nearest whole number that is less than or equal to the value.flowAccumulatorGageProcessor
(HecMath tsMath) Compute a time series of period-average flows from a flow accumulator type gage.fmod
(double constant) Return the remainder of integer division of current time series by a constant.Return the remainder of integer division of current time series by the parameter time series,tsMath
.forwardMovingAverage
(int numberToAverageOver) Compute a forward moving average of the time series.forwardMovingAverage
(int numberToAverageOver, boolean onlyValidValues, boolean useReduced) Compute a forward moving average of the time series.generateDataPairs
(HecMath tsMath, boolean sort) Deprecated.generateDataPairs
(HecMath tsMath, double buffer) This method will compare the two time series and create a PairedDataMath object that has all of the data points that are coincident in time (with given buffer)generatePairedData
(HecMath tsMath, boolean sort) static HecMath
generateRegularIntervalTimeSeries
(String startTimeString, String endTimeString, int timeIntervalMinutes, int timeOffsetMinutes, double initialValue) static HecMath
generateRegularIntervalTimeSeries
(String startTimeString, String endTimeString, String timeIntervalString, double initialValue) Generate a new regular interval time series data for the specifed start time, end time, time interval and timeOffset and with all values set toinitialValue
.static HecMath
generateRegularIntervalTimeSeries
(String startTimeString, String endTimeString, String timeIntervalString, String timeOffsetString, double initialValue) Generate a new regular interval time series data for the specifed start time, end time, time interval and timeOffset and with all values set toinitialValue
.get the HecMath._dc (DataContainer) cast as a TimeSeriesContainergetData()
Copy the current TimeSeriesContainer data in the TimeSeriesMath object intocontainer
.void
getData
(DataContainer container) Copy the current TimeSeriesContainer data in the TimeSeriesMath object intocontainer
.protected int
getFunctionType
(String functionTypeString) double[]
Deprecated.Returns the standardized units label for the time series y-values .getType()
Returns the type label for the current time series.getUnits()
Returns the units label of the y-values for the current time series.Determine the geometric mean of the current time series and the each time series in the parameter,tsMathArray
.Determine the harmonic mean of the current time series and the each time series in the parameter,tsMathArray
.integer_divide
(double constant) integer_divide
(HecMath tsMath) integerDivide
(double constant) Divide values in the current time series by a constant and truncate the result to an integer value.integerDivide
(HecMath tsMath) Divide the current time series by the parameter time series,tsMath
and truncate the result to an integer value.interpolateDataAtRegularInterval
(String timeIntervalString, String timeOffsetString) Create a new regular interval time series having the specified time interval and time offset by interpolation of data from the current time series.inverse()
Derive a new time series with values equal to 1 divided by the values of the original time series.boolean
Determine if the time series data is in English units.boolean
isMetric()
Determine if the time series data is in metric (SI) units.isMuskingumRoutingStable
(int numberSubreaches, double muskingumK, double muskingumX) Check for possible instability for the given Muskingum Routing parameters.boolean
isValid
(int index) Determine if the data value at the index locationindex
in the current time series is valid ( okay or not missing ).protected static boolean
isValid
(DataContainer container, int index) Determine if the data value intsc
is valid ( not missing or is okay ) for the index locationindex
.double
Compute the kurtosis coefficient of the time series values.int
Find the date and time of the last valid time series value.double
Find the last valid value in the time series.log()
Derive a new time series with values being the natural log of values of the current time series.log10()
Derive a new time series with values being the log base 10 of values of the current time series.double
max()
Find the maximum value of the time series.Determine the maximum of the current time series and the each time series in the parameter,tsMathArray
.int
maxDate()
Find the date and time of the maximum time series value.double
mean()
Compute the mean value of the time series.Determine the arithmetic mean of the current time series and the each time series in the parameter,tsMathArray
.double
med()
Compute the median of the time series values.Determine the median (50th percentile) of the current time series and the each time series in the parameter,tsMathArray
.mergeTimeSeries
(HecMath tsMath) Merge values in two time series.double
min()
Find the minimum value of the time series.Determine the minimum of the current time series and the each time series in the parameter,tsMathArray
.int
minDate()
Find the date and time of the minimum time series value.double
mode()
Compute the mode of the time series values.modulo
(double constant) Return the remainder of integer division of current time series by a constant.Return the remainder of integer division of current time series by the parameter time series,tsMath
.multipleRegression
(HecMath[] tsMathArray, double minimumLimit, double maximumLimit) Determine the multiple linear regression coefficients between the current time series and the set of time series intsMathArray
.multiply
(double constant) Multiply a constant value to values in current time series.Multiply the current time series with the parameter time series,tsMath
.muskingumRouting
(int numberSubreaches, double muskingumK, double muskingumX) Route the current time series by the Muskingum hydrologic routing method.neg()
negative()
Derive a new time series composed of the negatives of the values of the current time series.int
Count the number of invalid (missing or rejected) values in the time series values.int
Count the number of missing (but not rejected) values in the time series values.int
Count the number of questioned (but not missing) values in the time series values.int
Count the number of rejected (but not missing) values in the time series values.int
Count the number of valid (non-missing and non-rejected) values in the time series values.olympicSmoothing
(int numberToAverageOver, boolean onlyValidValues, boolean useReduced) Perform an Olympic smoothing average of the time series.double
p1()
Compute the p1 of the time series values.Determine the 1st percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p10()
Compute the p10 of the time series values.Determine the 10th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p2()
Compute the p2 of the time series values.Determine the 2nd percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p20()
Compute the p20 of the time series values.Determine the 20th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p25()
Compute the p25 of the time series values.Determine the 25th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p5()
Compute the p5 of the time series values.Determine the 5th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p75()
Compute the p75 of the time series values.Determine the 75th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p80()
Compute the p80 of the time series values.Determine the 80th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p90()
Compute the p90 of the time series values.Determine the 90th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p95()
Compute the p95 of the time series values.Determine the 95th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p98()
Compute the p98 of the time series values.Determine the 98th percentile of the current time series and the each time series in the parameter,tsMathArray
.double
p99()
Compute the p99 of the time series values.Determine the 99th percentile of the current time series and the each time series in the parameter,tsMathArray
.protected static List<ValueContainer>
periodConstants
(HecMath math) Multiply the current time series with the each time series in the parameter,tsMathArray
.replaceSpecificValues
(HecDouble from, HecDouble to) Replace specific values for another in the time series.replaceValuesInRange
(HecDouble min, HecDouble max, HecDouble to) Replace values within range for another in the time series.resample
(mil.army.usace.hec.metadata.Interval interval) Resample a time series to a different intervalDetermine the root mean square (rms, or quadraticharmonic mean) of the current time series and the each time series in the parameter,tsMathArray
.round()
Derive a new time series with values of the current time series rounded to the nearest whole number.roundOff
(int digitsPrecision, int powerOfTensPlace) Derive a new time series with values of the current time series rounded to the specified precision and/or power of tens place.screenWithConstantValue
(String durationStr, double rejectTolerance, double questionTolerance, double minThreshold, int maxMissing) Flag values in time series whose values do not change more than a specified amount over a specified duation as questionable or rejected.screenWithDurationMagnitude
(String durationStr, double minRejectLimit, double minQuestionLimit, double maxQuestionLimit, double maxRejectLimit) Flag values in time series whose accumulation over a specified period lies minimum/maximum limits values as questionable or rejected.screenWithForwardMovingAverage
(int numberToAverageOver, double changeLimit) Flag values in time series exceeding maximum change from a forward moving average.screenWithForwardMovingAverage
(int numberToAverageOver, double changeLimit, boolean setInvalidToUndefined, String qualityFlagForInvalidValue) Flag values in time series exceeding maximum change from a forward moving average.screenWithMaxMin
(double minValueLimit, double maxValueLimit, double changeLimit) Flag values in time series exceeding minimum and maximum limit values or maximum change limit.screenWithMaxMin
(double minValueLimit, double maxValueLimit, double changeLimit, boolean setInvalidToSpecified, double invalidValueReplacement, String qualityFlagForInvalidValue) Flag values in time series exceeding minimum and maximum limit values or maximum change limit.screenWithMaxMin
(double minValueLimit, double maxValueLimit, double changeLimit, boolean setInvalidToUndefined, String qualityFlagForInvalidValue) Flag values in time series exceeding minimum and maximum limit values or maximum change limit.screenWithMaxMin
(double minRejectLimit, double minQuestionLimit, double maxQuestionLimit, double maxRejectLimit) Flag values in time series exceeding minimum and maximum limit values as questionable or rejected.screenWithRateOfChange
(double minRejectLimit, double minQuestionLimit, double maxQuestionLimit, double maxRejectLimit) Flag values in time series whose rate of change from the last valid value exceed minimum/maximum limits values as questionable or rejected.void
setData
(DataContainer container) Set the TimeSeriesContainer data for the current TimeSeriesMath object.void
setParameterPart
(String paramString) set the parameter type (C Part) of the DSS Pathnamevoid
Set the type label for the time series.void
Set the units label for the time series.shiftAdjustment
(HecMath tsMath) lineary interpolate the values of the current time series upon the times contained in tscshiftInTime
(int timeShiftMinutes) Shift the times in the current time series by the specified time increment.shiftInTime
(int timeShiftMinutes, int timeInterval, int numberIntervals) shiftInTime
(HecTime timeToShift) Shift the times in the current time series by the specified time increment.shiftInTime
(String timeShiftString) Shift the times in the current time series by the specified time increment.sign()
Derive a new time series composed of the signs of the values of the current time series.sin()
Derive a new time series from sine of the values of the current time series.double
Compute the skew coefficient of the time series values.snapToRegularInterval
(String timeIntervalString, String timeOffsetString, String timeBackwardString, String timeForwardString) "Snap" data from the current irregular or regular interval time series to form a new regular interval time series of the specified interval and offset.sqrt()
Derive a new time series which is the square root of the values of the current time series.double
Compute the standard deviation of the time series values.standardDeviation
(HecMath[] tsMathArray) Determine the standard deviation of the current time series and the each time series in the parameter,tsMathArray
.Deprecated.straddleStaggerRouting
(int numberToAverage, int numberToLag, int numberSubreaches) Route the current time series using the Straddle-Stagger hydrologic routing method.subtract
(double constant) Subtract a constant value from values in current time series.Subtract the time series in the parameter,tsMath
, from the current time series.Derive a new time series from the successive differences of the current time series.double
sum()
Compute the total accumulated amount for time series.Add each of the time series in the parameter,tsMathArray
, to the current time series.tan()
Derive a new time series from tangent of the values of the current time series.Derive a new time series from the successive differences in time of the current time series.transformTimeSeries
(HecMath tsMath, String functionTypeString) Generate a new time series from the current regular or irregular interval time series.transformTimeSeries
(HecMath tsMath, String functionTypeString, boolean toIrregular) transformTimeSeries
(HecMath tsMath, String functionTypeString, boolean toIrregular, double missingAllowed) transformTimeSeries
(String timeIntervalString, String timeOffsetString, String functionTypeString) Generate a new regular interval time series from the current regular or irregular time series.transformTimeSeries
(String timeIntervalString, String timeOffsetString, String functionTypeString, boolean toIrregular) transformWithFunction
(ScalarOperable transformer) use custom transformer to alter valuestruncate()
Derive a new time series with values of the current time series truncated to whole numbers.Determine the variance of the current time series and the each time series in the parameter,tsMathArray
.Methods inherited from class hec.hecmath.HecMath
applyMultipleLinearRegression, bisearch, bisearch, checkContainer, conicInterpolation, createInstance, createInstance, durationAnalysis, durationAnalysis, durationAnalysis, durationAnalysis, getFunctionName, getPath, getSelectedCurve, hunt, isMissing, isValid, mergePairedDataSets, modifiedPulsRouting, multipleLinearRegression, polynomialTransformation, polynomialTransformationWithIntegral, ratingTableInterpolation, reverseRatingTableInterpolation, roundOffValue, setCurve, setCurve, setDPart, setEPart, setLocation, setPathname, setTimeInterval, setVersion, setWatershed, standardNormalDeviate, twoVariableRatingTableInterpolation
-
Field Details
-
TYPE_UNDEFINED
public static final int TYPE_UNDEFINED- See Also:
-
INST
public static final int INST- See Also:
-
INST_VAL
public static final int INST_VAL- See Also:
-
INST_CUM
public static final int INST_CUM- See Also:
-
PER_AVER
public static final int PER_AVER- See Also:
-
PER_CUM
public static final int PER_CUM- See Also:
-
INTERPOLATE
public static final int INTERPOLATE- See Also:
-
MAX
public static final int MAX- See Also:
-
MIN
public static final int MIN- See Also:
-
AVERAGE
public static final int AVERAGE- See Also:
-
INTEGRATE
public static final int INTEGRATE- See Also:
-
ACCUMULATE
public static final int ACCUMULATE- See Also:
-
VOLUME
public static final int VOLUME- See Also:
-
COUNT_VALID
public static final int COUNT_VALID- See Also:
-
LEVEL_YEAR_STRING
- See Also:
-
LEVEL_DAYMONTH_STRING
- See Also:
-
LEVEL_MONTH_STRING
- See Also:
-
LEVEL_DAYWEEK_STRING
- See Also:
-
LEVEL_TIME_STRING
- See Also:
-
-
Constructor Details
-
TimeSeriesMath
public TimeSeriesMath() -
TimeSeriesMath
- Throws:
HecMathException
-
-
Method Details
-
params
- Throws:
ComputationException
-
setParameterPart
set the parameter type (C Part) of the DSS Pathname- Overrides:
setParameterPart
in classHecMath
- Parameters:
paramString
- the new parameter type- Throws:
HecMathException
-
setData
Set the TimeSeriesContainer data for the current TimeSeriesMath object. The current TimeSeriesMath will use a copy ofcontainer
.- Specified by:
setData
in classHecMath
- Parameters:
container
- the TimeSeriesContainer data to be used by this TimeSeriesMath object.- Throws:
HecMathException
- ifcontainer
is null or not of type TimeSeriesContainer.
-
getData
Copy the current TimeSeriesContainer data in the TimeSeriesMath object intocontainer
.- Specified by:
getData
in classHecMath
- Returns:
- a copy of the TimeSeriesContainer held in the current TimeSeriesMath object.
- Throws:
HecMathException
-
getData
Copy the current TimeSeriesContainer data in the TimeSeriesMath object intocontainer
.- Specified by:
getData
in classHecMath
- Parameters:
container
- the TimeSeriesContainer to receive the copy of data from this time series.- Throws:
HecMathException
-
getContainer
get the HecMath._dc (DataContainer) cast as a TimeSeriesContainer- Returns:
- the TimeSeriesContainer held in the current TimeSeriesMath object.
- Throws:
HecMathException
-
add
Add the time series in the parameter,tsMath
, to the current time series. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current time series andtsMath
, the values will be summed provided values for both time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMath
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. If a specific quality value in the parameter time series is questionable or rejected, that quality will be copied to the new time series.
- Overrides:
add
in classHecMath
- Parameters:
tsMath
- the time series to be added to the current time series.- Returns:
- a new time series representing the sum of the two time series
- Throws:
HecMathException
-
add
Add a constant value to the values in current time series. Times in which values are missing in the current time series remain missing in the new time series.- Overrides:
add
in classHecMath
- Parameters:
constant
- the value to be added to values in current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
-
subtract
Subtract the time series in the parameter,tsMath
, from the current time series. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current time series andtsMath
, the value intsMath
will be subtracted from the value in the current time series provided both values are valid ( not missing ). Points in the current time series which cannot be matched to valid points intsMath
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. If a specific quality value in the parameter time series is questionable or rejected, that quality will be copied to the new time series.
- Overrides:
subtract
in classHecMath
- Parameters:
tsMath
- the time series to be subtracted from the current time series.- Returns:
- a new time series resulting from the subtraction operation.
- Throws:
HecMathException
-
subtract
Subtract a constant value from values in current time series. Times in which values are missing in the current time series remain missing in the new time series.- Overrides:
subtract
in classHecMath
- Parameters:
constant
- the value to be subtracted from values in current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
-
multiply
Multiply the current time series with the parameter time series,tsMath
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMath
, the values will be multiplied provided the values for both time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMath
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. If a specific quality value in the parameter time series is questionable or rejected, that quality will be copied to the new time series.
- Overrides:
multiply
in classHecMath
- Parameters:
tsMath
- the time series to be multiplied with the current time series.- Returns:
- a new time series representing the multiplication of the two time series
- Throws:
HecMathException
-
multiply
Multiply a constant value to values in current time series. Times in which values are missing in the current time series remain missing in the new time series.- Overrides:
multiply
in classHecMath
- Parameters:
constant
- the value to be multiplied to values in current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
-
divide
Divide the current time series by the parameter time series,tsMath
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current time series andtsMath
, the value in the current time series will be divided by the value intsMath
provided both values are valid ( not missing ). Divide by zeroes are not allowed. When thetsMath
time series value is zero, the value for the new time series will be set to missing. Points in the current time series which cannot be matched to valid points intsMath
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. If a specific quality value in the parameter time series is questionable or rejected, that quality will be copied to the new time series.
- Overrides:
divide
in classHecMath
- Parameters:
tsMath
- the time series to be divided into the current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
-
divide
Divide values in the current time series by a constant. Times in which values are missing in the current time series remain missing in the new time series.- Overrides:
divide
in classHecMath
- Parameters:
constant
- the value to divide values in current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
- ifconstant
is zero.
-
integerDivide
Divide the current time series by the parameter time series,tsMath
and truncate the result to an integer value. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current time series andtsMath
, the value in the current time series will be divided by the value intsMath
provided both values are valid ( not missing ). Divide by zeroes are not allowed. When thetsMath
time series value is zero, the value for the new time series will be set to missing. Points in the current time series which cannot be matched to valid points intsMath
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. If a specific quality value in the parameter time series is questionable or rejected, that quality will be copied to the new time series.
- Parameters:
tsMath
- the time series to be divided into the current time series.- Returns:
- a new time series resulting from the subtraction operation.
- Throws:
HecMathException
-
integer_divide
- Throws:
HecMathException
-
integerDivide
Divide values in the current time series by a constant and truncate the result to an integer value. Times in which values are missing in the current time series remain missing in the new time series.- Parameters:
constant
- the value to divide values in current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
- ifconstant
is zero.
-
integer_divide
- Throws:
HecMathException
-
modulo
Return the remainder of integer division of current time series by the parameter time series,tsMath
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current time series andtsMath
, the value in the current time series will be divided by the value intsMath
provided both values are valid ( not missing ). Divide by zeroes are not allowed. When thetsMath
time series value is zero, the value for the new time series will be set to missing. Points in the current time series which cannot be matched to valid points intsMath
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. If a specific quality value in the parameter time series is questionable or rejected, that quality will be copied to the new time series.
- Parameters:
tsMath
- the time series to be divided into the current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
-
modulo
Return the remainder of integer division of current time series by a constant. Times in which values are missing in the current time series remain missing in the new time series.- Parameters:
constant
- the value to divide values in current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
- ifconstant
is zero.
-
exponentiation
Raise values in the current time series to the power of the parameter time series,tsMath
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current time series andtsMath
, the value in the current time series will be raised to the power of the value intsMath
provided both values are valid ( not missing ). Points in the current time series which cannot be matched to valid points intsMath
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. If a specific quality value in the parameter time series is questionable or rejected, that quality will be copied to the new time series.
- Parameters:
tsMath
- the time series of exponents for the current time series.- Returns:
- a new time series resulting from the subtraction operation.
- Throws:
HecMathException
-
exponentiation
Raise values in the current time series to the power ofconstant
. Times in which values are missing in the current time series remain missing in the new time series.- Overrides:
exponentiation
in classHecMath
- Parameters:
constant
- the exponent value.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
- ifconstant
is zero.
-
abs
Derive a new time series composed of the absolute values of the current time series. Values which are missing in the original time series will be missing in the new time series.- Overrides:
abs
in classHecMath
- Returns:
- A new time series composed of the absolute values of the current time series
- Throws:
HecMathException
-
negative
Derive a new time series composed of the negatives of the values of the current time series. Values which are missing in the original time series will be missing in the new time series.- Returns:
- A new time series composed of the negatives of the values of the current time series
- Throws:
HecMathException
-
neg
- Throws:
HecMathException
-
inverse
Derive a new time series with values equal to 1 divided by the values of the original time series. Values which are missing in the original time series will be missing in the new time series. Values equal to 0.0 will be set to missing in the new time series.- Overrides:
inverse
in classHecMath
- Returns:
- A new time series with values of 1 divided by the values of the original time series.
- Throws:
HecMathException
-
sign
Derive a new time series composed of the signs of the values of the current time series. Values which are missing in the original time series will be missing in the new time series. Values in the current time series will be represented as -1.0, 0.0 or 1.0 in the derived time series, depending on whether the original value is < 0.0, 0.0 or > 0.0.- Returns:
- A new time series composed of the negatives of the values of the current time series
- Throws:
HecMathException
-
sqrt
Derive a new time series which is the square root of the values of the current time series. Values which are missing in the original time series will be missing in the new time series. Values less than 0.0 will be set to missing in the new time series.- Overrides:
sqrt
in classHecMath
- Returns:
- A new time series representing the square root of the values of the current time series
- Throws:
HecMathException
-
exp
Derive a new time series which is the e raised to the values of the current time series. Values which are missing in the original time series will be missing in the new time series. Values less than 0.0 will be set to missing in the new time series.- Returns:
- A new time series representing the e raised to the values of the current time series
- Throws:
HecMathException
-
log
Derive a new time series with values being the natural log of values of the current time series. Values which are missing in the original time series will be missing in the new time series. Values less than or equal to 0.0 will be set to missing in the new time series.- Overrides:
log
in classHecMath
- Returns:
- A new time series composed of the natural log of the values of the original time series
- Throws:
HecMathException
-
log10
Derive a new time series with values being the log base 10 of values of the current time series. Values which are missing in the original time series will be missing in the new time series. Values less than or equal to 0.0 will be set to missing in the new time series.- Overrides:
log10
in classHecMath
- Returns:
- A new time series composed of the log base 10 of the values of the current time series
- Throws:
HecMathException
-
transformWithFunction
use custom transformer to alter values- Overrides:
transformWithFunction
in classHecMath
- Throws:
HecMathException
-
sin
Derive a new time series from sine of the values of the current time series. Values which are missing in the original time series will be missing in the new time series.- Overrides:
sin
in classHecMath
- Returns:
- A new time series representing the sine of the values of the original time series
- Throws:
HecMathException
-
cos
Derive a new time series from cosine of the values of the current time series. Values which are missing in the original time series will be missing in the new time series.- Overrides:
cos
in classHecMath
- Returns:
- A new time series representing the cosine of the values of the current time series
- Throws:
HecMathException
-
tan
Derive a new time series from tangent of the values of the current time series. Values which are missing in the original time series will be missing in the new time series. Values of the original time series which have a cosine value of zero are set to missing in the new time series.- Overrides:
tan
in classHecMath
- Returns:
- A new time series representing the tangent of the values of the original time series
- Throws:
HecMathException
-
asin
Derive a new time series from arcsine of the values of the current time series. Values which are missing in the original time series will be missing in the new time series.- Returns:
- A new time series representing the arcsine of the values of the original time series
- Throws:
HecMathException
-
acos
Derive a new time series from arccosine of the values of the current time series. Values which are missing in the original time series will be missing in the new time series.- Returns:
- A new time series representing the arccosine of the values of the current time series
- Throws:
HecMathException
-
atan
Derive a new time series from arctangent of the values of the current time series. Values which are missing in the original time series will be missing in the new time series. Values of the original time series which have a cosine value of zero are set to missing in the new time series.- Returns:
- A new time series representing the arctangent of the values of the original time series
- Throws:
HecMathException
-
floor
Derive a new time series with values of the current time series rounded down to the nearest whole number that is less than or equal to the value. Values which are missing in the original time series will be missing in the new time series.- Returns:
- A new time series composed of values of the current time series rounded down to the nearest whole numbers.
- Throws:
HecMathException
-
ceil
Derive a new time series with values of the current time series rounded up to the nearest whole number that is greater to or equal to the value. Values which are missing in the original time series will be missing in the new time series.- Returns:
- A new time series composed of values of the current time series rounded to the up nearest whole numbers.
- Throws:
HecMathException
-
round
Derive a new time series with values of the current time series rounded to the nearest whole number. Values which are missing in the original time series will be missing in the new time series.- Overrides:
round
in classHecMath
- Returns:
- A new time series composed of values of the current time series rounded to the nearest whole numbers.
- Throws:
HecMathException
-
truncate
Derive a new time series with values of the current time series truncated to whole numbers. Values which are missing in the original time series will be missing in the new time series.- Overrides:
truncate
in classHecMath
- Returns:
- A new time series composed of values of the current time series truncated to whole numbers.
- Throws:
HecMathException
-
fmod
Return the remainder of integer division of current time series by the parameter time series,tsMath
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current time series andtsMath
, the value in the current time series will be divided by the value intsMath
provided both values are valid ( not missing ). Divide by zeroes are not allowed. When thetsMath
time series value is zero, the value for the new time series will be set to missing. Points in the current time series which cannot be matched to valid points intsMath
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. If a specific quality value in the parameter time series is questionable or rejected, that quality will be copied to the new time series.
Fmod is the same as modulo when both arguments are greater than zero.
- Parameters:
tsMath
- the time series to be divided into the current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
-
fmod
Return the remainder of integer division of current time series by a constant. Times in which values are missing in the current time series remain missing in the new time series.Fmod is the same as modulo when both arguments are greater than zero.
- Parameters:
constant
- the value to divide values in current time series.- Returns:
- a new time series resulting from the operation.
- Throws:
HecMathException
- ifconstant
is zero.
-
sum
Add each of the time series in the parameter,tsMathArray
, to the current time series. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current time series and each time series intsMathArray
, the values will be summed provided values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be added to the current time series.- Returns:
- a new time series representing the sum of the two time series
- Throws:
HecMathException
-
product
Multiply the current time series with the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be multiplied provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be multiplied with the current time series.- Returns:
- a new time series representing the multiplication of the two time series
- Throws:
HecMathException
-
min
Determine the minimum of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the minimum of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the minimum values of all time series.
- Throws:
HecMathException
-
max
Determine the maximum of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the maximum of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the maximum values of all time series.
- Throws:
HecMathException
-
mean
Determine the arithmetic mean of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the arithmetic mean of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the arithmetic mean of all time series.
- Throws:
HecMathException
-
gmean
Determine the geometric mean of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the geometric mean of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the geometric mean of all time series.
- Throws:
HecMathException
-
hmean
Determine the harmonic mean of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the harmonic mean of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the harmonic mean of all time series.
- Throws:
HecMathException
-
rms
Determine the root mean square (rms, or quadraticharmonic mean) of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the rms of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the rms of all time series.
- Throws:
HecMathException
-
variance
Determine the variance of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the variance of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the variance of all time series.
- Throws:
HecMathException
-
var
- Throws:
HecMathException
-
standardDeviation
Determine the standard deviation of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the standard deviation of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the standard deviation of all time series.
- Throws:
HecMathException
-
stddev
Deprecated.- Parameters:
tsMathArray
-- Returns:
- Throws:
HecMathException
- See Also:
-
med
Determine the median (50th percentile) of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the median of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the median of all time series.
- Throws:
HecMathException
-
p1
Determine the 1st percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 1st percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 1st percentile of all time series.
- Throws:
HecMathException
-
p2
Determine the 2nd percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 2nd percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 2nd percentile of all time series.
- Throws:
HecMathException
-
p5
Determine the 5th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 5th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 5th percentile of all time series.
- Throws:
HecMathException
-
p10
Determine the 10th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 10th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 10th percentile of all time series.
- Throws:
HecMathException
-
p20
Determine the 20th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 20th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 20th percentile of all time series.
- Throws:
HecMathException
-
p25
Determine the 25th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 25th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 25th percentile of all time series.
- Throws:
HecMathException
-
p75
Determine the 75th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 75th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 75th percentile of all time series.
- Throws:
HecMathException
-
p80
Determine the 80th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 80th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 80th percentile of all time series.
- Throws:
HecMathException
-
p90
Determine the 90th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 90th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 90th percentile of all time series.
- Throws:
HecMathException
-
p95
Determine the 95th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 95th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 95th percentile of all time series.
- Throws:
HecMathException
-
p98
Determine the 98th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 98th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 98th percentile of all time series.
- Throws:
HecMathException
-
p99
Determine the 99th percentile of the current time series and the each time series in the parameter,tsMathArray
. A new time series will be created which duplicates the time points of the current time series. Where time points match for the current andtsMathArray
, the values will be the 99th percentile of all time series for that time, provided the values for all time series are valid values ( not missing ). Points in the current time series which cannot be matched to valid points intsMathArray
are set to missing. Values in the current time series which are missing remain missing in the new time series.The new time series will always have quality defined. For a specific time, if any of the quailty values in the current or parameter time series is questionable or rejected, the quality value for that time in the new time series will be set to the most severe quality for that time (e.g. if questionable and rejected are both encountered, the new quality will be set to rejected.)
- Parameters:
tsMathArray
- the array of time series to be compared with the current time series.- Returns:
- a new time series representing the 99th percentile of all time series.
- Throws:
HecMathException
-
roundOff
Derive a new time series with values of the current time series rounded to the specified precision and/or power of tens place.digitsPrecision
controls the number of significant digits displayed and can range from 1 to 8.powerOfTensPlace
is the magnitude of 10 to which to round to. For example, -1 specifies rounding to one-tenth (0.1).Examples: 1234.123456 will round to:
1230.0 for digitsPrecision = 3, powerOfTensPlace = -1 1234.1 for digitsPrecision = 6, powerOfTensPlace = -1 1230 for digitsPrecision = 6, powerOfTensPlace = 1
Values which are missing in the original time series will be missing in the new time series.- Overrides:
roundOff
in classHecMath
- Parameters:
digitsPrecision
- Number of digits of precision, between 1 and 8.powerOfTensPlace
- Magnitude of ten to round to.- Returns:
- A new time series composed of values of the current time series rounded to the specified precision.
- Throws:
HecMathException
-
accumulation
Derive a new time series by computing a running accumulation of the current time series.Compute a new time series from the running accumulation of the current time series. For time points in which the current time series value is missing or rejected, the value in the accumulation time series remains constant ( same as the accumulated value at the last valid point location ).
- Overrides:
accumulation
in classHecMath
- Returns:
- A new time series representing the running accumulation of the current time series
- Throws:
HecMathException
-
min
Find the minimum value of the time series. Missing and rejected values are excluded.- Overrides:
min
in classHecMath
- Returns:
- the minimum value of the time series.
- Throws:
HecMathException
-
minDate
Find the date and time of the minimum time series value.- Overrides:
minDate
in classHecMath
- Returns:
- the date and time of the minimum value as an int value translatable by HecTime
- Throws:
HecMathException
- See Also:
-
max
Find the maximum value of the time series. Missing and rejected values are excluded.- Overrides:
max
in classHecMath
- Returns:
- the maximum value of the time series.
- Throws:
HecMathException
-
maxDate
Find the date and time of the maximum time series value.- Overrides:
maxDate
in classHecMath
- Returns:
- the date and time of the maximum value as an int value translatable by HecTime
- Throws:
HecMathException
- See Also:
-
mean
Compute the mean value of the time series. Missing and rejected values are excluded.- Overrides:
mean
in classHecMath
- Returns:
- the mean value of the time series.
- Throws:
HecMathException
-
sum
Compute the total accumulated amount for time series. Missing and rejected values are excluded.- Overrides:
sum
in classHecMath
- Returns:
- the total accumulated value of the time series.
- Throws:
HecMathException
-
standardDeviation
Compute the standard deviation of the time series values. Missing and rejected values are excluded. A minimum of three valid values are required for the computation.- Overrides:
standardDeviation
in classHecMath
- Returns:
- the standard deviation value of the time series.
- Throws:
HecMathException
- if there are less than 3 valid values in the time series.
-
skewCoefficient
Compute the skew coefficient of the time series values. Missing values and rejected are excluded. A minimum of three valid values are required for the computation.- Overrides:
skewCoefficient
in classHecMath
- Returns:
- the skew coefficient value of the time series.
- Throws:
HecMathException
- if there are less than 3 valid values in the time series.
-
kurtosisCoefficient
Compute the kurtosis coefficient of the time series values. Missing values and rejected are excluded. A minimum of four valid values are required for the computation.- Overrides:
kurtosisCoefficient
in classHecMath
- Returns:
- the kurtosis coefficient value of the time series.
- Throws:
HecMathException
- if there are less than 4 valid values in the time series.
-
mode
Compute the mode of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
mode
in classHecMath
- Returns:
- the mode value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
med
Compute the median of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
med
in classHecMath
- Returns:
- the median value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p1
Compute the p1 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p1
in classHecMath
- Returns:
- the p1 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p2
Compute the p2 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p2
in classHecMath
- Returns:
- the p2 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p5
Compute the p5 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p5
in classHecMath
- Returns:
- the p5 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p10
Compute the p10 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p10
in classHecMath
- Returns:
- the p10 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p20
Compute the p20 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p20
in classHecMath
- Returns:
- the p20 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p25
Compute the p25 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p25
in classHecMath
- Returns:
- the p25 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p75
Compute the p75 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p75
in classHecMath
- Returns:
- the p75 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p80
Compute the p80 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p80
in classHecMath
- Returns:
- the p80 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p90
Compute the p90 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p90
in classHecMath
- Returns:
- the p90 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p95
Compute the p95 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p95
in classHecMath
- Returns:
- the p95 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p98
Compute the p98 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p98
in classHecMath
- Returns:
- the p98 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
p99
Compute the p99 of the time series values. Missing values and rejected are excluded. A minimum of one valid values is required for the computation.- Overrides:
p99
in classHecMath
- Returns:
- the p99 value of the time series.
- Throws:
HecMathException
- if there are less than 1 valid value in the time series.
-
numberValidValues
Count the number of valid (non-missing and non-rejected) values in the time series values.- Overrides:
numberValidValues
in classHecMath
- Returns:
- the number of valid (non-missing and non-rejected) value in the time series.
- Throws:
HecMathException
-
numberInvalidValues
Count the number of invalid (missing or rejected) values in the time series values.- Returns:
- the number of invalid (missing or rejected) value in the time series.
- Throws:
HecMathException
-
numberMissingValues
Count the number of missing (but not rejected) values in the time series values.- Overrides:
numberMissingValues
in classHecMath
- Returns:
- the number of missing (but not rejected) values in the time series.
- Throws:
HecMathException
-
numberQuestionedValues
Count the number of questioned (but not missing) values in the time series values.- Returns:
- the number of questioned (but not missing) values in the time series.
- Throws:
HecMathException
-
numberRejectedValues
Count the number of rejected (but not missing) values in the time series values.- Returns:
- the number of rejected (but not missing) values in the time series.
- Throws:
HecMathException
-
firstValidDate
Find the date and time of the first valid time series value.- Returns:
- the date and time of the first valid value as an int value translatable by HecTime
- Throws:
HecMathException
- See Also:
-
firstValidValue
Find the first valid value in the time series.- Returns:
- the value of the first valid time series value.
- Throws:
HecMathException
-
lastValidDate
Find the date and time of the last valid time series value.- Overrides:
lastValidDate
in classHecMath
- Returns:
- the date and time of the last valid value as an int value translatable by HecTime
- Throws:
HecMathException
- See Also:
-
lastValidValue
Find the last valid value in the time series.- Overrides:
lastValidValue
in classHecMath
- Returns:
- the value of the last valid time series value.
- Throws:
HecMathException
-
convertToMetricUnits
Convert time series values to metric (SI) units. Determination of the unit system will be based upon the time series units and parameter type labels. Missing values will be ignored.- Specified by:
convertToMetricUnits
in classHecMath
- Returns:
- A new time series with values converted to metric units. If the original time series is already in metric units, will return a copy of the original time series.
- Throws:
HecMathException
- if the unit conversion could not be performed.
-
convertToEnglishUnits
Convert time series values to English units. Determination of the unit system will be based upon the time series units and parameter type labels. Missing values will be ignored.- Specified by:
convertToEnglishUnits
in classHecMath
- Returns:
- A new time series with values converted to English units. If the original time series is already in English units, will return a copy of the original time series.
- Throws:
HecMathException
- if the unit conversion could not be performed.
-
isMetric
Determine if the time series data is in metric (SI) units. Determination of the unit system will be based upon the time series units and parameter type labels.- Specified by:
isMetric
in classHecMath
- Returns:
- true if the time series units are metric, otherwise returns false.
- Throws:
HecMathException
- if the unit system cannot be determined.
-
isEnglish
Determine if the time series data is in English units. Determination of the unit system will be based upon the time series units and parameter type labels.- Specified by:
isEnglish
in classHecMath
- Returns:
- true if the time series units are English, otherwise returns false.
- Throws:
HecMathException
- if the unit system cannot be determined.
-
canDetermineUnitSystem
public boolean canDetermineUnitSystem()See if the unit system can be successfully determined from the units string.- Specified by:
canDetermineUnitSystem
in classHecMath
- Returns:
- true if the units system can be determined, otherwise returns false.
-
getUnits
Returns the units label of the y-values for the current time series. -
getStandardUnits
Returns the standardized units label for the time series y-values . The time series units label is converted to a standardized units string as defined in the filehec.heclib.util.unitConversion.def
. This is done to ease comparison of units between time series and for unit conversions. For example, "inch", "inches" or "INCHES" are changed to "in".- Overrides:
getStandardUnits
in classHecMath
- Returns:
- standardized units label for time series as defined in
hec.heclib.util.unitConversion.def
-
setUnits
Set the units label for the time series. After transformation by certain math functions, the units label may no longer be applicable to the time series. This function allows the user to redefine the time series units. -
getType
Returns the type label for the current time series.- Returns:
- type label for time series
-
setType
Set the type label for the time series. This function allows the user to redefine the time series type.- Parameters:
typeString
- the new type label for the time series.
-
successiveDifferences
Derive a new time series from the successive differences of the current time series. The time series must be of type "INST-VAL" or "INST-CUM". The value in the new time is set to missing if either the current or previous point in the current time series is set to missing (need to have two consecutive valid values).By default, if the data type of the current time series is "INST-CUM", the data type of the new time series is set to "PER-CUM".
- Overrides:
successiveDifferences
in classHecMath
- Returns:
- A new time series of successive differences.
- Throws:
HecMathException
- if data is not of type "INST-VAL" or "INST-CUM".
-
timeDerivative
Derive a new time series from the successive differences in time of the current time series. The value in the new time is set to missing if either the current or previous point in the current time series is set to missing (need to have two consecutive valid values).By default, the data type of the new time series is set as "PER-AVER".
- Overrides:
timeDerivative
in classHecMath
- Returns:
- a new time series of time derivatives.
- Throws:
HecMathException
-
centeredMovingAverage
public HecMath centeredMovingAverage(int numberToAverageOver, boolean onlyValidValues, boolean useReduced) throws HecMathException Perform a centered moving average smoothing of the time series.Derive a new time series from the centered moving average of
numberToAverageOver
values in the current time series.If
onlyValidValues
is set to true, then if points in the averaging interval are missing values, the point in the new time series is set to missing. IfonlyValidValues
is set to false and missing values are contained in the averaging interval, a smoothed point is still computed using the valid values in the interval. If there are no valid values in the averaging interval, the point in the new time series is set to missing.If
useReduced
is set to true, then centered moving average points can be still be computed at the beginning and end of the time series even if there are less thannumberToAverageOver
values in the interval. IfuseReduced
is set to false, then the first and lastnumberToAverageOver/2
points of the new time series are set to missing.- Overrides:
centeredMovingAverage
in classHecMath
- Parameters:
numberToAverageOver
- the number of values to average over for computing the centered moving average. Must be greater than 2 and odd.onlyValidValues
- all values in the averaging interval must be valid for the computed point in the new time series to be valid.useReduced
- allow points at the beginning and end of the centered moving average time series to be computed from a reduced ( less thannumberToAverageOver
) number of points. Otherwise, set the first and lastnumberToAverageOver/2
points of the new time series to missing.- Returns:
- A new time series computed from the olypic smoothing average of current time series.
- Throws:
HecMathException
- if thenumberToAverageOver
is less than 3 or not odd.
-
olympicSmoothing
public HecMath olympicSmoothing(int numberToAverageOver, boolean onlyValidValues, boolean useReduced) throws HecMathException Perform an Olympic smoothing average of the time series.Derive a new time series from the Olympic smoothing average of
numberToAverageOver
values in the current time series. Olympic smoothing is the same as centered moving average except that the minimum and maximum values in the averaging interval are ignored.If
onlyValidValues
is set to true, then if points in the averaging interval are missing values, the point in the new time series is set to missing. IfonlyValidValues
is set to false and missing values are contained in the averaging interval, a smoothed point is still computed using the valid values in the interval. If there are no valid values in the averaging interval, the point in the new time series is set to missing.If
useReduced
is set to true, then centered moving average points can be still be computed at the beginning and end of the time series even if there are less thannumberToAverageOver
values in the interval. IfuseReduced
is set to false, then the first and lastnumberToAverageOver/2
points of the new time series are set to missing.- Overrides:
olympicSmoothing
in classHecMath
- Parameters:
numberToAverageOver
- the number of values to average over for computing the centered moving average. Must be greater than 2 and odd.onlyValidValues
- all values in the averaging interval must be valid for the computed point in the new time series to be valid.useReduced
- allow points at the beginning and end of the centered moving average time series to be computed from a reduced ( less thannumberToAverageOver
) number of points. Otherwise, set the first and lastnumberToAverageOver/2
points of the new time series to missing.- Returns:
- a new time series computed from the olypic smoothing average of current time series.
- Throws:
HecMathException
- if thenumberToAverageOver
is less than 3 or not odd.
-
forwardMovingAverage
public HecMath forwardMovingAverage(int numberToAverageOver, boolean onlyValidValues, boolean useReduced) throws HecMathException Compute a forward moving average of the time series.Derive a new time series from the forward moving average of the last
numberToAverageOver
values of the current time series.If
onlyValidValues
is set to true, then if points in the averaging interval are missing values, the point in the new time series is set to missing. IfonlyValidValues
is set to false and missing values are contained in the averaging interval, a smoothed point is still computed using the valid values in the interval. If there are no valid values in the averaging interval, the point in the new time series is set to missing.If
useReduced
is set to true, then forward moving average points can be still be computed at the beginning of the time series even if there are less thannumberToAverageOver
values in the interval. IfuseReduced
is set to false, then the firstnumberToAverageOver
points of the new time series are set to missing.- Parameters:
numberToAverageOver
- the number of values to average over for computing the forward moving average. Must be greater than or equal to 2.onlyValidValues
- all values in the averaging interval must be valid for the computed point in the new time series to be valid.useReduced
- allow points at the beginning and end of the centered moving average time series to be computed from a reduced ( less thannumberToAverageOver
) number of points. Otherwise, set the first and lastnumberToAverageOver/2
points of the new time series to missing.- Returns:
- a new time series computed from the forward moving average of current time series.
- Throws:
HecMathException
-
forwardMovingAverage
Compute a forward moving average of the time series.Derive a new time series from the forward moving average of the last
numberToAverageOver
values of the current time series. If a missing value is occurs over thenumberToAverageOver
points, the value is excluded from the computation and the average is over one less value. At least to valid values must be defined over the averaging interval or else the point in the new time series is set to missing.- Overrides:
forwardMovingAverage
in classHecMath
- Parameters:
numberToAverageOver
- the number of values to average over for computing the forward moving average. Must be greater than or equal to 2.- Returns:
- a new time series computed from the forward moving average of current time series.
- Throws:
HecMathException
-
screenWithMaxMin
public HecMath screenWithMaxMin(double minValueLimit, double maxValueLimit, double changeLimit) throws HecMathException Flag values in time series exceeding minimum and maximum limit values or maximum change limit.Values in the time series are screened for quality. Values below
minValueLimit
or abovemaxValueLimit
or with a change from the previous time series value greater thanchangeLimit
fail the quality test. The maximum change comparison is done only when consecutive values are not flagged.Values failing the screening test are set to the "Missing" value.
- Parameters:
minValueLimit
- minimum valid value limit.maxValueLimit
- maximum valid value limit.changeLimit
- maximum change allowed in the tested value from the previous time series value.- Returns:
- a copy of the time series with values failing the quality test set to missing.
- Throws:
HecMathException
- See Also:
-
screenWithMaxMin
public HecMath screenWithMaxMin(double minValueLimit, double maxValueLimit, double changeLimit, boolean setInvalidToSpecified, double invalidValueReplacement, String qualityFlagForInvalidValue) throws HecMathException Flag values in time series exceeding minimum and maximum limit values or maximum change limit.Values in the time series are screened for quality. Values below
minValueLimit
or abovemaxValueLimit
or with a change from the previous time series value greater thanchangeLimit
fail the quality test. The maximum change comparison is done only when consecutive values are not flagged.- Overrides:
screenWithMaxMin
in classHecMath
- Parameters:
minValueLimit
- minimum valid value limit.maxValueLimit
- maximum valid value limit.changeLimit
- maximum change allowed in the tested value from the previous time series value.setInvalidToSpecified
- if true, time series values failing the quality test are set to the specified value.invalidValueReplacement
- The value to use for replacing invalid values issetInvalidToSpecifiedValue
is set to "true".qualityFlagForInvalidValue
- character string representing the quality flag setting for values failing the quality test. The accepted character strings are: "M" or "Missing", "R" or "Rejected", "Q" or "Questionable".- Returns:
- a copy of the time series with values failing the quality test set to missing.
- Throws:
HecMathException
- See Also:
-
screenWithMaxMin
public HecMath screenWithMaxMin(double minValueLimit, double maxValueLimit, double changeLimit, boolean setInvalidToUndefined, String qualityFlagForInvalidValue) throws HecMathException Flag values in time series exceeding minimum and maximum limit values or maximum change limit.Values in the time series are screened for quality. Values below
minValueLimit
or abovemaxValueLimit
or with a change from the previous time series value greater thanchangeLimit
fail the quality test. The maximum change comparison is done only when consecutive values are not flagged.- Overrides:
screenWithMaxMin
in classHecMath
- Parameters:
minValueLimit
- minimum valid value limit.maxValueLimit
- maximum valid value limit.changeLimit
- maximum change allowed in the tested value from the previous time series value.setInvalidToUndefined
- if true, time series values failing the quality test are set to the "Undefined" value.qualityFlagForInvalidValue
- character string representing the quality flag setting for values failing the quality test. The accepted character strings are: "M" or "Missing", "R" or "Rejected", "Q" or "Questionable".- Returns:
- a copy of the time series with values failing the quality test set to missing.
- Throws:
HecMathException
- See Also:
-
screenWithMaxMin
public HecMath screenWithMaxMin(double minRejectLimit, double minQuestionLimit, double maxQuestionLimit, double maxRejectLimit) throws HecMathException Flag values in time series exceeding minimum and maximum limit values as questionable or rejected.Values in the time series are screened for quality. Values below
minRejectLimit
or abovemaxRejectLimit
are marked with a rejected quality flag. Other values belowminQuestionLimit
or abovemaxQuestionLimit
are marked with a questioned quality flag. Other values are marked with an okay quality flag unless they are already marked as rejected or questioned.- Parameters:
minRejectLimit
- Values below this will be marked as rejected.minQuestionLimit
- Values below this, but not belowminRejectLimit
will be marked as questioned.maxQuestionLimit
- Values above this, but not abovemaxRejectLimit
will be marked as questioned.maxRejectLimit
- Values above this will be marked as rejected.- Returns:
- A copy of the time series with values with the quality set as described.
- Throws:
HecMathException
-
screenWithRateOfChange
public HecMath screenWithRateOfChange(double minRejectLimit, double minQuestionLimit, double maxQuestionLimit, double maxRejectLimit) throws HecMathException Flag values in time series whose rate of change from the last valid value exceed minimum/maximum limits values as questionable or rejected.Values in the time series are screened for quality. Values whose rate of change from the last valid value are below
minRejectLimit
or abovemaxRejectLimit
are marked with a rejected quality flag. Other whose rate of change from the last valid value are values belowminQuestionLimit
or abovemaxQuestionLimit
are marked with a questioned quality flag. Other values are marked with an okay quality flag unless they are already marked as rejected or questioned.Rates are computed in units per hour.
- Parameters:
minRejectLimit
- Values whose rate of change from the last valid value are below this will be marked as rejected.minQuestionLimit
- Values whose rate of change from the last valid value are below this, but not belowminRejectLimit
will be marked as questioned.maxQuestionLimit
- Values whose rate of change from the last valid value are above this, but not abovemaxRejectLimit
will be marked as questioned.maxRejectLimit
- Values whose rate of change from the last valid value are above this will be marked as rejected.- Returns:
- A copy of the time series with values with the quality set as described.
- Throws:
HecMathException
-
screenWithDurationMagnitude
public HecMath screenWithDurationMagnitude(String durationStr, double minRejectLimit, double minQuestionLimit, double maxQuestionLimit, double maxRejectLimit) throws HecMathException Flag values in time series whose accumulation over a specified period lies minimum/maximum limits values as questionable or rejected.Values in the time series are screened for quality. All (non-missing) values whose accumulated value for the specified duration is below
minRejectLimit
or abovemaxRejectLimit
are marked with a rejected quality flag. Other whose whose accumulated value for the specified duration is belowminQuestionLimit
or abovemaxQuestionLimit
are marked with a questioned quality flag. Other values are marked with an okay quality flag unless they are already marked as rejected or questioned.- Parameters:
durationStr
- The time period over which to perform the test, of the form nX, where in is an integer and X is one of Minutes, Hours, or Days, which can be abbreviated to one or more characters.minRejectLimit
- Values whose accumulated value for the specified duration is below this will be marked as rejected.minQuestionLimit
- Values whose accumulated value for the specified duration is below this, but not belowminRejectLimit
will be marked as questioned.maxQuestionLimit
- Values whose accumulated value for the specified duration is above this, but not abovemaxRejectLimit
will be marked as questioned.maxRejectLimit
- Values whose accumulated value for the specified duration is above this will be marked as rejected.- Returns:
- A copy of the time series with values with the quality set as described.
- Throws:
HecMathException
-
screenWithConstantValue
public HecMath screenWithConstantValue(String durationStr, double rejectTolerance, double questionTolerance, double minThreshold, int maxMissing) throws HecMathException Flag values in time series whose values do not change more than a specified amount over a specified duation as questionable or rejected.Values in the time series are screened for quality. All (non-missing) values whose difference over the specified duration is below
rejectTolerance
are marked with a rejected quality flag. Other whose whose difference over the specified duration is belowquestionTolerance
are marked with a questioned quality flag. Other values are marked with an okay quality flag unless they are already marked as rejected or questioned.Only values above the specified
minThreshold
value are screened as described.Only time periods that contain no more that
maxMissing
missing values are screened as described.- Parameters:
durationStr
- The time period over which to perform the test, of the form nX, where in is an integer and X is one of Minutes, Hours, or Days, which can be abbreviated to one or more characters.rejectTolerance
- Values will be marked as rejected if they do not differ by more than this amount over the specified duration. To disable marking values as rejected, set this tolerance to less than zero.questionTolerance
- Values will be marked as questioned if they do not differ by more than this amount over the specified duration. To disable marking values as questioned, set this tolerance to less than zero.minThreshold
- Values will be screened only if they are greater than this value.maxMissing
- The maximum number of missing values to tolerate in the specified duration for screening purposes.- Returns:
- A copy of the time series with values with the quality set as described.
- Throws:
HecMathException
-
screenWithForwardMovingAverage
public HecMath screenWithForwardMovingAverage(int numberToAverageOver, double changeLimit) throws HecMathException Flag values in time series exceeding maximum change from a forward moving average.A running forward moving average of valid values is progressively computed over
numberToAverageOver
points. Values exceeding the moving average computed for the preceeding point location by more thanchangeLimit
are flagged or set to the "Missing" value depending upon the settings forsetInvalidToMissingValue
orqualityFlagForInvalidValue
parameters. Values failing the quality test are excluded from the forward moving average computation for the subsequent points. The maximum change comparison is done only when consecutive values are not flagged.- Parameters:
numberToAverageOver
- the number of values to average over for computing the forward moving average. Must be greater than 2.changeLimit
- allowed deviation in the tested value from the forward moving average.- Returns:
- a copy of the time series with values failing the quality test set to undefined and with the quality flag set to missing.
- Throws:
HecMathException
-
screenWithForwardMovingAverage
public HecMath screenWithForwardMovingAverage(int numberToAverageOver, double changeLimit, boolean setInvalidToUndefined, String qualityFlagForInvalidValue) throws HecMathException Flag values in time series exceeding maximum change from a forward moving average.A running forward moving average of valid values is progressively computed over
numberToAverageOver
points. Values exceeding the moving average computed for the preceeding point location by more thanchangeLimit
are flagged or set to the "Missing" value depending upon the settings forsetInvalidToMissingValue
orqualityFlagForInvalidValue
parameters. Values failing the quality test are excluded from the forward moving average computation for the subsequent points. The maximum change comparison is done only when consecutive values are not flagged.If
setInvalidToMissingValue
is set to "true", values failing the screening test are set to the "Missing" value.If
qualityFlagForInvalidValue
is set to a character or string recognized as a valid quality flag, the quality flag will be set for tested values. If there is no previously existing quality available for the time series, the quality flag array will be created for the time series. Values failing the quality test are set to the user specified quality flag for invalid values. If there is existing quality data and the time series value passes the quality test, the existing quality flag for the points is unchanged. If there was no previously existing quality and the time series value passes the quality test, the quality flag for the point is set to "Okay".- Overrides:
screenWithForwardMovingAverage
in classHecMath
- Parameters:
numberToAverageOver
- the number of values to average over for computing the forward moving average. Must be greater than 2.changeLimit
- allowed deviation in the tested value from the forward moving average.setInvalidToUndefined
- if true, time series values failing the quality test are set to the "Undefined" value.qualityFlagForInvalidValue
- character string representing the quality flag setting for values failing the quality test. The accepted character strings are: "M" or "Missing", "R" or "Rejected", "Q" or "Questionable". A blank string is entered to disable the setting of the quality flag.- Returns:
- a copy of the time series with values failing the quality test set to missing and/or with the quality flag set to the user specified quality for invalid values.
- Throws:
HecMathException
- if thenumberToAverageOver
is less than 3 or if an unrecognized quality flag is entered forqualityFlagForInvalidValue
or ifsetInvalidToMissingValue
is false andqualityFlagForInvalidValue
is blank ( no action would occur ).
-
estimateForMissingValues
Linearly interpolate estimates for missing values in the time series.The function interpolates between valid values in the time series to fill in locations in time with values defined as "Missing". Linear interpolation will NOT be performed for segments of the time series where there are more than
maxMissingAllowed
successive bad values.- Overrides:
estimateForMissingValues
in classHecMath
- Parameters:
maxMissingAllowed
- maximum number consecutive missing values between valid values in which interpolation is allowed.- Returns:
- a copy of the current time series with missing values filled by linear interpolation.
- Throws:
HecMathException
- if the time series contains less than 2 valid values.- See Also:
-
estimateForMissingPrecipValues
Linearly interpolate estimates for missing values in a cumulative precipitation time series.The function interpolates between valid values in the time series to fill in locations in time with values defined as "Missing".
If the values bracketing the missing period are increasing with time, only interpolate if there are no more thant
maxMissingAllowed
successive bad values. If the values bracketing the missing period are equal, then estimate any number of missing values. If the values bracketing the missing period are decreasing with time, do not estimate any missing values. Data must be of type "INST-CUM".- Overrides:
estimateForMissingPrecipValues
in classHecMath
- Parameters:
maxMissingAllowed
- maximum number consecutive missing values between valid values in which interpolation is allowed.- Returns:
- a copy of the current time series with missing values filled by linear interpolation.
- Throws:
HecMathException
- if the data is not of type "INST-CUM" or if the time series contains less than 2 valid values.- See Also:
-
replaceSpecificValues
Replace specific values for another in the time series.The function searches through the time series array and replaces values that match the "from" value with the "to" value. HecDouble controls the precision to which the value is compared (e.g., 12.345 is to three places after the decimal).
- Overrides:
replaceSpecificValues
in classHecMath
- Parameters:
from
- value which will be replacedto
- value with which to replace with- Returns:
- a copy of the current time series with the specific values replaced.
- Throws:
HecMathException
- if the time series contains less than 2 valid values.
-
replaceValuesInRange
public HecMath replaceValuesInRange(HecDouble min, HecDouble max, HecDouble to) throws HecMathException Replace values within range for another in the time series.The function searches through the time series array and replaces values between the "min" and "max" value with the "to" value.
- Overrides:
replaceValuesInRange
in classHecMath
- Parameters:
min
- minimum value which will be replacedmax
- maximum value which will be replacedto
- value with which to replace with- Returns:
- a copy of the current time series with the specific values replaced.
- Throws:
HecMathException
- if the time series contains less than 2 valid values.
-
mergeTimeSeries
Merge values in two time series.Will derive a new time series by merging all values in the current and parameter,
tsMath
, time series. For points in the two time series coincident in time, valid values in the primary (current) time series take presidence over valid values in the parameter time series, and will be used in the new merged time series. For coincident points in which the value from the primary time series are flagged "Missing", then the valid value from the parameter time series will be used in the new merged time series. If values for both time series are both "Missing", then the value for the time in the merged time series is set to "Missing".- Overrides:
mergeTimeSeries
in classHecMath
- Parameters:
tsMath
- time series for merging data with the current time series.- Returns:
- a new time series representing the merged values from the current and paramter time series.
- Throws:
HecMathException
- if either the current or parameter time series are empty.
-
generateDataPairs
This method will compare the two time series and create a PairedDataMath object that has all of the data points that are coincident in time (with given buffer)- Overrides:
generateDataPairs
in classHecMath
- Parameters:
tsMath
- = other time seriesbuffer
- - in minutes because time series containers are in minutes- Returns:
- Throws:
HecMathException
-
generateDataPairs
@Deprecated public PairedDataMath generateDataPairs(HecMath tsMath, boolean sort) throws HecMathException Deprecated.- Overrides:
generateDataPairs
in classHecMath
- Parameters:
tsMath
-sort
-- Returns:
- Throws:
HecMathException
-
generatePairedData
- Overrides:
generatePairedData
in classHecMath
- Throws:
HecMathException
-
isMuskingumRoutingStable
public String isMuskingumRoutingStable(int numberSubreaches, double muskingumK, double muskingumX) throws HecMathException Check for possible instability for the given Muskingum Routing parameters.Test if the input parameters statisfy the stability criteria:
1/(2(1-x)) <= K/deltaT <= 1/2x, where deltaT = (time series time interval)/numberSubreaches
- Parameters:
numberSubreaches
- number of routing subreaches.muskingumK
- muskingum "k" in hours.muskingumX
- muskingum "X" parameter, between 0.0 and 0.5.- Returns:
- if the stability criteria is not met, will return a warning message detailing the specific instability problem.
- Throws:
HecMathException
- if the current time series is not a regular interval time series, or if values for numberSubreaches or muskingumX are invalid.
-
muskingumRouting
public HecMath muskingumRouting(int numberSubreaches, double muskingumK, double muskingumX) throws HecMathException Route the current time series by the Muskingum hydrologic routing method.Use
isMuskingumRoutingStable()
to determine if the Muskingum hydrologic routing is stable for the parameters entered. Only regular interval time series can be routed.- Overrides:
muskingumRouting
in classHecMath
- Parameters:
numberSubreaches
- number of routing subreaches.muskingumK
- muskingum "k" in hours.muskingumX
- muskingum "X" parameter, between 0.0 and 0.5.- Returns:
- the routed time series
- Throws:
HecMathException
- if the time series is not a regular interval time series, or if values for numberSubreaches or muskingumX are invalid.
-
straddleStaggerRouting
public HecMath straddleStaggerRouting(int numberToAverage, int numberToLag, int numberSubreaches) throws HecMathException Route the current time series using the Straddle-Stagger hydrologic routing method. The current time series must be regular interval.Use
isMuskingumRoutingStable()
to determine if the Muskingum hydrologic routing is stable for the parameters entered. Only regular interval time series can be routed.- Overrides:
straddleStaggerRouting
in classHecMath
- Parameters:
numberToAverage
- number of ordinates to average.numberToLag
- number of ordinates to lag hydrograph.numberSubreaches
- number of routing subreaches.- Returns:
- the routed time series
- Throws:
HecMathException
- if the time series is not a regular interval time series.
-
decayingBasinWetnessParameter
public HecMath decayingBasinWetnessParameter(HecMath tsMath, double decayRate) throws HecMathException Compute a time series decaying basin wetness parameter from the preciptation time seriestsMath
. The formula for computing the new time series from the time series precipation anddecayRate
is:tsNew(i) = decayRate * tsNew(i-1) + tsPrecip(i)
The first value of the current time series is used to set the first value in the new time series, that istsNew(0)
.The current time series and
tsMath
may be the same. Both the current time series andtsMath
must be regular interval and identical in time. Missing values in the precip time series ( tsPrecip(i) ) are zero for the computation.- Overrides:
decayingBasinWetnessParameter
in classHecMath
- Parameters:
tsMath
- precipitation time series.decayRate
- decay rate R, where 0 < R < 1.- Returns:
- a new time series of the decaying basin wetness parameter of
tsMath
. - Throws:
HecMathException
- if decay rate is not less than one and greater than 0, or if current time series andtsMath
are not identical in time or not regular interval.
-
flowAccumulatorGageProcessor
Compute a time series of period-average flows from a flow accumulator type gage.The current time series is assumed to be the accumulated flow data, while the paramter time series,
tsMath
, is assumed to be the corresponding time series of the count. The two time series are combined to compute a new time series of period average flow:tsNew(i) = ( tsAccFlow(i)-tsAccFlow(i-1) ) / ( tsCount(i)-tsCount(i-1) )
In the above equation, if tsAccFlow(i), tsAccFlow(i-1), tsCount(i) or tsCount(i-1) are missing, tsNew(i) is set to missing. The new time series is assigned the data type "PER-AVER".- Overrides:
flowAccumulatorGageProcessor
in classHecMath
- Parameters:
tsMath
- a time series of counts for the flow accumulator gage.- Returns:
- a new time series of period average flow.
- Throws:
HecMathException
-
convertToIrregular
- Overrides:
convertToIrregular
in classHecMath
- Throws:
HecMathException
-
convertToIrregular
- Throws:
HecMathException
-
interpolateDataAtRegularInterval
public HecMath interpolateDataAtRegularInterval(String timeIntervalString, String timeOffsetString) throws HecMathException Create a new regular interval time series having the specified time interval and time offset by interpolation of data from the current time series. Interpolation is performed according to the type of data in the current time series:- For INST-VAL data, linear interpolation is performed.
- For PER-AVE data, the period average over the new interval is computed for each new time point.
- For PER-CUM data, the cumulative value over the new interval is computed for each time point.
timeIntervalString
is a valid DSS time interval character string ( "15MIN", "1HOUR", "1DAY", etc.).timeOffsetString
defines the time offset from the standard interval time.timeOffsetString
has the form "nT", where "n" is an integer number and "T" is one of the time increments: "M(INUTES)", "D(AYS)", "H(OUR)", "W(EEKS)", "MON(THS)" or "Y(EARS)" ( characters in the parenthesis are optional ). For example, a time offset of 9 minutes would be expressed as "9M" or "9MIN".Units and data type of the current time series are preserved in the new time series.
- Overrides:
interpolateDataAtRegularInterval
in classHecMath
- Parameters:
timeIntervalString
- a valid DSS regular time interval string which defines the time interval of the new time series.timeOffsetString
- the offset of the new time points from the regular interval time. This string may be a blank string or thenull
value.- Returns:
- a new regular interval time series.
- Throws:
HecMathException
- if data type ("INST-VAL", etc.) is not defined for the time series.
-
transformTimeSeries
public HecMath transformTimeSeries(String timeIntervalString, String timeOffsetString, String functionTypeString) throws HecMathException Generate a new regular interval time series from the current regular or irregular time series. The new time series is computed having the time interval specifed bytimeIntervalString
and time offset set bytimeOffsetString
. New time series values are generated by processing current values according to the method set byfunctionTypeString
.timeIntervalString
must be a valid DSS regular time interval character string ( "15MIN", "1HOUR", "1DAY", etc.).Time of the new data points can be offset from the standard interval time using
timeOffsetString
. Thus usingtimeOffsetString
the derived hourly interval data could be offset to be computed at 5 minutes past the top of the hour.timeOffsetString
has the form "nT", where "n" is an integer number and "T" is one of the time increments: "M(INUTES)", "D(AYS)", "H(OUR)", "W(EEKS)", "MON(THS)" or "Y(EARS)" ( characters in the parenthesis are optional ). For example, a time offset of 9 minutes would be expressed as "9M" or "9MIN".functionTypeString
is a 3 character string defining how the data in the current time series will be processed to compute values for the new time series. Valid settings forfunctionTypeString
are:"INT" - Interpolate at end of interval "MAX" - Maximum over interval "MIN" - Minimum over interval "AVE" - Average over interval "ACC" - Accumulation over interval "ITG" - Integration over interval "NUM" - Number of valid data over interval "VOL" - Volume over interval
- Overrides:
transformTimeSeries
in classHecMath
- Parameters:
timeIntervalString
- a valid DSS regular time interval string which defines the time interval of the new time series.timeOffsetString
- the offset of the new time points from the regular interval time. This string may be a blank string or thenull
value.functionTypeString
- 3 character string defining the function method for transforming the current time series data.- Returns:
- a new regular interval time series.
- Throws:
HecMathException
- if the paramters could not be interpreted, or or if the data type ("INST-VAL", etc.) of the current time series is not defined.
-
transformTimeSeries
public HecMath transformTimeSeries(String timeIntervalString, String timeOffsetString, String functionTypeString, boolean toIrregular) throws HecMathException - Overrides:
transformTimeSeries
in classHecMath
- Throws:
HecMathException
-
transformTimeSeries
public HecMath transformTimeSeries(HecMath tsMath, String functionTypeString) throws HecMathException Generate a new time series from the current regular or irregular interval time series. The time points for the new time series are defined by the times intsMath
.tsMath
may be a regular or irregular interval time series.functionTypeString
is a 3 character string defining how the data in the current time series will be processed to compute values for the new time series. Valid settings forfunctionTypeString
are:"INT" - Interpolate at end of interval "MAX" - Maximum over interval "MIN" - Minimum over interval "AVE" - Average over interval "ACC" - Accumulation over interval "ITG" - Integration over interval "NUM" - Number of valid data over interval "VOL" - Volume over interval
- Overrides:
transformTimeSeries
in classHecMath
- Parameters:
tsMath
- a time series used to set the time pattern for the new time series. May be either regular or irregular interval.- Returns:
- a new transformed time series having the time pattern defined by
tsMath
. - Throws:
HecMathException
- if the paramters could not be interpreted, or or if the data type ("INST-VAL", etc.) of the current time series is not defined.- See Also:
-
transformTimeSeries
public HecMath transformTimeSeries(HecMath tsMath, String functionTypeString, boolean toIrregular) throws HecMathException - Overrides:
transformTimeSeries
in classHecMath
- Throws:
HecMathException
-
transformTimeSeries
public HecMath transformTimeSeries(HecMath tsMath, String functionTypeString, boolean toIrregular, double missingAllowed) throws HecMathException - Throws:
HecMathException
-
getFunctionType
- Throws:
HecMathException
-
snapToRegularInterval
public HecMath snapToRegularInterval(String timeIntervalString, String timeOffsetString, String timeBackwardString, String timeForwardString) throws HecMathException "Snap" data from the current irregular or regular interval time series to form a new regular interval time series of the specified interval and offset.A new regular interval time series will be created having the time interval of
timeIntervalString
with the time offset from the regular interval specifed bytimeOffsetString
. In most cases, there will be no time offset. Data from the orginal time series will be "snapped" to the regular interval if the time of the data falls within the time window set by thetimeBackwardString
and thetimeForwardString
. That is, if the new regular interval is at the top of the hour and the time window extends to 9 minutes before the hour and 15 minutes after the hour, an original data point at 0852 would be snapped to the time 0900 while a point at 0916 would be ignored.timeIntervalString
is a character string that represents a valid DSS time interval ( "15MIN", "1HOUR", "1DAY", etc.).timeOffsetString
,timeBackwardString
andtimeForwardString
are units of time expressed as "nT", where "n" is an integer number and "T" is one of the time increments: "M(INUTES)", "D(AYS)", "H(OUR)", "W(EEKS)", "MON(THS)" or "Y(EARS)" ( characters in the parenthesis are optional ). In the above example,timeIntervalString
would be "1HOUR",timeOffsetString
would be "0M",timeBackwardString
would be "9M" ( or "9min" ) andtimeForwardString
would be "15M".This function is typically used to convert irregular time series data that is reported close to the hour to regular time series at the hour.
- Overrides:
snapToRegularInterval
in classHecMath
- Parameters:
timeIntervalString
- a valid DSS regular time interval string which defines the time interval of the new time series.timeOffsetString
- the offset of the new time points from the regular interval time. This string may be a blank string or thenull
value.timeBackwardString
- the time to look backwards from the regular time interval ( plus offset ) for valid points.timeForwardString
- the time to look forwards from the regular time interval ( plus offset ) for valid points.- Returns:
- A new regular interval time series.
- Throws:
HecMathException
- iftimeIntervalString
is not a valid DSS time interval string, or iftimeOffsetString, timeBackwardString, timeForwardString
are not valid time increment strings.
-
shiftInTime
Shift the times in the current time series by the specified time increment.A new time series will created with the time points shifted by the amount specified by
timeShiftString
.timeShiftString
takes the form "nT", where "n" is an integer number and "T" is one of the time increments: "M(INUTES)", "D(AYS)", "H(OUR)", "W(EEKS)", "MON(THS)" or "Y(EARS)" ( characters in the parenthesis are optional ). As an example, to shift the time series data ahead by one hour would be accomplished by settingtimeShiftString
to "1H" or "1HOUR".- Overrides:
shiftInTime
in classHecMath
- Parameters:
timeShiftString
- the increment to shift the time series times.- Returns:
- A new time series shifted in time.
- Throws:
HecMathException
- iftimeShiftString
is not valid time increment string.
-
shiftInTime
Shift the times in the current time series by the specified time increment.A new time series will created with the time points shifted by the amount specified by
timeShiftString
.timeShiftString
takes the form "nT", where "n" is an integer number and "T" is one of the time increments: "M(INUTES)", "D(AYS)", "H(OUR)", "W(EEKS)", "MON(THS)" or "Y(EARS)" ( characters in the parenthesis are optional ). As an example, to shift the time series data ahead by one hour would be accomplished by settingtimeShiftString
to "1H" or "1HOUR".- Parameters:
timeShiftMinutes
-- Returns:
- A new time series shifted in time.
- Throws:
HecMathException
-
shiftInTime
public HecMath shiftInTime(int timeShiftMinutes, int timeInterval, int numberIntervals) throws HecMathException - Throws:
HecMathException
-
shiftInTime
Shift the times in the current time series by the specified time increment.A new time series will created with the time points shifted by the amount specified by
timeShiftString
.timeShiftString
takes the form "nT", where "n" is an integer number and "T" is one of the time increments: "M(INUTES)", "D(AYS)", "H(OUR)", "W(EEKS)", "MON(THS)" or "Y(EARS)" ( characters in the parenthesis are optional ). As an example, to shift the time series data ahead by one hour would be accomplished by settingtimeShiftString
to "1H" or "1HOUR".- Returns:
- A new time series shifted in time.
- Throws:
HecMathException
-
shiftAdjustment
lineary interpolate the values of the current time series upon the times contained in tsc- Overrides:
shiftAdjustment
in classHecMath
- Parameters:
tsMath
-- Returns:
- A new time series.
- Throws:
HecMathException
-
periodConstants
- Overrides:
periodConstants
in classHecMath
- Throws:
HecMathException
-
correlationCoefficients
Computes the linear regression correlation coefficients between data in current time series and the parameter time series,tsMath
. The time points in the two time series must match exactly. Missing values are ignored.Values in the primary (current) time series and
tsMath
are matched by time to form the data pairs for the correlation analysis. The function returns a LinearRegressionStatistics object containing he comprehensive set of correlation statistics.- Overrides:
correlationCoefficients
in classHecMath
- Parameters:
tsMath
- the time series for correlation with the current time series.- Returns:
- a comprehensive set of correlation statistics in a LinearRegressionStatistics object.
- Throws:
HecMathException
- See Also:
-
cyclicAnalysis
Derive a set of cyclic statistics from the current regular interval time series. The current time series must have a time interval of 1HOUR, 1DAY or 1MONTH. The function sorts the time series values into statistical "bins" relevant to the time interval. For 1HOUR interval data, values would be sorted into bins representing the hours of the day, 0100 to 2400. 1DAY interval data is apportioned to days of the year. 1MONTH interval data is sorted into months of the year.Fourteen statistical parameters are computed in each analysis. These are: maximum, minimum, average, standard deviation, 5%, 10%, 25%, 50% (median), 75%, 90%, 95% precentiles, date/time of maximum, date/time of minimum, and number of values processed. The function creates a pseudo regular interval time series for each function parameter. For example, with 1HOUR interval data, a 1HOUR interval time series with 24 hours of data (hours 0100 to 2400) would be created containing the maximum of all values at the time 0100, 0200, etc.
The 14 pseudo time series of cyclic statistics are returned by the function as an array of time series objects. The parameter part of the record path for each time series is modified to indicate the type of the statistical parameter. For a flow record, the paramter "FLOW" would become "FLOW-MAX" for the maximum values statistisc, "FLOW-P5" for the 5% percentile statistics, etc.
- Overrides:
cyclicAnalysis
in classHecMath
- Returns:
- an array containing 14 pseudo time series, one for each statistical parameter.
- Throws:
HecMathException
- if the time series is not regular interval or does not have a time interval of "1HOUR", "1DAY" or "1MONTH".
-
cyclicAnalysis
- Throws:
HecMathException
-
durationAnalysisStandard
public PairedDataMath[] durationAnalysisStandard(String periodType, DurationPeriod[] durationPeriods, int iplottingPointsMethod, double[] userDefinedPoints, int horizontalScale, int verticalScale) throws HecMathException Perform A Standard Duration Analysis for time series. The time series must be regular interval daily data.periodType
defines the analysis periods, with "Annual" being the typical analysis. The values are:"Annual", "Quarterly", "Monthly", "Other"
* @param durationPeriods - array of DurationPeriod(s) for user defined duration periods. null for standard periods calculations * @param iplottingPointsMethod - what plotting points should be selected. Possibilities are: DurationAnalysis.PLOTTING_POINTS_ALL DurationAnalysis.PLOTTING_POINTS_TRADITIONAL DurationAnalysis.PLOTTING_POINTS_USER_DEFINED- Parameters:
userDefinedPoints
- - User defined points, in precent 0 < f < 100, or null if iplottingPointsMethod != PLOTTING_POINTS_USER_DEFINEDhorizontalScale
- - defines the horizontal scale of the plot: DurationAnalysis.PLOT_PROBABILITY_HORIZONTAL; DurationAnalysis.PLOT_EXCEEDANCE_HORIZONTAL;verticalScale
- - defines the horizontal scale of the plot: DurationAnalysis.PLOT_LINEAR_VERTICAL; DurationAnalysis.PLOT_LOG_VERTICAL;- Returns:
- PairedDataMath[]
- Throws:
HecMathException
- if the time series is not regular interval or does not have a time interval "1DAY".
-
durationAnalysisBin
public PairedDataMath[] durationAnalysisBin(String periodType, DurationPeriod[] durationPeriods, int binDistribution, int numberBins, double[] binLimits, int iplottingPointsMethod, double[] userDefinedPoints, int horizontalScale, int verticalScale) throws HecMathException - Throws:
HecMathException
-
computeDurationAnalysis
protected PairedDataMath[] computeDurationAnalysis(boolean standardMethod, String durationPeriodType, DurationPeriod[] durationPeriods, int binDistribution, int numberBins, double[] binLimits, int iplottingPointsMethod, double[] userDefinedPoints, int horizontalScale, int verticalScale) throws HecMathException protected method for computing duration analysis for all condtions- Parameters:
durationPeriods
- - array of DurationPeriod(s) for user defined duration periods. Is null for standard periods calculationsdurationPeriodType
- - String specifying one of the standard duration periods- Returns:
- Throws:
HecMathException
- String periodType, DurationPeriod[] durationPeriods, int binDistribution, int numberBins, double binLimits[], int iplottingPointsMethod, double[] userDefinedPoints, int horizontalScale, int verticalScale);
-
multipleRegression
public PairedDataMath multipleRegression(HecMath[] tsMathArray, double minimumLimit, double maximumLimit) throws HecMathException Determine the multiple linear regression coefficients between the current time series and the set of time series intsMathArray
. All the time series must be regular interval time series with the same time interval. Data is processed for the time period common to all the time series. While the starting and ending time for each time series need not be the same, there must be time points common to all the time series. For any given time point, if a value is missing in any time series, no data for that time is processed.The function computes a set of linear regression coefficients (Bn) of the general form.
Y = B0 + B1*X1 + B2*X2 + B3*X3
That is an estimate of the current time series could be computed from the time series in
tsMathArray
and the regression coefficients such that:tsEstimate(i) = B0 + B1*ts1(i) + B2*ts2(i) + B3*ts3(i) ...
- Overrides:
multipleRegression
in classHecMath
- Parameters:
tsMathArray
- an array of time series objects for the regression analysis with the current time series.minimumLimit
- exclude values in the current time series below this limit. Set to HecMath.UNDEFINED to disable this option.maximumLimit
- exclude values in the current time series above this limit Set to HecMath.UNDEFINED to disable this option.- Returns:
- a paired data set containing the regression coefficients.
- Throws:
HecMathException
- if the current time series and the time series intsMathArray
are not regular interval time series with the same time interval, or if there is no concurrent data between all the time series.- See Also:
-
extractTimeSeriesDataForTimeSpecification
public HecMath extractTimeSeriesDataForTimeSpecification(String timeLevelString, String rangeString, boolean isInclusive, int intervalWindow, boolean setAsIrregular) throws HecMathException Extract data from the current regular or irregular interval time series according to the time specifications defined in the parameters.timeLevelString
defines the time level/interval for extraction ( year, month, day of the month, day of the week, or 24-hour time).rangeString
defines the interval range for data extraction applicable to the time level. For example, iftimeLevelString
is "MONTH", a valid range would be "JAN-MAR". TherangeString
variable can define a single interval value (e.g. "JAN" - select data from January only) or a beginning and ending range (e.g. "JAN-MAR" - select data for January through March).The table below shows the valid
timeLevelString
andrangeString
values.timeLevelString rangeString: Example rangeString "YEAR" Four digit year value. "1938" or "1938-1945" "MONTH" Standard 3 char abbreviation "JAN" or "JAN-MAR" for month. "DAYMON(TH)" Day of the month or "15" or "1-15 or "LASTDAY" string "16-LASTDAY" "DAYWEE(K)" Standard 3 char abbreviation "MON" or "SUN-TUE" for day of the week. "TIME" Four digit 24-hour military "2400" or "0300-0600" style clock time.
TimeSeriesMath
contains enumerated string variables which may be used fortimeLevelString
in place of the string values in the table above:Year TimeSeriesMath.LEVEL_YEAR_STRING Month TimeSeriesMath.LEVEL_DAYMONTH_STRING Day of Month TimeSeriesMath.LEVEL_MONTH_STRING Day of Week TimeSeriesMath.LEVEL_DAYWEEK_STRING 24-hour time TimeSeriesMath.LEVEL_TIME_STRING
isInclusive
determines whether the data extraction operation is either inclusive or exclusive of the specified range. For example, ifisInclusive
is true and the range is set to "JAN-MAR" for the "MONTH" time level, the extracted data will include all data in the months January through March for all the years of time series data. IfisInclusive
is false for this example, the extracted data covers the time April through December (is exclusive of data for January through March).intervalWindow
is only used when thetimeLevelString
is "TIME".intervalWindow
is the minutes before and after the time of day within which the data will be extracted.intervalWindow
effectively increases the time range at the beginning and endintervalWindow
minutes.setAsIrregular
defines whether the extracted data is saved as regular interval or irregular interval data. Most often the time series data formed by the extraction process will no longer be regular interval, andsetAsIrregular
should be set to true. SettingsetAsIrregular
to false will force an attempt to save the data as regular interval time data.- Overrides:
extractTimeSeriesDataForTimeSpecification
in classHecMath
- Parameters:
timeLevelString
- selection interval for data extraction ("YEAR", "MONTH", "DAYMON(TH)", "DAYWEE(K)" or "TIME").rangeString
- range of time interval for data extraction.isInclusive
- if true, data is extracted inclusive of the interval range, if false data is extracted exclusive of the interval rangeintervalWindow
- time window, in minutes. Only applied iftimeLevelString
is "TIME".setAsIrregular
- if true, save the time series as irregular interval time series data (recommended), if false force a save as regular interval time series data.- Returns:
- a new time series of data at selected interval range.
- Throws:
HecMathException
- if could not suscessfully interprettimeLevelString
orrangeString
.
-
generateRegularIntervalTimeSeries
public static HecMath generateRegularIntervalTimeSeries(String startTimeString, String endTimeString, String timeIntervalString, double initialValue) throws HecMathException Generate a new regular interval time series data for the specifed start time, end time, time interval and timeOffset and with all values set toinitialValue
.startTimeString
andendTimeString
are standard time window strings (e.g. "01JAN2001 0100").timeIntervalString
is a valid DSS time interval character string ( "15MIN", "1HOUR", "1DAY", etc.).timeOffsetString
defines the time offset from the standard interval time.timeOffsetString
has the form "nT", where "n" is an integer number and "T" is one of the time increments: "M(INUTES)", "D(AYS)", "H(OUR)", "W(EEKS)", "MON(THS)" or "Y(EARS)" ( characters in the parenthesis are optional ). For example, a time offset of 9 minutes would be expressed as "9M" or "9MIN".- Parameters:
startTimeString
- a standard HEC Time window string defining the time series data start date/time.endTimeString
- a standard HEC Time window string defining the time series data end date/time.timeIntervalString
- a valid DSS regular time interval string which defines the time interval of the new time series.initialValue
- the initial value for all time series points. Set to HecMath.UNDEFINED to set all values to missing.- Returns:
- A new regular interval time series set to
initialValue
. Data units and type are blank. - Throws:
HecMathException
- if the time parameter cannot be successfully interpreted.
-
generateRegularIntervalTimeSeries
public static HecMath generateRegularIntervalTimeSeries(String startTimeString, String endTimeString, String timeIntervalString, String timeOffsetString, double initialValue) throws HecMathException Generate a new regular interval time series data for the specifed start time, end time, time interval and timeOffset and with all values set toinitialValue
.startTimeString
andendTimeString
are standard time window strings (e.g. "01JAN2001 0100").timeIntervalString
is a valid DSS time interval character string ( "15MIN", "1HOUR", "1DAY", etc.).timeOffsetString
defines the time offset from the standard interval time.timeOffsetString
has the form "nT", where "n" is an integer number and "T" is one of the time increments: "M(INUTES)", "D(AYS)", "H(OUR)", "W(EEKS)", "MON(THS)" or "Y(EARS)" ( characters in the parenthesis are optional ). For example, a time offset of 9 minutes would be expressed as "9M" or "9MIN".- Parameters:
startTimeString
- a standard HEC Time window string defining the time series data start date/time.endTimeString
- a standard HEC Time window string defining the time series data end date/time.timeIntervalString
- a valid DSS regular time interval string which defines the time interval of the new time series.timeOffsetString
- the offset of the new time points from the regular interval time. This string may be a blank string or thenull
value.initialValue
- the initial value for all time series points. Set to HecMath.UNDEFINED to set all values to missing.- Returns:
- A new regular interval time series set to
initialValue
. Data units and type are blank. - Throws:
HecMathException
- if the time parameter cannot be successfully interpreted.
-
generateRegularIntervalTimeSeries
public static HecMath generateRegularIntervalTimeSeries(String startTimeString, String endTimeString, int timeIntervalMinutes, int timeOffsetMinutes, double initialValue) throws HecMathException - Parameters:
startTimeString
-endTimeString
-timeIntervalMinutes
-timeOffsetMinutes
-initialValue
-- Returns:
- Throws:
HecMathException
-
checkTimeSeriesMatch
Checks that the times in the TimeSeriesContainertsc
exactly match the times in the current time series.- Parameters:
tsc
- the hec.io.TimeSeriesContainer for testing.- Returns:
- true if the times in
tsc
exactly match the times for the current time series. - Throws:
HecMathException
- if the times intsc
do not exactly match the times for the current time series.- See Also:
-
checkTimeSeriesMath
Checks to see ifmath
is an instance of hec.hecmath.TimeSeriesMath object.- Parameters:
math
- the HecMath object for testing.- Returns:
- true if
math
is a TimeSeriesMath object. - Throws:
HecMathException
- ifmath
is empty not an instance of TimeSeriesMath.
-
checkTimeSeries
Perform basic checks on the TimeSeriesContainertsc
to ensure that there is data.- Parameters:
tsc
- the hec.io.TimeSeriesContainer for testing.- Returns:
- true if
tsc
is not empty. - Throws:
HecMathException
- iftsc
is empty or contains no valid data.- See Also:
-
isValid
Determine if the data value intsc
is valid ( not missing or is okay ) for the index locationindex
.- Parameters:
container
- a TimeSeriesContainer.index
- the array index of the value of interest.- Returns:
- true if the value and array location
tsc
is valid ( not missing or is okay ). - See Also:
-
isValid
public boolean isValid(int index) Determine if the data value at the index locationindex
in the current time series is valid ( okay or not missing ). -
copy
Create a duplicate copy of the time series object.- Specified by:
copy
in classHecMath
- Returns:
- a duplicate copy of the time series
- Throws:
HecMathException
-
copyHeaderInfo
copy basic header information from one TimeSeriesContainer to another -
findValidValue
Given a time series container and an index, look before or after that index for a valid value. Will not test for that value, only before or after! If end of array reached, then Heclib.UNDEFINED_INT returned- Parameters:
tsc
- TimeSeriesContainerindex
- intlookAfter
- boolean- Returns:
- int
-
findInterval
protected static int findInterval(int[] times, int time, int lastIndex) Find interval times array in which "time" lies in and return the index postion of the first point. times[idx] <= time < times[idx+1] -
getSortedPeaks
Deprecated.Convert data to Annual Max- Returns:
- Throws:
HecMathException
-
computeSimpleFrequency
Deprecated.used by DssVue. Any others? Deprecated use SimpleFrequencyAnalysis directly- Returns:
- Throws:
HecMathException
-
expandVerticalDatum
Returns a new TimeSeriesMathVertDatum object constructed from this object if the internal data supports it, expanding the internal data in the process- Specified by:
expandVerticalDatum
in interfaceIVerticalDatumOperations<TimeSeriesMath,
HecMathException> - Returns:
- The TimeSeriesMathVertDatum object as described above or this object. In either case this object is not modified. A copy of this object is returned if it is already a TimeSeriesMathVertDatum object any errors are thrown to the caller.
- Throws:
HecMathException
-
collapseVerticalDatum
Returns a new TimeSeriesMath object constructed from this object if the internal data supports it, collapsing the internal data in the process- Specified by:
collapseVerticalDatum
in interfaceIVerticalDatumOperations<TimeSeriesMath,
HecMathException> - Returns:
- The TimeSeriesMath object as described above or this object. In either case this object is not modified. A copy of this object is returned if it is not a TimeSeriesMathVertDatum object. Any errors will be thrown.
- Throws:
HecMathException
-
resample
public TimeSeriesMath resample(mil.army.usace.hec.metadata.Interval interval) throws HecMathException Resample a time series to a different interval- Parameters:
interval
- Desired interval- Returns:
- a new timeseriesmath object in the desired interval
- Throws:
HecMathException
- If a pure irregular interval (0) is passed in.- Since:
- 2022-07
-
generatePairedData(HecMath, boolean)