Package hec.data

Class Units

All Implemented Interfaces:
Serializable

@Deprecated public class Units extends AbstractDataSet implements Serializable
Deprecated.
As of 02/08/2021 use Units and UnitUtil from hec-nucleus-metadata instead.
This class is deprecated as most of the functionality is delegated to the hec-nucleus-metadata version of the class Notably the functions missing from hec-nucleus-metadata are ones that reference hec.io package classes that will need to find a new home when dependencies are managed.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • setUnits

      public void setUnits(String units)
      Deprecated.
    • getUnitsForAlias

      public static String getUnitsForAlias(String alias)
      Deprecated.
    • setUnits

      public void setUnits(String units, boolean useBestMatch)
      Deprecated.
      Sets the units string for this Unit object. Checks for any aliases first. If no alias is defined and useBestMatch is true, will try to find the units string that best matches the given units string.
    • isSetToUndefined

      public boolean isSetToUndefined()
      Deprecated.
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object
    • getAvailableUnits

      public static String[] getAvailableUnits()
      Deprecated.
    • equals

      public boolean equals(Units units)
      Deprecated.
    • isValidUnitsSystem

      public static boolean isValidUnitsSystem(int system)
      Deprecated.
    • getUnitSystemForUnits

      public static int getUnitSystemForUnits(String unitStr)
      Deprecated.
      Static method whichs takes a unit label and attempts to find the matching unit system
    • convertUnits

      public static double convertUnits(double x, String fromUnits, String toUnits) throws UnitsConversionException
      Deprecated.
      Throws:
      UnitsConversionException
    • getUnitsStringForUnitsId

      public static String getUnitsStringForUnitsId(int unitsId)
      Deprecated.
      return the Units String (ENGLISH, SI, UNDEFINED_UNITS) for the Units Id (ENGLISH_ID, SI_ID, UNDEF_ID)
      Parameters:
      unitsId - one of ENGLISH_ID, SI_ID, UNDEF_ID
      Returns:
      ENGLISH, SI, UNDEFINED_UNITS
    • getUnitsInUnitSystem

      public static String getUnitsInUnitSystem(String unitsSystem, String unitsFrom) throws UnitsConversionException
      Deprecated.
      Throws:
      UnitsConversionException
    • canConvertBetweenUnits

      public static boolean canConvertBetweenUnits(String fromUnits, String toUnits)
      Deprecated.
    • getAllUnitsThatCanConvertTo

      public static List<String> getAllUnitsThatCanConvertTo(String unit, String unitSystem)
      Deprecated.
      Returns an ArrayList of all units that can convert to the given unit.
      Parameters:
      unit -
      Returns:
    • getAliasesForUnits

      public static String[] getAliasesForUnits(String units)
      Deprecated.
    • isUnitsInAlias

      public static boolean isUnitsInAlias(String units, String aliasUnits)
      Deprecated.
      This method returns true if the if the given units is contained in the list of aliases for the given aliasUnits or exactly matches the given aliasUnits. Units are case sensitive.
      Parameters:
      units -
      aliasUnits -
      Returns:
    • getBestMatch

      public static String getBestMatch(String units)
      Deprecated.
    • convertUnits

      public static ParamDouble convertUnits(ParamDouble x, String fromUnits, String toUnits) throws UnitsConversionException
      Deprecated.
      Throws:
      UnitsConversionException
    • convertUnits

      public static ParamDoubleArray convertUnits(ParamDoubleArray x, String fromUnits, String toUnits) throws UnitsConversionException
      Deprecated.
      Throws:
      UnitsConversionException
    • getScalarFactor

      public static double getScalarFactor(String fromUnits, String toUnits) throws UnitsConversionException
      Deprecated.
      Does a lookup to find a scalar factor that converts between the two units.
      Parameters:
      fromUnits - the units string to convert from
      toUnits - the units string to convert to.
      Throws:
      UnitsConversionException
    • convertUnits

      public static double convertUnits(double x, int paramID, int fromUnitSystem, int toUnitSystem) throws UnitsConversionException
      Deprecated.
      Converts a value from one unit system to another.
      Parameters:
      x - value to be converted
      paramID - parameter type as defined in hec.data.Parameter
      fromUnitSystem - unit system to convert from, SI_ID or ENGLISH_ID
      toUnitSystem - unit system to convert to, SI_ID or ENGLISH_ID
      Returns:
      the converted value.
      Throws:
      UnitsConversionException
      See Also:
    • convertUnits

      public static void convertUnits(double[] x, int paramID, int fromUnitSystem, int toUnitSystem) throws UnitsConversionException
      Deprecated.
      Converts an array from one unit system to another.
      Parameters:
      x - value to be converted
      paramID - parameter type as defined in hec.data.Parameter
      fromUnitSystem - unit system to convert from, SI_ID or ENGLISH_ID
      toUnitSystem - unit system to convert to, SI_ID or ENGLISH_ID
      Throws:
      UnitsConversionException
      See Also:
    • convertUnits

      public static void convertUnits(double[] x, String fromUnits, String toUnits) throws UnitsConversionException
      Deprecated.
      Throws:
      UnitsConversionException
    • getStorageToFlowConversion

      public static double getStorageToFlowConversion(String storageUnits, String flowUnits) throws UnitsConversionException
      Deprecated.
      Interpret unit strings for storage and flow to develop scale factor to convert storage units (ac-ft, m3) to flow units (cfs, cms). Note!!! User must divide the returned value by the time step in seconds
      Parameters:
      storageUnits - Units string for storage ( ac-ft, m3 )
      flowUnits - Units string for flow ( cfs, cms )
      Returns:
      The conversion factor to scale storage to flow. Note!!! This factor must be divided by the time step in seconds!
      Throws:
      UnitsConversionException
    • convertUnits

      public static int convertUnits(TimeSeriesContainer container, int toUnitSyst)
      Deprecated.
    • convertUnits

      public static int convertUnits(PairedDataContainer container, int toUnitSyst)
      Deprecated.
    • convertUnits

      public static int convertUnits(DataContainer container, int toUnitSyst)
      Deprecated.
    • convertUnits

      public static void convertUnits(List<Object> containers, int toUnitSyst)
      Deprecated.
    • convertUnits

      public static int convertUnits(double[] data, int number, int fromUnitSyst, int toUnitSyst, stringContainer units)
      Deprecated.
    • getUnitsMetaData

      public mil.army.usace.hec.metadata.Units getUnitsMetaData()
      Deprecated.