Class PairedDataMath
- All Implemented Interfaces:
IRating
,IVerticalDatumOperations<PairedDataMath,
,HecMathException> Constants
- Direct Known Subclasses:
PairedDataMathVertDatum
PairedDataMath
class wraps around a
hec.io.PairedDataContainer
(paired data) and
provides the user the capability to perform a set of
high level operations. For example, if the PairedDataMath object
contains paired data in the form of a rating table,
PairedDataMath can be used to derive a flow time series from
a stage time series:
tsFlow = rtable.ratingTableInterpolation( tsStage )
- See Also:
-
Field Summary
FieldsFields inherited from class hec.hecmath.HecMath
_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()
Create a new paired data set with y-values computed from the absolute values of the current paired data y-values.add
(double constant) Add a constant value to the y-values in current paired data set.applyMultipleLinearRegression
(String startTimeString, String endTimeString, TimeSeriesMath[] tsMathArray, double minimumLimit, double maximumLimit) Apply the regression coefficients contained in the paired data set to the set of time series intsMathArray
to develop a new time series.boolean
See if the unit system can be successfully determined from the units string.static boolean
Perform basic checks on the PairedDataContainerpdc
to ensure that there is data.static boolean
checkPairedDataCurve
(PairedDataContainer pdc, int curveNumber) Perform basic checks on the PairedDataContainerpdc
to ensure that data is available for the curvecurveNumber
.Returns a new PairedDataMath object constructed from this object if the internal data supports it, collapsing the internal data in the processconicInterpolation
(HecMath tsMath, String inputType, String outputType, double storageScaleFactor) Use the conic interpolation table in the current paired data set to develop a new time series from the interpolation oftsMath
.Convert values to English units.Convert values to metric (SI) units.copy()
Create a duplicate copy of the paired data set.correlationCoefficients
(HecMath tsMath) cos()
Create a new paired data set with y-values computed from the cosine of the current paired data y-values.divide
(double constant) Divide the y-values in current paired data set by a constant value.Returns a new PairedDataMathVertDatum object constructed from this object if the internal data supports it, expanding the internal data in the processexponentiation
(double constant) Raise y-values in current paired data set to the power ofconstant
.generateDataPairs
(HecMath pdMath, double buffer) This method will compare the two paired data containers and create a PairedDataMath object that has all of the data points that are coincident in x ordinateslong[]
Retrieves the creation dates of the rating in milliseconds, one for each contained ratinggetData()
Copy the current PairedDataContainer data in the PairedDataMath object intocontainer
.void
getData
(DataContainer container) Copy the current PairedDataContainer data in the PairedDataMath object intocontainer
.String[]
Retrieves the data ratingUnits.long
Retrieves the default value time.long[]
Retrieves the effective dates of the rating in milliseconds, one for each contained ratingint
Retrieves the number of independent parameters for this rating.getName()
Retrieves the name of the rating.double[][]
Retrieves the min and max value for each parameter of the rating, in the current ratingUnits.double[][]
getRatingExtents
(long ratingTime) Retrieves the min and max value for each parameter of the rating, in the current ratingUnits.String[]
Retrieves the rating parameters.long
Retrieves the rating time.String[]
Retrieves the rating ratingUnits.int
Returns the standardized units label for the paired data y-values.getUnits()
Returns the units label of the y-values for the current paired data set.interpolate
(double[] xarray, boolean linear, boolean doExtrapolation) Resample the xinverse()
Create a new paired data set with y-values computed from 1 divided by current paired data y-values.boolean
Determine if the paired data is in English units.boolean
isMetric()
Determine if the paired data is in metric (SI) units.boolean
isValid
(int index) Determine if the data value at the array locationindex
in the current paired data set is valid ( okay or not missing ).log()
Create a new paired data set with y-values computed from the natural log of the current paired data y-values.log10()
Create a new paired data set with y-values computed from the log base 10 of the current paired data y-values.protected TimeSeriesContainer[]
makeTscs
(long[] valTimes, double[][] indVals) Makes dummy TimeSeriesContainer objects bridge IRating methods to HecMath methodsmergePairedDataSets
(HecMath pdMathIn) Merge two paired data sets.modifiedPulsRouting
(TimeSeriesMath tsMath, int numberSubreaches, double muskingumX) Use the storage-discharge function in the current paired data set to route the regular interval time seriestsMath
by the Modified Puls hydrologic routing method.multiply
(double constant) Multiply the y-values in current paired data set by a constant value.pairedDataOps
(boolean reorder, int resampleSkip, boolean swapXY, int[] deleteCurves, int switchXYAxis) Paired Data Operations -pairedDataOps packages several utility operations on paired data curves.Compute a polynomial transformation oftsMath
using the polynomial coefficients defined in the current paired data set.Compute a polynomial transformation with integral oftsMath
using the polynomial coefficients defined in the current paired data set.double
rate
(double indVal) Finds the dependent value for a single independent value.double[]
rate
(double[] indVals) Finds multiple dependent values for multiple single independent values.double[]
rate
(double[][] indVals) Finds multiple dependent values for multiple sets of independent values.double[]
rate
(long[] valTimes, double[] indVals) Finds multiple dependent values for multiple single independent and times.double[]
rate
(long[] valTimes, double[][] indVals) Finds multiple dependent values for multiple sets of independent values and times.double
rate
(long valTime, double indVal) Finds the dependent value for a single independent value at a specified time.double[]
rate
(long valTime, double[] indVals) Finds multiple dependent values for multiple single independent values at a specified time.double[]
rate
(long valTime, double[][] indVals) Finds multiple dependent values for multiple sets of independent values at a specified time.rate
(TimeSeriesMath tsm) Rates the values in the specified TimeSeriesMath to generate a resulting TimeSeriesMath.rate
(TimeSeriesMath[] tsms) Rates the values in the specified TimeSeriesMath objects to generate a resulting TimeSeriesMath.rate
(TimeSeriesContainer tsc) Rates the values in the specified TimeSeriesContainer to generate a resulting TimeSeriesContainer.rate
(TimeSeriesContainer[] tscs) Rates the values in the specified TimeSeriesContainer objects to generate a resulting TimeSeriesContainer.double
rateOne
(double... indVals) Finds the dependent value for a set of independent values.double
rateOne
(long valTime, double... indVals) Finds the dependent value for a set of independent values.double
rateOne2
(double[] indVals) Finds the dependent value for a set of independent values.double
rateOne2
(long valTime, double[] indVals) Finds the dependent value for a set of independent values.Use the rating table in the current paired data set to develop a new time series from the rating table interpolation oftsMath
.replaceSpecificValues
(HecDouble from, HecDouble to) replaceValuesInRange
(HecDouble min, HecDouble max, HecDouble to) void
Resets the default value time.void
Resets (un-sets) the rating time.double
reverseRate
(double depVal) Finds the independent value for a single independent value.double[]
reverseRate
(double[] depVals) Finds multiple independent values for multiple single independent values.double[]
reverseRate
(long[] valTimes, double[] depVals) Finds multiple independent values for multiple single independent and times.double
reverseRate
(long valTime, double depVal) Finds the independent value for a single independent value at a specified time.double[]
reverseRate
(long valTime, double[] depVals) Finds multiple independent values for multiple single independent values at a specified time.Rates the values in the specified TimeSeriesMath to generate a resulting TimeSeriesMath.Rates the values in the specified TimeSeriesContainer to generate a resulting TimeSeriesContainer.Use the rating table in the current paired data set to develop a new time series from the reverse rating table interpolation oftsMath
.round()
Create a new paired data set with the current paired data y-values rounded to the nearest whole number.roundOff
(int digitsPrecision, int powerOfTensPlace) Derive a new paired data set with y-values rounded to the specified precision and/or power of tens place.screenWithMaxMin
(double minValueLimit, double maxValueLimit, double changeLimit, boolean setInvalidToMissingValue, String qualityFlagForInvalidValue) strictly looks at min/max valuevoid
setCurve
(int curveNumber) Select, by curve number, the paired data curve for performing subsequent arithmetic operations or math functions.void
Select, by curve label, the paired data curve for performing subsequent arithmetic operations or math functions.void
setData
(DataContainer container) Set the PairedDataContainer data for the current PairedDataMath object.void
setDataUnits
(String[] units) Sets the data ratingUnits.void
setDefaultValueTime
(long defaultValueTime) Sets the default value time.void
Sets the name of the ratingvoid
setRatingTime
(long ratingTime) Sets the rating time.void
Set the y-units label for the paired data set.sin()
Create a new paired data set with y-values computed from the sine of the current paired data y-values.sqrt()
Create a new paired data set with y-values computed from the square root of the current paired data y-values.subtract
(double constant) Subtract a constant value from the y-values in current paired data set.tan()
Create a new paired data set with y-values computed from the tangent of the current paired data y-values.transformWithFunction
(ScalarOperable transformer) truncate()
Create a new paired data set with the current paired data y-values truncated to whole numbers.twoVariableRatingTableInterpolation
(TimeSeriesMath tsMathX, TimeSeriesMath tsMathZ) Use the current paired data set to create a new time series by the two-variable rating table interpolation of the time seriestsMathX
andtsMathZ
.Methods inherited from class hec.hecmath.HecMath
accumulation, applyMultipleLinearRegression, bisearch, bisearch, centeredMovingAverage, checkContainer, convertToIrregular, createInstance, createInstance, cyclicAnalysis, decayingBasinWetnessParameter, durationAnalysis, durationAnalysis, durationAnalysis, durationAnalysis, estimateForMissingPrecipValues, estimateForMissingValues, extractTimeSeriesDataForTimeSpecification, flowAccumulatorGageProcessor, forwardMovingAverage, generateDataPairs, generatePairedData, generateRegularIntervalTimeSeries, generateRegularIntervalTimeSeries, generateRegularIntervalTimeSeries, getFunctionName, getPath, hunt, interpolateDataAtRegularInterval, isMissing, isValid, kurtosisCoefficient, lastValidDate, lastValidValue, max, maxDate, mean, med, mergeTimeSeries, min, minDate, mode, modifiedPulsRouting, multipleLinearRegression, multipleRegression, muskingumRouting, numberMissingValues, numberValidValues, olympicSmoothing, p1, p10, p2, p20, p25, p5, p75, p80, p90, p95, p98, p99, periodConstants, polynomialTransformation, polynomialTransformationWithIntegral, ratingTableInterpolation, reverseRatingTableInterpolation, roundOffValue, screenWithForwardMovingAverage, screenWithMaxMin, setDPart, setEPart, setLocation, setParameterPart, setPathname, setTimeInterval, setVersion, setWatershed, shiftAdjustment, shiftInTime, skewCoefficient, snapToRegularInterval, standardDeviation, standardNormalDeviate, straddleStaggerRouting, successiveDifferences, sum, timeDerivative, transformTimeSeries, transformTimeSeries, transformTimeSeries, transformTimeSeries, twoVariableRatingTableInterpolation
-
Field Details
-
_curveNumber
protected int _curveNumber
-
-
Constructor Details
-
PairedDataMath
public PairedDataMath() -
PairedDataMath
- Throws:
HecMathException
-
-
Method Details
-
setData
Set the PairedDataContainer data for the current PairedDataMath object. The current PairedDataMath will use a copy ofcontainer
.- Specified by:
setData
in classHecMath
- Parameters:
container
- the PairedDataContainer data to be used by this PairedDataMath object.- Throws:
HecMathException
- ifcontainer
is null or not of type PairedDataContainer.
-
getData
Copy the current PairedDataContainer data in the PairedDataMath object intocontainer
.- Specified by:
getData
in classHecMath
- Parameters:
container
- the PairedDataContainer to receive the copy of paired data from this PairedDataMath object.- Throws:
HecMathException
-
getData
Copy the current PairedDataContainer data in the PairedDataMath object intocontainer
.- Specified by:
getData
in classHecMath
- Returns:
- a copy of the PairedDataContainer held in the current PairedDataMath object.
- Throws:
HecMathException
-
setCurve
Select, by curve label, the paired data curve for performing subsequent arithmetic operations or math functions.A paired data set may contains more than one set of y-values. However, a user may wish to modify only one curve of the data set. For example, using the function "add( 2.0 )" would by default add 2.0 to all y-values for all curves.
setCurve
can be used to limit the operation to just one selected set of y-values.The function searches the paired data set list of curve labels for a match to
curveName
. If a match is found, that curve is set as the selected curve.- Overrides:
setCurve
in classHecMath
- Parameters:
curveName
- the curve label to set as the selected curve.- Throws:
HecMathException
- See Also:
-
setCurve
Select, by curve number, the paired data curve for performing subsequent arithmetic operations or math functions.A paired data set may contains more than one set of y-values. However, a user may wish to modify only one curve of the data set. For example, using the function "add( 2.0 )" would by default add 2.0 to all y-values for all curves.
setCurve
can be used to limit the operation to just one selected set of y-values.The active curve is set to
curveNumber
. Curve numbering with 0. To set all curve active, setcurveNumber
to -1. By default, all curves are set active.- Overrides:
setCurve
in classHecMath
- Parameters:
curveNumber
- the selected curve number- Throws:
HecMathException
- See Also:
-
getSelectedCurve
public int getSelectedCurve()- Overrides:
getSelectedCurve
in classHecMath
-
add
- Overrides:
add
in classHecMath
- Throws:
HecMathException
-
subtract
- Overrides:
subtract
in classHecMath
- Throws:
HecMathException
-
divide
- Overrides:
divide
in classHecMath
- Throws:
HecMathException
-
multiply
- Overrides:
multiply
in classHecMath
- Throws:
HecMathException
-
add
Add a constant value to the y-values in current paired data set.- Overrides:
add
in classHecMath
- Parameters:
constant
- the value to be added to the y-values in the current paired data set.- Returns:
- a new paired data set resulting from the operation.
- Throws:
HecMathException
- See Also:
-
subtract
Subtract a constant value from the y-values in current paired data set.- Overrides:
subtract
in classHecMath
- Parameters:
constant
- the value to be subtracted from the y-values in the current paired data set.- Returns:
- a new paired data set resulting from the operation.
- Throws:
HecMathException
- See Also:
-
multiply
Multiply the y-values in current paired data set by a constant value.- Overrides:
multiply
in classHecMath
- Parameters:
constant
- the value to multiply the y-values in the current paired data set.- Returns:
- a new paired data set resulting from the operation.
- Throws:
HecMathException
- See Also:
-
divide
Divide the y-values in current paired data set by a constant value.- Overrides:
divide
in classHecMath
- Parameters:
constant
- the value to divide the y-values in the current paired data set.- Returns:
- a new paired data set resulting from the operation.
- Throws:
HecMathException
- See Also:
-
replaceSpecificValues
- Overrides:
replaceSpecificValues
in classHecMath
- Throws:
HecMathException
-
replaceValuesInRange
public HecMath replaceValuesInRange(HecDouble min, HecDouble max, HecDouble to) throws HecMathException - Overrides:
replaceValuesInRange
in classHecMath
- Throws:
HecMathException
-
exponentiation
Raise y-values in current paired data set to the power ofconstant
.- Overrides:
exponentiation
in classHecMath
- Parameters:
constant
- the exponent value.- Returns:
- a new paired data set resulting from the operation.
- Throws:
HecMathException
- See Also:
-
transformWithFunction
- Overrides:
transformWithFunction
in classHecMath
- Throws:
HecMathException
-
sqrt
Create a new paired data set with y-values computed from the square root of the current paired data y-values. y-values of the original data set less than 0.0 will be set to missing in the new data set.- Overrides:
sqrt
in classHecMath
- Returns:
- A new paired data set with y-values the square root of the original y-values.
- Throws:
HecMathException
- See Also:
-
log
Create a new paired data set with y-values computed from the natural log of the current paired data y-values. y-values of the original data set less than or equal to 0.0 will be set to missing in the new data set.- Overrides:
log
in classHecMath
- Returns:
- A new paired data set with y-values the natural log of the original y-values.
- Throws:
HecMathException
- See Also:
-
log10
Create a new paired data set with y-values computed from the log base 10 of the current paired data y-values. y-values of the original data set less than or equal to 0.0 will be set to missing in the new data set.- Overrides:
log10
in classHecMath
- Returns:
- A new paired data set with y-values the log base 10 of the original y-values.
- Throws:
HecMathException
-
abs
Create a new paired data set with y-values computed from the absolute values of the current paired data y-values.- Overrides:
abs
in classHecMath
- Returns:
- A new paired data set with y-values the absolute value of the original y-values.
- Throws:
HecMathException
-
truncate
Create a new paired data set with the current paired data y-values truncated to whole numbers.- Overrides:
truncate
in classHecMath
- Returns:
- A new paired data set with y-values truncated to whole number.
- Throws:
HecMathException
- See Also:
-
round
Create a new paired data set with the current paired data y-values rounded to the nearest whole number.- Overrides:
round
in classHecMath
- Returns:
- A new paired data set with y-values rounded to the nearest whole number.
- Throws:
HecMathException
-
sin
Create a new paired data set with y-values computed from the sine of the current paired data y-values.- Overrides:
sin
in classHecMath
- Returns:
- A new paired data set with y-values the sine of the original y-values.
- Throws:
HecMathException
-
cos
Create a new paired data set with y-values computed from the cosine of the current paired data y-values.- Overrides:
cos
in classHecMath
- Returns:
- A new paired data set with y-values the cosine of the original y-values.
- Throws:
HecMathException
- See Also:
-
tan
Create a new paired data set with y-values computed from the tangent of the current paired data y-values. Values of the original data set which have a cosine value of zero are set to missing in the new data set.- Overrides:
tan
in classHecMath
- Returns:
- A new paired data set with y-values the tangent of the original y-values.
- Throws:
HecMathException
-
inverse
Create a new paired data set with y-values computed from 1 divided by current paired data y-values. Values of the original data set which are zero are set to missing in the new data set.- Overrides:
inverse
in classHecMath
- Returns:
- A new paired data set with y-values the tangent of the original y-values.
- Throws:
HecMathException
-
roundOff
Derive a new paired data set with y-values 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
- 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 paired data set composed of y-values of the current paired data set rounded to the specified precision.
- Throws:
HecMathException
-
convertToMetricUnits
Convert values to metric (SI) units. Determination of the unit system will be based upon the y units and parameter type. Both x-values and y-values under go conversion.- Specified by:
convertToMetricUnits
in classHecMath
- Returns:
- A new paired data set with x and y values converted to metric units. If the original paired data set is already in metric units, will return a copy of the original paired data set.
- Throws:
HecMathException
- if the unit conversion could not be performed.
-
convertToEnglishUnits
Convert values to English units. Determination of the unit system will be based upon the y units and parameter type. Both x-values and y-values under go conversion.- Specified by:
convertToEnglishUnits
in classHecMath
- Returns:
- A new paired data set with x and y values converted to English units. If the original paired data set is already in English units, will return a copy of the original paired data set.
- Throws:
HecMathException
- if the unit conversion could not be performed.
-
isMetric
Determine if the paired data is in metric (SI) units. Determination of the unit system will be based upon the y units and parameter type.- Specified by:
isMetric
in classHecMath
- Returns:
- true if the data units are English, otherwise returns false.
- Throws:
HecMathException
- if the unit system cannot be determined.
-
isEnglish
Determine if the paired data is in English units. Determination of the unit system will be based upon the y units and parameter type.- Specified by:
isEnglish
in classHecMath
- Returns:
- true if the data 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 paired data set. -
getStandardUnits
Returns the standardized units label for the paired data y-values. The y-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 different data sets and for unit conversions. For example, "inch", "inches" or "INCHES" are changed to "in".- Overrides:
getStandardUnits
in classHecMath
- Returns:
- y-units label converted to the standardized form defined in
hec.heclib.util.unitConversion.def
-
setUnits
Set the y-units label for the paired data set. -
mergePairedDataSets
Merge two paired data sets.Will derive a new paired data set by merging curves in the current and parameter,
pdMathIn
, paired data sets.The x-ordinate values for the two data sets must be identical. Curve(s) from
pdMathIn
are appended on to the set of curves in the current paired data set. Either one selected curve or all curves frompdMathIn
are copied over to the new paired data set. UsesetCurve(int)
orsetCurve(String)
to select the curve inpdMathIn
for merging. The selection status can be checked withgetSelectedCurve()
.- Overrides:
mergePairedDataSets
in classHecMath
- Parameters:
pdMathIn
- a paired data set for merging with the current paired data set.- Returns:
- A new paired data set containing the paired data curves from the two paired data sets.
- Throws:
HecMathException
- if x-ordinates for the two paired data sets are not identical.
-
conicInterpolation
public TimeSeriesMath conicInterpolation(HecMath tsMath, String inputType, String outputType, double storageScaleFactor) throws HecMathException Use the conic interpolation table in the current paired data set to develop a new time series from the interpolation oftsMath
.The paired data set represents a table of Elevation-Area. However, the first paired data values contain the initial conic depth and the storage for the first elevation in the table. If the initial conic depth is undefined, the function will calculate a value. Elevation-Area values in the table are in ascending order.
tsMath
is either a time series of reservoir elevation or storage, and is specified by settinginputType
as "S(TORAGE)" or "E(LEVATION)". The desired output time series type is similarly set usingoutputType
. The valid settings foroutType
are "S(TORAGE)", "E(LEVATION)" and "A(REA)".inputType
andoutputType
must not be the same.storageScaleFactor
is an optional parameter used to scale input (by multiplying) and output (by dividing) storage values. For example, if the area in the conic interpolation table is expressed in sq.ft.,storageScaleFactor
could be set to 43560 to convert the storage output to acre-ft.Parameter type in the new time series is set according to
outputType
. If the output time series values are elevation, the time series units are set to the paired data x-units label. If the output time series values are area the time series units are set to the paired data y-units label. If the output is storage, the units are not set and should be set by the user with the setUnits function.- Overrides:
conicInterpolation
in classHecMath
- Parameters:
tsMath
- the input time series of elevation or storage.inputType
- parameter type for input time series, "S(TORAGE)" or "E(LEVATION)".outputType
- parameter type for output time series, "S(TORAGE)", "E(LEVATION)", or "A(REA)".- Returns:
- The interpolated output time series
- Throws:
HecMathException
- ifoutType
oroutputType
are not correctly defined.- See Also:
-
ratingTableInterpolation
Use the rating table in the current paired data set to develop a new time series from the rating table interpolation oftsMath
. The rating table may be Log-Log.The paired data set should be created with the rating table option to set values for
datum, shift
, andoffset
inPairedDataContainer
. By default these values are 0.0. The shift is added to, and the datum subtracted from all input time series values. If the rating table is Log-Log, the table x-values are adjusted by subtracting the offset. Units and parameter type in the new time series are set to the y-units label and parameter type of the current paired data set. All other names and labels are copied over fromtsMath
.- Parameters:
tsMath
- the input time series for rating table interpolation.- Returns:
- The interpolated output time series
- Throws:
HecMathException
-
reverseRatingTableInterpolation
public TimeSeriesMath reverseRatingTableInterpolation(TimeSeriesMath tsMath) throws HecMathException Use the rating table in the current paired data set to develop a new time series from the reverse rating table interpolation oftsMath
. The rating table may be Log-Log.The paired data set should be created with the rating table option to set values for
datum, shift
, andoffset
inPairedDataContainer
. By default these values are 0.0. The shift is subtracted from, and the datum added to all input time series values. If the rating table is Log-Log, the table x-values are adjusted by subtracting the offset. Units and parameter type in the new time series are set to the x-units label and parameter type of the current paired data set. All other names and labels are copied over fromtsMath
.- Parameters:
tsMath
- the input time series for reverse rating table interpolation.- Returns:
- The interpolated output time series
- Throws:
HecMathException
-
translateXY
- Throws:
HecMathException
-
interpolate
public PairedDataMath interpolate(double[] xarray, boolean linear, boolean doExtrapolation) throws HecMathException Resample the x- Parameters:
xarray
- double[]linear
- booleandoExtrapolation
- boolean- Throws:
HecMathException
-
twoVariableRatingTableInterpolation
public TimeSeriesMath twoVariableRatingTableInterpolation(TimeSeriesMath tsMathX, TimeSeriesMath tsMathZ) throws HecMathException Use the current paired data set to create a new time series by the two-variable rating table interpolation of the time seriestsMathX
andtsMathZ
. For two-variable rating table interpolation, the current paired data set should have more than one curve (multiple sets of y-values). The labels of the paired data curves are interpreted as values for interpolating values oftsMathZ
.In performing the double interpolation, two bounding curves (using the label values of the curves) of the paired data set are found which bracket the time series value from
tsMathZ
. Interpolation between the curves is done at the x-oridinate location defined by the time series value fromtsMathX
.No extrapolation is performed. If time series values from
tsMathX
ortsMathZ
are outside the range bounded by the paired data, the new time series value is set to missing.Units and paramter type in the new time series are set to the y-units label and parameter of the current paired data set. All other names and labels are copied over from
tsMathX
.- Parameters:
tsMathX
- input time series interpreted as x-ordinate valuestsMathZ
- input time series interpreted as z-ordinate values, (value defined by the paired data curve labels).- Returns:
- The interpolated output time series.
- Throws:
HecMathException
- iftsMathX
andtsMathZ
are not for identical times.
-
polynomialTransformation
Compute a polynomial transformation oftsMath
using the polynomial coefficients defined in the current paired data set. A new time series is computed using the polynomial coefficients, Bn, and the input time series, tsIn, according to:tsNew(i) = B1*tsIn(i) + B2*tsIn(i)**2 + ... + Bn*tsIn(i)**n
Before the above equation is applied, values in tsIn are first adjusted by subtracting off thedatum
value for the paired data set (seePairedDataContainer
). If a value in the input time series is missing, the value remains missing in the new time series.The units label and parameter type in the new time series are the same as in
tsMath
.- Parameters:
tsMath
- the input time series.- Returns:
- a new time series representing the polynomial transform of
tsMath
. - Throws:
HecMathException
- See Also:
-
polynomialTransformationWithIntegral
public TimeSeriesMath polynomialTransformationWithIntegral(TimeSeriesMath tsMath) throws HecMathException Compute a polynomial transformation with integral oftsMath
using the polynomial coefficients defined in the current paired data set. A new time series is computed using the polynomial coefficients, Bn, and the input time series, tsIn, according to:tsNew(i) = (B1/2)*tsIn(i)**2 + (B2/3)*tsIn(i)**3 + ... + (Bn/(n+1))*tsIn(i)**(n+1)
Before the above equation is applied, values in tsIn are first adjusted by subtracting off thedatum
value for the paired data set (seePairedDataContainer
). If a value in the input time series is missing, the value remains missing in the new time series.The units label and parameter type in the new time series are the same as in
tsMath
.- Parameters:
tsMath
- the input time series.- Returns:
- a new time series representing the polynomial transform of
tsMath
. - Throws:
HecMathException
- See Also:
-
applyMultipleLinearRegression
public TimeSeriesMath applyMultipleLinearRegression(String startTimeString, String endTimeString, TimeSeriesMath[] tsMathArray, double minimumLimit, double maximumLimit) throws HecMathException Apply the regression coefficients contained in the paired data set to the set of time series intsMathArray
to develop a new time series.The regression coefficients can be used to generate a new regular interval time series based on the general linear regression equation:
tsNew(i) = B0 + B1*TS1(i) + B2*TS2(i) + B3*TS3(i) ...
where Bn are the set of regression coefficients and TSn are the time series contained intsMathArray
.Typically the regression coefficients are developed using the function,
TimeSeriesMath.multipleRegression(HecMath[] tsMathArray, double minimumLimit, double maximumLimit)
. To correctly construct the new time series, the time series intsMathArray
must be in the same order as in the call toTimeSeriesMath.multipleRegression()
so that the right regression coefficient is applied to the right time series.The time series in
tsMathArray
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, the value in the new time series is set to missing. If the computed time series value is less thanminimumLimit
or greater thanmaximumLimit
the value is reset to missing.Names, parameter type and unit labels for the new time series are copied over from the first time series in
tsMathArray
. The "Version" in the new time series is set to "COMPUTED".- Parameters:
tsMathArray
- an array of time series objects.minimumLimit
- set to missing values in the new time series if the computed value is below this limit. Set to HecMath.UNDEFINED to disable this option.maximumLimit
- set to missing values in the new time series if the computed value is above this limit. Set to HecMath.UNDEFINED to disable this option.- Returns:
- a new time series computed from the regression coefficients and the
time series in
tsMathArray
. - Throws:
HecMathException
- if the time series intsMathArray
are not regular interval time series, all with the same time interval, or if there is no concurrent data between the time series; or if the number of regression coefficients in not equal to the number of time series + 1.- See Also:
-
modifiedPulsRouting
public TimeSeriesMath modifiedPulsRouting(TimeSeriesMath tsMath, int numberSubreaches, double muskingumX) throws HecMathException Use the storage-discharge function in the current paired data set to route the regular interval time seriestsMath
by the Modified Puls hydrologic routing method.- Parameters:
tsMath
- the time series for routing.numberSubreaches
- Number of routing subreaches.muskingumX
- Muskingum "X" parameter, between 0.0 and 0.5.- Returns:
- The routed time series
- Throws:
HecMathException
- IftsMath
is not a regular interval time series, or if values for numberSubreaches or muskingumX are invalid; or if the current paired data set is not a storage-flow table with ascending x and y values.
-
pairedDataOps
public PairedDataMath pairedDataOps(boolean reorder, int resampleSkip, boolean swapXY, int[] deleteCurves, int switchXYAxis) throws HecMathException Paired Data Operations -pairedDataOps packages several utility operations on paired data curves. Generally, only one operation should be preformed at a time. However, if desired, the order of the operations is: 1) Reorder in ascending; 2) Delete Curve(s); 3) Re-sample; 4) Swap parameters, and 5) Setting the parameter associated with the horizontal axis.- Parameters:
reorder
- when true sorts primary axis ascending, removing duplicates if neededresampleSkip
- reduces the number of points by skipping. for example if resampleSkip is 2 then skip every other point.swapXY
- when true swaps (x,y) to (y,x) also swaps units, and labelsdeleteCurves
- array of curve indexes to deleteswitchXYAxis
- 0 - n/a, 1=switch , 2=no switch (for plotting)- Returns:
- returns PairedDataMath
- Throws:
HecMathException
-
checkPairedData
Perform basic checks on the PairedDataContainerpdc
to ensure that there is data.- Parameters:
pdc
- the hec.io.PairedDataContainer for testing.- Returns:
- true if
pdc
is not empty. - Throws:
HecMathException
- ifpdc
is empty or contains no valid data.- See Also:
-
checkPairedDataCurve
public static boolean checkPairedDataCurve(PairedDataContainer pdc, int curveNumber) throws HecMathException Perform basic checks on the PairedDataContainerpdc
to ensure that data is available for the curvecurveNumber
.- Parameters:
pdc
- the hec.io.TimeSeriesContainer for testing.- Returns:
- true if there is data for curve
curveNumber
. - Throws:
HecMathException
- if there is no data forcurveNumber
.- See Also:
-
isValid
public boolean isValid(int index) Determine if the data value at the array locationindex
in the current paired data set is valid ( okay or not missing ). If the paired data set is comprised of more than one y-value curve, the selected curve number must first be set. -
copy
Create a duplicate copy of the paired data set.- Specified by:
copy
in classHecMath
- Returns:
- a duplicate copy of the paired data set
- Throws:
HecMathException
-
getName
Description copied from interface:IRating
Retrieves the name of the rating. -
setName
Description copied from interface:IRating
Sets the name of the rating- Specified by:
setName
in interfaceIRating
- Parameters:
name
- The new name of the rating- Throws:
RatingException
-
getRatingParameters
Description copied from interface:IRating
Retrieves the rating parameters.- Specified by:
getRatingParameters
in interfaceIRating
- Returns:
- The independent and dependent parameters of the rating
-
getRatingUnits
Description copied from interface:IRating
Retrieves the rating ratingUnits. These are the ratingUnits of the underlying rating, which may be different than the data ratingUnits, as long as valid unit conversions exist between rating ratingUnits and data ratingUnits.- Specified by:
getRatingUnits
in interfaceIRating
- Returns:
- The ratingUnits, one unit for each parameter
-
getDataUnits
Description copied from interface:IRating
Retrieves the data ratingUnits. These are the ratingUnits expected for independent parameters and the unit produced for the dependent parameter. If the underlying rating uses different ratingUnits, the rating must perform unit conversions.- Specified by:
getDataUnits
in interfaceIRating
- Returns:
- The ratingUnits identifier, one unit for each parameter
-
setDataUnits
Description copied from interface:IRating
Sets the data ratingUnits. These are the ratingUnits expected for independent parameters and the unit produced for the dependent parameter. If the underlying rating uses different ratingUnits, the rating must perform unit conversions.- Specified by:
setDataUnits
in interfaceIRating
- Parameters:
units
- The ratingUnits, one unit for each parameter- Throws:
RatingException
-
getDefaultValueTime
public long getDefaultValueTime()Description copied from interface:IRating
Retrieves the default value time. This is used for rating values that have no inherent times.- Specified by:
getDefaultValueTime
in interfaceIRating
- Returns:
- The default value time
-
setDefaultValueTime
public void setDefaultValueTime(long defaultValueTime) Description copied from interface:IRating
Sets the default value time. This is used for rating values that have no inherent times.- Specified by:
setDefaultValueTime
in interfaceIRating
- Parameters:
defaultValueTime
- The default value time in Java milliseconds
-
resetDefaultValuetime
public void resetDefaultValuetime()Description copied from interface:IRating
Resets the default value time. This is used for rating values that have no inherent times.- Specified by:
resetDefaultValuetime
in interfaceIRating
-
getRatingTime
public long getRatingTime()Description copied from interface:IRating
Retrieves the rating time. This rate values at a time in the past. No rating information with a creation date later than the rating time will be used to rate values.- Specified by:
getRatingTime
in interfaceIRating
- Returns:
- The rating time in Java milliseconds
-
setRatingTime
public void setRatingTime(long ratingTime) Description copied from interface:IRating
Sets the rating time. This rate values at a time in the past. No rating information with a creation date later than the rating time will be used to rate values.- Specified by:
setRatingTime
in interfaceIRating
- Parameters:
ratingTime
- The rating time in Java milliseconds
-
resetRatingTime
public void resetRatingTime()Description copied from interface:IRating
Resets (un-sets) the rating time.- Specified by:
resetRatingTime
in interfaceIRating
-
rate
Description copied from interface:IRating
Finds the dependent value for a single independent value. The rating must be for a single independent parameter.- Specified by:
rate
in interfaceIRating
- Parameters:
indVal
- The independent value to rate.- Returns:
- The dependent value
- Throws:
RatingException
-
rateOne
Description copied from interface:IRating
Finds the dependent value for a set of independent values. The rating must be for as many independent parameters as there are arguments.- Specified by:
rateOne
in interfaceIRating
- Parameters:
indVals
- The independent parameters to rate- Returns:
- The dependent value
- Throws:
RatingException
-
rateOne2
Description copied from interface:IRating
Finds the dependent value for a set of independent values. The rating must be for as many independent parameters as there are arguments.- Specified by:
rateOne2
in interfaceIRating
- Parameters:
indVals
- The independent parameters to rate- Returns:
- The dependent value
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Finds multiple dependent values for multiple single independent values. The rating must be for a single independent parameter.- Specified by:
rate
in interfaceIRating
- Parameters:
indVals
- The independent values to rate- Returns:
- The dependent values
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Finds multiple dependent values for multiple sets of independent values. The rating must be for as many independent parameters as the length of each independent parameter set.- Specified by:
rate
in interfaceIRating
- Parameters:
indVals
- The independent values to rate. Each set of independent values must be the same length.- Returns:
- The dependent values
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Finds the dependent value for a single independent value at a specified time. The rating must be for a single independent parameter.- Specified by:
rate
in interfaceIRating
- Parameters:
valTime
- The time associated with the value to rate, in Java millisecondsindVal
- The independent value to rate- Returns:
- The dependent value
- Throws:
RatingException
-
rateOne
Description copied from interface:IRating
Finds the dependent value for a set of independent values. The rating must be for as many independent parameters as there are arguments.- Specified by:
rateOne
in interfaceIRating
- Parameters:
valTime
- The time associated with the set of value to rate, in Java millisecondsindVals
- The independent parameters to rate- Returns:
- The dependent value
- Throws:
RatingException
-
rateOne2
Description copied from interface:IRating
Finds the dependent value for a set of independent values. The rating must be for as many independent parameters as there are arguments.- Specified by:
rateOne2
in interfaceIRating
- Parameters:
valTime
- The time associated with the set of value to rate, in Java millisecondsindVals
- The independent parameters to rate- Returns:
- The dependent value
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Finds multiple dependent values for multiple single independent values at a specified time. The rating must be for a single independent parameter.- Specified by:
rate
in interfaceIRating
- Parameters:
valTime
- The time associated with the values to rate, in Java millisecondsindVals
- The independent values to rate- Returns:
- The dependent values
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Finds multiple dependent values for multiple single independent and times. The rating must be for a single independent parameter.- Specified by:
rate
in interfaceIRating
- Parameters:
valTimes
- The times associated with the values to rate, in Java millisecondsindVals
- The independent values to rate- Returns:
- The dependent values
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Finds multiple dependent values for multiple sets of independent values at a specified time. The rating must be for as many independent parameters as the length of each independent parameter set.- Specified by:
rate
in interfaceIRating
- Parameters:
valTime
- The time associated with the values to rate, in Java millisecondsindVals
- The independent values to rate. Each set of independent values must be the same length.- Returns:
- The dependent values
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Finds multiple dependent values for multiple sets of independent values and times. The rating must be for as many independent parameters as the length of each independent parameter set.- Specified by:
rate
in interfaceIRating
- Parameters:
valTimes
- The time associated with the values to rate, in Java millisecondsindVals
- The independent values to rate. Each set of independent values must be the same length.- Returns:
- The dependent values
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Rates the values in the specified TimeSeriesContainer to generate a resulting TimeSeriesContainer. The rating must be for a single independent parameter.- Specified by:
rate
in interfaceIRating
- Parameters:
tsc
- The TimeSeriesContainer of independent values.- Returns:
- The TimeSeriesContainer of dependent values.
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Rates the values in the specified TimeSeriesContainer objects to generate a resulting TimeSeriesContainer. The rating must be for as many independent parameters as the length of tscs.- Specified by:
rate
in interfaceIRating
- Parameters:
tscs
- The TimeSeriesContainers of independent values, one for each independent parameter.- Returns:
- The TimeSeriesContainer of dependent values.
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Rates the values in the specified TimeSeriesMath to generate a resulting TimeSeriesMath. The rating must be for a single independent parameter.- Specified by:
rate
in interfaceIRating
- Parameters:
tsm
- The TimeSeriesMath of independent values.- Returns:
- The TimeSeriesMath of dependent values.
- Throws:
RatingException
-
rate
Description copied from interface:IRating
Rates the values in the specified TimeSeriesMath objects to generate a resulting TimeSeriesMath. The rating must be for as many independent parameters as the length of tscs.- Specified by:
rate
in interfaceIRating
- Parameters:
tsms
- The TimeSeriesMaths of independent values, one for each independent parameter.- Returns:
- The TimeSeriesMath of dependent values.
- Throws:
RatingException
-
reverseRate
Description copied from interface:IRating
Finds the independent value for a single independent value. The rating must be for a single independent parameter.- Specified by:
reverseRate
in interfaceIRating
- Parameters:
depVal
- The dependent value to rate.- Returns:
- The independent value
- Throws:
RatingException
-
reverseRate
Description copied from interface:IRating
Finds multiple independent values for multiple single independent values. The rating must be for a single independent parameter.- Specified by:
reverseRate
in interfaceIRating
- Parameters:
depVals
- The dependent values to rate- Returns:
- The independent values
- Throws:
RatingException
-
reverseRate
Description copied from interface:IRating
Finds the independent value for a single independent value at a specified time. The rating must be for a single independent parameter.- Specified by:
reverseRate
in interfaceIRating
- Parameters:
valTime
- The time associated with the value to rate, in Java millisecondsdepVal
- The dependent value to rate- Returns:
- The independent value
- Throws:
RatingException
-
reverseRate
Description copied from interface:IRating
Finds multiple independent values for multiple single independent values at a specified time. The rating must be for a single independent parameter.- Specified by:
reverseRate
in interfaceIRating
- Parameters:
valTime
- The time associated with the values to rate, in Java millisecondsdepVals
- The dependent values to rate- Returns:
- The independent values
- Throws:
RatingException
-
reverseRate
Description copied from interface:IRating
Finds multiple independent values for multiple single independent and times. The rating must be for a single independent parameter.- Specified by:
reverseRate
in interfaceIRating
- Parameters:
valTimes
- The times associated with the values to rate, in Java millisecondsdepVals
- The dependent values to rate- Returns:
- The independent values
- Throws:
RatingException
-
reverseRate
Description copied from interface:IRating
Rates the values in the specified TimeSeriesContainer to generate a resulting TimeSeriesContainer. The rating must be for a single independent parameter.- Specified by:
reverseRate
in interfaceIRating
- Parameters:
tsc
- The TimeSeriesContainer of dependent values.- Returns:
- The TimeSeriesContainer of independent values.
- Throws:
RatingException
-
reverseRate
Description copied from interface:IRating
Rates the values in the specified TimeSeriesMath to generate a resulting TimeSeriesMath. The rating must be for a single independent parameter.- Specified by:
reverseRate
in interfaceIRating
- Parameters:
tsm
- The TimeSeriesMath of dependent values.- Returns:
- The TimeSeriesMath of independent values.
- Throws:
RatingException
-
getIndParamCount
Description copied from interface:IRating
Retrieves the number of independent parameters for this rating.- Specified by:
getIndParamCount
in interfaceIRating
- Returns:
- The number of independent parameters for this rating.
- Throws:
RatingException
-
getRatingExtents
Description copied from interface:IRating
Retrieves the min and max value for each parameter of the rating, in the current ratingUnits.- Specified by:
getRatingExtents
in interfaceIRating
- Returns:
- The min and max values for each parameter. The outer (first) dimension will be 2, with the first containing min values and the second containing max values. The inner (second) dimension will be the number of independent parameters for the rating plus one. The first value will be the extent for the first independent parameter, and the last value will be the extent for the dependent parameter.
- Throws:
RatingException
-
getRatingExtents
Description copied from interface:IRating
Retrieves the min and max value for each parameter of the rating, in the current ratingUnits.- Specified by:
getRatingExtents
in interfaceIRating
- Parameters:
ratingTime
- The time to use in determining the rating extents- Returns:
- The min and max values for each parameter. The outer (first) dimension will be 2, with the first containing min values and the second containing max values. The inner (second) dimension will be the number of independent parameters for the rating plus one. The first value will be the extent for the first independent parameter, and the last value will be the extent for the dependent parameter.
- Throws:
RatingException
-
getEffectiveDates
public long[] getEffectiveDates()Description copied from interface:IRating
Retrieves the effective dates of the rating in milliseconds, one for each contained rating- Specified by:
getEffectiveDates
in interfaceIRating
-
getCreateDates
public long[] getCreateDates()Description copied from interface:IRating
Retrieves the creation dates of the rating in milliseconds, one for each contained rating- Specified by:
getCreateDates
in interfaceIRating
-
makeTscs
protected TimeSeriesContainer[] makeTscs(long[] valTimes, double[][] indVals) throws HecMathException Makes dummy TimeSeriesContainer objects bridge IRating methods to HecMath methods- Parameters:
valTimes
- Times in java millisecondsindVals
- values to rate- Returns:
- an array of TimeSeriesContainer objects
- Throws:
HecMathException
-
correlationCoefficients
- Overrides:
correlationCoefficients
in classHecMath
- Throws:
HecMathException
-
generateDataPairs
This method will compare the two paired data containers and create a PairedDataMath object that has all of the data points that are coincident in x ordinates- Overrides:
generateDataPairs
in classHecMath
- Parameters:
pdMath
- = other time seriesbuffer
- - undefined units- Returns:
- Throws:
HecMathException
-
screenWithMaxMin
public HecMath screenWithMaxMin(double minValueLimit, double maxValueLimit, double changeLimit, boolean setInvalidToMissingValue, String qualityFlagForInvalidValue) throws HecMathException strictly looks at min/max value- Overrides:
screenWithMaxMin
in classHecMath
- Throws:
HecMathException
-
expandVerticalDatum
Returns a new PairedDataMathVertDatum object constructed from this object if the internal data supports it, expanding the internal data in the process- Specified by:
expandVerticalDatum
in interfaceIVerticalDatumOperations<PairedDataMath,
HecMathException> - Returns:
- The PairedDataMathVertDatum 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 PairedDataMathVertDatum object. Any errors are thrown.
- Throws:
HecMathException
-
collapseVerticalDatum
Returns a new PairedDataMath object constructed from this object if the internal data supports it, collapsing the internal data in the process- Specified by:
collapseVerticalDatum
in interfaceIVerticalDatumOperations<PairedDataMath,
HecMathException> - Returns:
- The PairedDataMath 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 PairedDataMathVertDatum object. All errors are thrown.
- Throws:
HecMathException
-