hec.rating.table_rating
Exception class for TableRating objects
Implements lookup-based ratings
Initializer for AbstractRating objects.
Arguments:
- specification (Any): A RatingSpecification object to initialize from.
This is typed as
Anyto avoid circular import dependencies. - effective_time (Union[datetime, HecTime, str]): The effective date/time of the rating
Raises:
- TypeError: if
specificationis not a RatingSpecification object.
Creates a TableRating from a
Arguments:
- root (etree._Element): The
element - specification (Optional[RatingSpecification]): The rating specification.
- If specified: If specification vertical datum info is None, it will be created from any vertical datum info in the XML
- If not specified: The rating spec for the rating will be constructed from the XML
Raises:
- AbstractRatingException: If there is any invalid XML in the portion common to all ratings
- TableRatingException: If there is any invalid XML in the
elements
Returns:
SimpleRating: The created rating
Whether the table rating has rating points
Concrete (non-reference) rating sets (see LocalRatingSet) may be initailized
in a manner in which the included TableRating objects are initialized with or without data points.
This is controlled by specifying 'EAGER' or 'LAZY' as the loading method. A TableRating object in LocalRatingSet loaded with LAZY loading
keeps a reference to the datastore from which it was loaded in order to retrieve rating points on the first use of the rating.
Operations:
Read/Write
Performs dependent value interpolation, extrapolation, or selection based on specified behavior
Arguments:
- x (float): The independent value
- x0 (float): The nearest independent value <=
xin a sorted list - x1 (float): The nearest independent value >=
xin a sorted list - y0 (float): The dependent value corresponding to
x0 - y1 (float): The dependent value corresponding to
x1 - lookup (str): The computation or selection behavior to use. See LookupMethod
Returns:
float: The interpolated, extrapolated, or selected dependent value
Rates a single independent parameter value set
The value set is expected to be in the native units and vertical datum of the rating. To specify units, vertical datum
or rounding use rate_values, nesting ind_value in a list and extracting
the result from the returned list.
Arguments:
- ind_value (list[float]): The list of values (one for each independent parameter) that comprises the input value set
- lo_key (list[float], optional): Do not set; only used internally on recursion. Defaults to [].
- hi_key (list[float], optional): Do not set; only used internally on recursion. Defaults to [].
Returns:
float: The rated (dependent parameter) value
Reverse rates a single dependent parameter value
The dependent parameter value is expected to be in the native unit and vertical datum of the rating. To specify units, vertical datum
or rounding use reverse_rate_values, putting dep_value in a list and extracting
the result from the returned list.
Arguments:
- dep_value (float): The dependent parameter value to reverse rate
Returns:
float: The rated (independent parameter) value
Inherited Members
- hec.rating.abstract_rating.AbstractRating
- effective_time
- active
- convert_units
- create_time
- default_data_units
- default_data_vertical_datum
- description
- has_elev_param
- make_datum_offsets
- make_reverse_datum_offsets
- make_reverse_unit_conversions
- make_unit_conversion
- make_unit_conversions
- office
- populate_xml_element
- rate
- rating_units
- reverse_rate
- specification
- specification_id
- template
- template_id
- to_xml
- transition_start_time
- vertical_datum_info
- vertical_datum_json
- vertical_datum_xml