Package hec.hecmath

Class TimeSeriesMath

java.lang.Object
hec.hecmath.HecMath
hec.hecmath.TimeSeriesMath
All Implemented Interfaces:
IVerticalDatumOperations<TimeSeriesMath,HecMathException>, Constants
Direct Known Subclasses:
TimeSeriesMathVertDatum

public class TimeSeriesMath extends HecMath implements IVerticalDatumOperations<TimeSeriesMath,HecMathException>
The 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 Details

  • Constructor Details

  • Method Details

    • params

      protected static List<ValueContainer> params(Object... args) throws ComputationException
      Throws:
      ComputationException
    • setParameterPart

      public void setParameterPart(String paramString) throws HecMathException
      set the parameter type (C Part) of the DSS Pathname
      Overrides:
      setParameterPart in class HecMath
      Parameters:
      paramString - the new parameter type
      Throws:
      HecMathException
    • setData

      public void setData(DataContainer container) throws HecMathException
      Set the TimeSeriesContainer data for the current TimeSeriesMath object. The current TimeSeriesMath will use a copy of container.

      Specified by:
      setData in class HecMath
      Parameters:
      container - the TimeSeriesContainer data to be used by this TimeSeriesMath object.
      Throws:
      HecMathException - if container is null or not of type TimeSeriesContainer.
    • getData

      public DataContainer getData() throws HecMathException
      Copy the current TimeSeriesContainer data in the TimeSeriesMath object into container.

      Specified by:
      getData in class HecMath
      Returns:
      a copy of the TimeSeriesContainer held in the current TimeSeriesMath object.
      Throws:
      HecMathException
    • getData

      public void getData(DataContainer container) throws HecMathException
      Copy the current TimeSeriesContainer data in the TimeSeriesMath object into container.

      Specified by:
      getData in class HecMath
      Parameters:
      container - the TimeSeriesContainer to receive the copy of data from this time series.
      Throws:
      HecMathException
    • getContainer

      public TimeSeriesContainer getContainer()
      get the HecMath._dc (DataContainer) cast as a TimeSeriesContainer
      Returns:
      the TimeSeriesContainer held in the current TimeSeriesMath object.
      Throws:
      HecMathException
    • add

      public HecMath add(HecMath tsMath) throws HecMathException
      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 and tsMath, 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 in tsMath 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 class HecMath
      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

      public HecMath add(double constant) throws HecMathException
      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 class HecMath
      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

      public HecMath subtract(HecMath tsMath) throws HecMathException
      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 and tsMath, the value in tsMath 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 in tsMath 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 class HecMath
      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

      public HecMath subtract(double constant) throws HecMathException
      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 class HecMath
      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

      public HecMath multiply(HecMath tsMath) throws HecMathException
      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 and tsMath, 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 in tsMath 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 class HecMath
      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

      public HecMath multiply(double constant) throws HecMathException
      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 class HecMath
      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

      public HecMath divide(HecMath tsMath) throws HecMathException
      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 and tsMath, the value in the current time series will be divided by the value in tsMath provided both values are valid ( not missing ). Divide by zeroes are not allowed. When the tsMath 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 in tsMath 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 class HecMath
      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

      public HecMath divide(double constant) throws HecMathException
      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 class HecMath
      Parameters:
      constant - the value to divide values in current time series.
      Returns:
      a new time series resulting from the operation.
      Throws:
      HecMathException - if constant is zero.
    • integerDivide

      public HecMath integerDivide(HecMath tsMath) throws HecMathException
      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 and tsMath, the value in the current time series will be divided by the value in tsMath provided both values are valid ( not missing ). Divide by zeroes are not allowed. When the tsMath 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 in tsMath 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

      public HecMath integer_divide(HecMath tsMath) throws HecMathException
      Throws:
      HecMathException
    • integerDivide

      public HecMath integerDivide(double constant) throws HecMathException
      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 - if constant is zero.
    • integer_divide

      public HecMath integer_divide(double constant) throws HecMathException
      Throws:
      HecMathException
    • modulo

      public HecMath modulo(HecMath tsMath) throws HecMathException
      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 and tsMath, the value in the current time series will be divided by the value in tsMath provided both values are valid ( not missing ). Divide by zeroes are not allowed. When the tsMath 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 in tsMath 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

      public HecMath modulo(double constant) throws HecMathException
      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 - if constant is zero.
    • exponentiation

      public HecMath exponentiation(HecMath tsMath) throws HecMathException
      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 and tsMath, the value in the current time series will be raised to the power of the value in tsMath provided both values are valid ( not missing ). Points in the current time series which cannot be matched to valid points in tsMath 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

      public HecMath exponentiation(double constant) throws HecMathException
      Raise values in the current time series to the power of constant. Times in which values are missing in the current time series remain missing in the new time series.

      Overrides:
      exponentiation in class HecMath
      Parameters:
      constant - the exponent value.
      Returns:
      a new time series resulting from the operation.
      Throws:
      HecMathException - if constant is zero.
    • abs

      public HecMath abs() throws HecMathException
      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 class HecMath
      Returns:
      A new time series composed of the absolute values of the current time series
      Throws:
      HecMathException
    • negative

      public HecMath negative() throws HecMathException
      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

      public HecMath neg() throws HecMathException
      Throws:
      HecMathException
    • inverse

      public HecMath inverse() throws HecMathException
      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 class HecMath
      Returns:
      A new time series with values of 1 divided by the values of the original time series.
      Throws:
      HecMathException
    • sign

      public HecMath sign() throws HecMathException
      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

      public HecMath sqrt() throws HecMathException
      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 class HecMath
      Returns:
      A new time series representing the square root of the values of the current time series
      Throws:
      HecMathException
    • exp

      public HecMath exp() throws HecMathException
      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

      public HecMath log() throws HecMathException
      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 class HecMath
      Returns:
      A new time series composed of the natural log of the values of the original time series
      Throws:
      HecMathException
    • log10

      public HecMath log10() throws HecMathException
      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 class HecMath
      Returns:
      A new time series composed of the log base 10 of the values of the current time series
      Throws:
      HecMathException
    • transformWithFunction

      public HecMath transformWithFunction(ScalarOperable transformer) throws HecMathException
      use custom transformer to alter values
      Overrides:
      transformWithFunction in class HecMath
      Throws:
      HecMathException
    • sin

      public HecMath sin() throws HecMathException
      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 class HecMath
      Returns:
      A new time series representing the sine of the values of the original time series
      Throws:
      HecMathException
    • cos

      public HecMath cos() throws HecMathException
      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 class HecMath
      Returns:
      A new time series representing the cosine of the values of the current time series
      Throws:
      HecMathException
    • tan

      public HecMath tan() throws HecMathException
      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 class HecMath
      Returns:
      A new time series representing the tangent of the values of the original time series
      Throws:
      HecMathException
    • asin

      public HecMath asin() throws HecMathException
      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

      public HecMath acos() throws HecMathException
      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

      public HecMath atan() throws HecMathException
      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

      public HecMath floor() throws HecMathException
      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

      public HecMath ceil() throws HecMathException
      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

      public HecMath round() throws HecMathException
      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 class HecMath
      Returns:
      A new time series composed of values of the current time series rounded to the nearest whole numbers.
      Throws:
      HecMathException
    • truncate

      public HecMath truncate() throws HecMathException
      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 class HecMath
      Returns:
      A new time series composed of values of the current time series truncated to whole numbers.
      Throws:
      HecMathException
    • fmod

      public HecMath fmod(HecMath tsMath) throws HecMathException
      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 and tsMath, the value in the current time series will be divided by the value in tsMath provided both values are valid ( not missing ). Divide by zeroes are not allowed. When the tsMath 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 in tsMath 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

      public HecMath fmod(double constant) throws HecMathException
      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 - if constant is zero.
    • sum

      public HecMath sum(HecMath[] tsMathArray) throws HecMathException
      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 in tsMathArray, 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 in tsMathArray 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

      public HecMath product(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath min(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath max(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath mean(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath gmean(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath hmean(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath rms(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath variance(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath var(HecMath[] tsMathArray) throws HecMathException
      Throws:
      HecMathException
    • standardDeviation

      public HecMath standardDeviation(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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 public HecMath stddev(HecMath[] tsMathArray) throws HecMathException
      Deprecated.
      Parameters:
      tsMathArray -
      Returns:
      Throws:
      HecMathException
      See Also:
    • med

      public HecMath med(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p1(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p2(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p5(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p10(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p20(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p25(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p75(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p80(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p90(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p95(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p98(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath p99(HecMath[] tsMathArray) throws HecMathException
      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 and tsMathArray, 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 in tsMathArray 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

      public HecMath roundOff(int digitsPrecision, int powerOfTensPlace) throws HecMathException
      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 class HecMath
      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

      public HecMath accumulation() throws HecMathException
      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 class HecMath
      Returns:
      A new time series representing the running accumulation of the current time series
      Throws:
      HecMathException
    • min

      public double min() throws HecMathException
      Find the minimum value of the time series. Missing and rejected values are excluded.

      Overrides:
      min in class HecMath
      Returns:
      the minimum value of the time series.
      Throws:
      HecMathException
    • minDate

      public int minDate() throws HecMathException
      Find the date and time of the minimum time series value.

      Overrides:
      minDate in class HecMath
      Returns:
      the date and time of the minimum value as an int value translatable by HecTime
      Throws:
      HecMathException
      See Also:
    • max

      public double max() throws HecMathException
      Find the maximum value of the time series. Missing and rejected values are excluded.

      Overrides:
      max in class HecMath
      Returns:
      the maximum value of the time series.
      Throws:
      HecMathException
    • maxDate

      public int maxDate() throws HecMathException
      Find the date and time of the maximum time series value.

      Overrides:
      maxDate in class HecMath
      Returns:
      the date and time of the maximum value as an int value translatable by HecTime
      Throws:
      HecMathException
      See Also:
    • mean

      public double mean() throws HecMathException
      Compute the mean value of the time series. Missing and rejected values are excluded.

      Overrides:
      mean in class HecMath
      Returns:
      the mean value of the time series.
      Throws:
      HecMathException
    • sum

      public double sum() throws HecMathException
      Compute the total accumulated amount for time series. Missing and rejected values are excluded.

      Overrides:
      sum in class HecMath
      Returns:
      the total accumulated value of the time series.
      Throws:
      HecMathException
    • standardDeviation

      public double standardDeviation() throws HecMathException
      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 class HecMath
      Returns:
      the standard deviation value of the time series.
      Throws:
      HecMathException - if there are less than 3 valid values in the time series.
    • skewCoefficient

      public double skewCoefficient() throws HecMathException
      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 class HecMath
      Returns:
      the skew coefficient value of the time series.
      Throws:
      HecMathException - if there are less than 3 valid values in the time series.
    • kurtosisCoefficient

      public double kurtosisCoefficient() throws HecMathException
      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 class HecMath
      Returns:
      the kurtosis coefficient value of the time series.
      Throws:
      HecMathException - if there are less than 4 valid values in the time series.
    • mode

      public double mode() throws HecMathException
      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 class HecMath
      Returns:
      the mode value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • med

      public double med() throws HecMathException
      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 class HecMath
      Returns:
      the median value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p1

      public double p1() throws HecMathException
      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 class HecMath
      Returns:
      the p1 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p2

      public double p2() throws HecMathException
      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 class HecMath
      Returns:
      the p2 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p5

      public double p5() throws HecMathException
      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 class HecMath
      Returns:
      the p5 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p10

      public double p10() throws HecMathException
      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 class HecMath
      Returns:
      the p10 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p20

      public double p20() throws HecMathException
      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 class HecMath
      Returns:
      the p20 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p25

      public double p25() throws HecMathException
      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 class HecMath
      Returns:
      the p25 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p75

      public double p75() throws HecMathException
      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 class HecMath
      Returns:
      the p75 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p80

      public double p80() throws HecMathException
      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 class HecMath
      Returns:
      the p80 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p90

      public double p90() throws HecMathException
      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 class HecMath
      Returns:
      the p90 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p95

      public double p95() throws HecMathException
      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 class HecMath
      Returns:
      the p95 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p98

      public double p98() throws HecMathException
      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 class HecMath
      Returns:
      the p98 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • p99

      public double p99() throws HecMathException
      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 class HecMath
      Returns:
      the p99 value of the time series.
      Throws:
      HecMathException - if there are less than 1 valid value in the time series.
    • numberValidValues

      public int numberValidValues() throws HecMathException
      Count the number of valid (non-missing and non-rejected) values in the time series values.

      Overrides:
      numberValidValues in class HecMath
      Returns:
      the number of valid (non-missing and non-rejected) value in the time series.
      Throws:
      HecMathException
    • numberInvalidValues

      public int numberInvalidValues() throws HecMathException
      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

      public int numberMissingValues() throws HecMathException
      Count the number of missing (but not rejected) values in the time series values.

      Overrides:
      numberMissingValues in class HecMath
      Returns:
      the number of missing (but not rejected) values in the time series.
      Throws:
      HecMathException
    • numberQuestionedValues

      public int numberQuestionedValues() throws HecMathException
      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

      public int numberRejectedValues() throws HecMathException
      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

      public int firstValidDate() throws HecMathException
      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

      public double firstValidValue() throws HecMathException
      Find the first valid value in the time series.

      Returns:
      the value of the first valid time series value.
      Throws:
      HecMathException
    • lastValidDate

      public int lastValidDate() throws HecMathException
      Find the date and time of the last valid time series value.

      Overrides:
      lastValidDate in class HecMath
      Returns:
      the date and time of the last valid value as an int value translatable by HecTime
      Throws:
      HecMathException
      See Also:
    • lastValidValue

      public double lastValidValue() throws HecMathException
      Find the last valid value in the time series.

      Overrides:
      lastValidValue in class HecMath
      Returns:
      the value of the last valid time series value.
      Throws:
      HecMathException
    • convertToMetricUnits

      public HecMath convertToMetricUnits() throws HecMathException
      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 class HecMath
      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

      public HecMath convertToEnglishUnits() throws HecMathException
      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 class HecMath
      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

      public boolean isMetric() throws HecMathException
      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 class HecMath
      Returns:
      true if the time series units are metric, otherwise returns false.
      Throws:
      HecMathException - if the unit system cannot be determined.
    • isEnglish

      public boolean isEnglish() throws HecMathException
      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 class HecMath
      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 class HecMath
      Returns:
      true if the units system can be determined, otherwise returns false.
    • getUnits

      public String getUnits()
      Returns the units label of the y-values for the current time series.

      Overrides:
      getUnits in class HecMath
      Returns:
      units label for time series
    • getStandardUnits

      public String 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 file hec.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 class HecMath
      Returns:
      standardized units label for time series as defined in hec.heclib.util.unitConversion.def
    • setUnits

      public void setUnits(String unitsString)
      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.

      Specified by:
      setUnits in class HecMath
      Parameters:
      unitsString - the new units label for the time series.
    • getType

      public String getType()
      Returns the type label for the current time series.

      Returns:
      type label for time series
    • setType

      public void setType(String typeString)
      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

      public HecMath successiveDifferences() throws HecMathException
      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 class HecMath
      Returns:
      A new time series of successive differences.
      Throws:
      HecMathException - if data is not of type "INST-VAL" or "INST-CUM".
    • timeDerivative

      public HecMath timeDerivative() throws HecMathException
      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 class HecMath
      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. If onlyValidValues 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 than numberToAverageOver values in the interval. If useReduced is set to false, then the first and last numberToAverageOver/2 points of the new time series are set to missing.

      Overrides:
      centeredMovingAverage in class HecMath
      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 than numberToAverageOver ) number of points. Otherwise, set the first and last numberToAverageOver/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 the numberToAverageOver 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. If onlyValidValues 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 than numberToAverageOver values in the interval. If useReduced is set to false, then the first and last numberToAverageOver/2 points of the new time series are set to missing.

      Overrides:
      olympicSmoothing in class HecMath
      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 than numberToAverageOver ) number of points. Otherwise, set the first and last numberToAverageOver/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 the numberToAverageOver 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. If onlyValidValues 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 than numberToAverageOver values in the interval. If useReduced is set to false, then the first numberToAverageOver 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 than numberToAverageOver ) number of points. Otherwise, set the first and last numberToAverageOver/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

      public HecMath forwardMovingAverage(int numberToAverageOver) 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 a missing value is occurs over the numberToAverageOver 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 class HecMath
      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 above maxValueLimit or with a change from the previous time series value greater than changeLimit 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 above maxValueLimit or with a change from the previous time series value greater than changeLimit fail the quality test. The maximum change comparison is done only when consecutive values are not flagged.

      Overrides:
      screenWithMaxMin in class HecMath
      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 is setInvalidToSpecifiedValue 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 above maxValueLimit or with a change from the previous time series value greater than changeLimit fail the quality test. The maximum change comparison is done only when consecutive values are not flagged.

      Overrides:
      screenWithMaxMin in class HecMath
      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 above maxRejectLimit are marked with a rejected quality flag. Other values below minQuestionLimit or above maxQuestionLimit 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 below minRejectLimit will be marked as questioned.
      maxQuestionLimit - Values above this, but not above maxRejectLimit 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 above maxRejectLimit are marked with a rejected quality flag. Other whose rate of change from the last valid value are values below minQuestionLimit or above maxQuestionLimit 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 below minRejectLimit will be marked as questioned.
      maxQuestionLimit - Values whose rate of change from the last valid value are above this, but not above maxRejectLimit 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 above maxRejectLimit are marked with a rejected quality flag. Other whose whose accumulated value for the specified duration is below minQuestionLimit or above maxQuestionLimit 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 below minRejectLimit will be marked as questioned.
      maxQuestionLimit - Values whose accumulated value for the specified duration is above this, but not above maxRejectLimit 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 below questionTolerance 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 than changeLimit are flagged or set to the "Missing" value depending upon the settings for setInvalidToMissingValue or qualityFlagForInvalidValue 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 than changeLimit are flagged or set to the "Missing" value depending upon the settings for setInvalidToMissingValue or qualityFlagForInvalidValue 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 class HecMath
      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 the numberToAverageOver is less than 3 or if an unrecognized quality flag is entered for qualityFlagForInvalidValue or if setInvalidToMissingValue is false and qualityFlagForInvalidValue is blank ( no action would occur ).
    • estimateForMissingValues

      public HecMath estimateForMissingValues(int maxMissingAllowed) throws HecMathException
      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 class HecMath
      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

      public HecMath estimateForMissingPrecipValues(int maxMissingAllowed) throws HecMathException
      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 class HecMath
      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

      public HecMath replaceSpecificValues(HecDouble from, HecDouble to) throws HecMathException
      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 class HecMath
      Parameters:
      from - value which will be replaced
      to - 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 class HecMath
      Parameters:
      min - minimum value which will be replaced
      max - maximum value which will be replaced
      to - 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

      public HecMath mergeTimeSeries(HecMath tsMath) throws HecMathException
      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 class HecMath
      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

      public PairedDataMath generateDataPairs(HecMath tsMath, double buffer) throws HecMathException
      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 class HecMath
      Parameters:
      tsMath - = other time series
      buffer - - in minutes because time series containers are in minutes
      Returns:
      Throws:
      HecMathException
    • generateDataPairs

      @Deprecated public PairedDataMath generateDataPairs(HecMath tsMath, boolean sort) throws HecMathException
      Overrides:
      generateDataPairs in class HecMath
      Parameters:
      tsMath -
      sort -
      Returns:
      Throws:
      HecMathException
    • generatePairedData

      public PairedDataMath generatePairedData(HecMath tsMath, boolean sort) throws HecMathException
      Overrides:
      generatePairedData in class HecMath
      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 class HecMath
      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 class HecMath
      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 series tsMath. The formula for computing the new time series from the time series precipation and decayRate 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 is tsNew(0).

      The current time series and tsMath may be the same. Both the current time series and tsMath 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 class HecMath
      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 and tsMath are not identical in time or not regular interval.
    • flowAccumulatorGageProcessor

      public HecMath flowAccumulatorGageProcessor(HecMath tsMath) throws HecMathException
      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 class HecMath
      Parameters:
      tsMath - a time series of counts for the flow accumulator gage.
      Returns:
      a new time series of period average flow.
      Throws:
      HecMathException
    • convertToIrregular

      public HecMath convertToIrregular(String blockSize) throws HecMathException
      Overrides:
      convertToIrregular in class HecMath
      Throws:
      HecMathException
    • convertToIrregular

      public HecMath convertToIrregular(String blockSize, boolean removeMissing) throws HecMathException
      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 class HecMath
      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 the null 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 by timeIntervalString and time offset set by timeOffsetString. New time series values are generated by processing current values according to the method set by functionTypeString.

      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 using timeOffsetString 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 for functionTypeString 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 class HecMath
      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 the null 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 class HecMath
      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 in tsMath. 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 for functionTypeString 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 class HecMath
      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 class HecMath
      Throws:
      HecMathException
    • transformTimeSeries

      public HecMath transformTimeSeries(HecMath tsMath, String functionTypeString, boolean toIrregular, double missingAllowed) throws HecMathException
      Throws:
      HecMathException
    • getFunctionType

      protected int getFunctionType(String functionTypeString) throws HecMathException
      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 by timeOffsetString. 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 the timeBackwardString and the timeForwardString. 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 and timeForwardString 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" ) and timeForwardString 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 class HecMath
      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 the null 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 - if timeIntervalString is not a valid DSS time interval string, or if timeOffsetString, timeBackwardString, timeForwardString are not valid time increment strings.
    • shiftInTime

      public HecMath shiftInTime(String timeShiftString) throws HecMathException
      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 setting timeShiftString to "1H" or "1HOUR".

      Overrides:
      shiftInTime in class HecMath
      Parameters:
      timeShiftString - the increment to shift the time series times.
      Returns:
      A new time series shifted in time.
      Throws:
      HecMathException - if timeShiftString is not valid time increment string.
    • shiftInTime

      public HecMath shiftInTime(int timeShiftMinutes) throws HecMathException
      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 setting timeShiftString 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

      public HecMath shiftInTime(HecTime timeToShift) throws HecMathException
      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 setting timeShiftString to "1H" or "1HOUR".

      Returns:
      A new time series shifted in time.
      Throws:
      HecMathException
    • shiftAdjustment

      public HecMath shiftAdjustment(HecMath tsMath) throws HecMathException
      lineary interpolate the values of the current time series upon the times contained in tsc
      Overrides:
      shiftAdjustment in class HecMath
      Parameters:
      tsMath -
      Returns:
      A new time series.
      Throws:
      HecMathException
    • periodConstants

      public HecMath periodConstants(HecMath math) throws HecMathException
      Overrides:
      periodConstants in class HecMath
      Throws:
      HecMathException
    • correlationCoefficients

      public LinearRegressionStatistics correlationCoefficients(HecMath tsMath) throws HecMathException
      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 class HecMath
      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

      public HecMath[] cyclicAnalysis() throws HecMathException
      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 class HecMath
      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

      public HecMath[] cyclicAnalysis(String startYear) throws HecMathException
      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_DEFINED
      horizontalScale - - 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 calculations
      durationPeriodType - - 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 in tsMathArray. 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 class HecMath
      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 in tsMathArray 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, if timeLevelString is "MONTH", a valid range would be "JAN-MAR". The rangeString 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 and rangeString 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 for timeLevelString 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, if isInclusive 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. If isInclusive 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 the timeLevelString 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 end intervalWindow 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, and setAsIrregular should be set to true. Setting setAsIrregular to false will force an attempt to save the data as regular interval time data.

      Overrides:
      extractTimeSeriesDataForTimeSpecification in class HecMath
      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 range
      intervalWindow - time window, in minutes. Only applied if timeLevelString 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 interpret timeLevelString or rangeString.
    • 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 to initialValue. startTimeString and endTimeString 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 to initialValue. startTimeString and endTimeString 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 the null 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

      public boolean checkTimeSeriesMatch(TimeSeriesContainer tsc) throws HecMathException
      Checks that the times in the TimeSeriesContainer tsc 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 in tsc do not exactly match the times for the current time series.
      See Also:
    • checkTimeSeriesMath

      public boolean checkTimeSeriesMath(HecMath math, String methodName) throws HecMathException
      Checks to see if math 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 - if math is empty not an instance of TimeSeriesMath.
    • checkTimeSeries

      public static boolean checkTimeSeries(TimeSeriesContainer tsc) throws HecMathException
      Perform basic checks on the TimeSeriesContainer tsc to ensure that there is data.

      Parameters:
      tsc - the hec.io.TimeSeriesContainer for testing.
      Returns:
      true if tsc is not empty.
      Throws:
      HecMathException - if tsc is empty or contains no valid data.
      See Also:
    • isValid

      protected static boolean isValid(DataContainer container, int index)
      Determine if the data value in tsc is valid ( not missing or is okay ) for the index location index.

      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 location index in the current time series is valid ( okay or not missing ).

      Overrides:
      isValid in class HecMath
      Parameters:
      index - the array index of the value of interest.
      Returns:
      true if the value at the array location index is valid ( is okay or not missing ), otherwise false.
    • copy

      public HecMath copy() throws HecMathException
      Create a duplicate copy of the time series object.

      Specified by:
      copy in class HecMath
      Returns:
      a duplicate copy of the time series
      Throws:
      HecMathException
    • copyHeaderInfo

      protected static void copyHeaderInfo(TimeSeriesContainer fromTsc, TimeSeriesContainer toTsc)
      copy basic header information from one TimeSeriesContainer to another
    • findValidValue

      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. Will not test for that value, only before or after! If end of array reached, then Heclib.UNDEFINED_INT returned
      Parameters:
      tsc - TimeSeriesContainer
      index - int
      lookAfter - 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 public double[] getSortedPeaks() throws HecMathException
      Deprecated.
      Convert data to Annual Max
      Returns:
      Throws:
      HecMathException
    • computeSimpleFrequency

      @Deprecated public Vector computeSimpleFrequency() throws HecMathException
      Deprecated.
      used by DssVue. Any others? Deprecated use SimpleFrequencyAnalysis directly
      Returns:
      Throws:
      HecMathException
    • expandVerticalDatum

      public TimeSeriesMath expandVerticalDatum() throws HecMathException
      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 interface IVerticalDatumOperations<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

      public TimeSeriesMath collapseVerticalDatum() throws HecMathException
      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 interface IVerticalDatumOperations<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