hec.rating.abstract_rating_set
Base exception for all rating exceptions
Abstract class for all rating set classes.
Specifies required methods for sub-classes, holds information and implements code common one or more sub-classes.
Initializer for AbstractRatingSet objects.
Arguments:
- specification (Any): A RatingSpecification object to initialize from.
This is typed as
Anyto avoid circular import dependencies.
Raises:
- TypeError: if
specificationis not a RatingSpecification object.
The default data time of the rating set.
If not None, the default data time is used to rate values that don't otherwise have times specified.
If None, the current time is used as the default data time
Operations:
Read/Write
The units to use for independent and dependent parameter values when no units are specified for rate.
If None and no data units are specified, the rating methods will raise an exception.
Operations:
Read/Write
The default vertical datum for rating Elev parameter values.
If not None, Elev parameter values will be converted to the default vertical datum before (input values) or after (output values) the rating is performed.
If None, the native vertical datum will be used.
When setting, must be None, NGVD-29, NAVD-99, or OTHER.
Operations:
Read/Write
Rates independent parameter values and returns dependent parameter values.
The times of the values are used in conjuction with the effective times of the individual ratings and rating set specification lookup methods to determine which ratings in the rating set are used - and the manner in which they are used - to compute the rated values.
Arguments:
- input (Union[list[float], list[list[float]]): The input (independnent parameter(s)) values.
- If specified as a float or a list of floats (for rating a single input value set using a single- or multi-independent-parameter rating set):
- The list must be of the same length as the number of independent parameters of the rating set.
- The
timesparameter is used, if specified - The
units, if specified, is the unit of each independent and dependent parameter. - A single float is returned
- If specified as a list of lists of floats (for rating a list of input value sets using a single- or multi-independent-parameter rating set):
- The list must be of the same length as the number of independent parameters of the rating set.
- Each list of values must have the same times and be of the same length
- The
timesparameter is used, if specified - The
units, if specified, is the unit of each independent and dependent parameter. - A list of floats is returned
- If specified as a TimeSeries (for rating a single time series using a single-independent-parameter rating set):
- The rating set must have a single independent parameter
- The
timesparameter is not used and will cause an exception if specified - The
unitsparameter, if specified, is the unit of the rated time series - A time series is returned
- If specified as a list of TimeSeries (for rating a list of time series using a multi-independent-parameter rating set):
- The list must be of the same length as the number of independent parameters of the rating set.
- The
timesparameter is not used and will cause an exception if specified - The
unitsparameter, if specified, is the unit of the rated time series - A time series is returned
- If specified as a float or a list of floats (for rating a single input value set using a single- or multi-independent-parameter rating set):
- times (Optional[Union[datetime, list[datetime]]], must be passed by name): The date/times of the independent parameter values. Defaults to None.
- If specified and not None:
- Specifying a datetime object is the same as specifying that datetime object in a list of length 1.
- If shorter than the independent parameter value list(s), the last time will be used for the remainging values.
- If longer than the independent parameter values list(s), the beginning portion of the list will be used.
- If
Noneor not specified:- If the rating set's default data time is not None, that time is used for each value
- If the rating set's default data time is None, the current time is used for each value
- If specified and not None:
- units (Optional[str], must be passed by name): Defaults to None.
- If
inputis a list of floats or a list of list of floats:- Specifies units of the independent parameter values and the rated values as comma-delimited string of independent value units concatendated with a semicolon and the dependent parameter unit (e.g., "ft;ac-ft", "unit,ft,ft;cfs").
- If not specified or None:
- The rating's default data units, if any, are used
- If the rating has no default data units, an exception is raised.
- If
inputis a TimeSeries or list of TimeSeries:- Specifies the unit of the rated (dependent parameter) time series.
- If not specified or None:
- The rating's default data units, if any, are used
- If the rating has no default data units, an exception is raised.
- If
- vertical_datum (Optional[str], must be passed by name): Defaults to None.
- If
inputis a list of floats or a list of list of floats, this specifies:- Specifies:
- The vertical datum of any input (independent parameter) elevation values
- The desired vertical datum of any rated (dependent parameter) elevation values.
- If None, or not specified, the location's native vertical datum is used.
- Specifies:
- If
inputis a TimeSeries or list of TimeSeries:- Specifies only the desired vertical datum for any rated (dependent parameter) elevation values.
- Any input (independent parameter) elevation values will be in the vertical datum of the input time series.
- If None, or not specified, the location's native vertical datum is used.
- If
- rating_time (Optional[datetime], must be passed by name): The maximum effective time and creation time for the rating set to use to perform the rating. Defaults to None. Causes the rating to be performed as if the current date/time were the specified time (no ratings with effective times or creation times later than this time will be used).
- round (bool, optional, must be passed by name): Whether to use the rating set's specification's dependent rounding specification . Defaults to False.
Returns:
Any: The dependent parameter value(s) as described in
inputabove
Rates dependent parameter values and returns independent parameter values.
May only be used on rating sets with a single independent parameter.
| Important Note |
|---|
Unlike single-independent-parameter ratings, two-dimensional (time and parameter value) rating sets are not
generally invertible. That is, if you rate value x at time t using a rating set to generate value y, using
the same rating set to reverse rate value y at time t will generally not result in x.
|
Arguments:
- input (Union[float, list[float], TimeSeries]): The input (dependent parameter) value(s).
- If specified as a float (for reverse rating a single dependent parameter value using a single-independent-parameter rating set):
- The
timesparameter is used, if specified - The
units, if specified, is the unit of each independent and dependent parameter. - A float is returned
- The
- If specified as a lists of floats (for reverse rating a multiple dependent parameter values using a single-independent-parameter rating set):
- The
timesparameter is used, if specified - The
units, if specified, is the unit of the independent and dependent parameters as shown below. - A list of floats is returned
- The
- If specified as a TimeSeries (for reverse rating a dependent parameter time series using a single-independent-parameter rating set):
- The
timesparameter is not used and will cause an exception if specified - The
unitsparameter, if specified, is the unit of the reverse rated time series - A time series is returned
- The
- If specified as a float (for reverse rating a single dependent parameter value using a single-independent-parameter rating set):
- times (Optional[list[datetime]], must be passed by name): The date/times of the independent parameter value(s). Defaults to None.
- If specified and not None:
- Specifying a datetime object is the same as specifying that datetime object in a list of length 1.
- If shorter than the independent parameter value list(s), the last time will be used for the remainging values.
- If longer than the independent parameter values list(s), the beginning portion of the list will be used.
- If
Noneor not specified:- If the rating set's default data time is not None, that time is used for each value
- If the rating set's default data time is None, the current time is used for each value
- If specified and not None:
- units (Optional[str], must be passed by name): Defaults to None.
- If
inputis a list of floats:- Specifies units of the independent parameter value and the dependent parameter values as the independent value units concatendated with a semicolon and the dependent parameter unit (e.g., "ft;ac-ft").
- If not specified or None:
- The rating's default data units, if any, are used
- If the rating has no default data units, an exception is raised.
- If
inputis a TimeSeries:- Specifies the unit of the reverse rated (independent parameter) time series.
- If not specified or None:
- The rating's default data units, if any, are used
- If the rating has no default data units, an exception is raised.
- If
- vertical_datum (Optional[str], must be passed by name): Defaults to None.
- If
inputis a list of list of floats, this specifies:- Specifies:
- The vertical datum of any input (dependent parameter) elevation value
- The desired vertical datum of any reverse rated (independent parameter) elevation values.
- If None, or not specified, the location's native vertical datum is used.
- Specifies:
- If
inputis a TimeSeries:- Specifies only the desired vertical datum for any reverse rated (independent parameter) elevation values.
- Any input (dependent parameter) elevation values will be in the vertical datum of the input time series.
- If None, or not specified, the location's native vertical datum is used.
- If
- rating_time (Optional[datetime], must be passed by name): The maximum effective time and creation time for the rating set to use to perform the reverse rating. Defaults to None. Causes the reverse rating to be performed as if the current date/time were the specified time (no ratings with effective times or creation times later than this time will be used).
- round (bool, optional, must be passed by name): Whether to use the rating set's specification's dependent rounding specification . Defaults to False.
Returns:
Any: The dependent parameter value(s) as described in
inputabove
The vertical datum info of the rating set's specification's location, if any
Operations:
Read-Only