hec.rounding

Module for various rounding classes

class UsgsRounder:

Provides functionality of USGS rounding arrays (called rounding specifications in this package). The full description of using rounding arrays can be found in Section 3.5 (Data Rounding Convention) of the ADAPS Section of the National Water Information System User's Manual.

Specifically, the rounding specifications are strings of 10 digits with the following meanings (left to right):

  1. Number of significant digits for values < 0.01
  2. Number of significant digits for values >= 0.01 and < 0.1
  3. Number of significant digits for values >= 0.1 and < 1.0
  4. Number of significant digits for values >= 1.0 and < 10
  5. Number of significant digits for values >= 10 and < 100
  6. Number of significant digits for values >= 100 and < 1000
  7. Number of significant digits for values >= 1,000 and < 10,000
  8. Number of significant digits for values >= 10,000 and < 100,000
  9. Number of significant digits for values >= 100,000
  10. Maximum number of decimal places regardless of magnitude
UsgsRounder(rounding_spec: str = '4444444444')
rounding_spec: str
def round_f( self, values: Sequence[float], round_half_even: bool = True) -> list[float]:
def round_s(self, values: Sequence[float], round_half_even: bool = True) -> list[str]: