2.6. floodestimation.collections — Common sets of catchments

This module contains collections for easy retrieval of standard lists or scalars from the database with gauged catchment data.

class floodestimation.collections.CatchmentCollections(db_session, load_data='auto')[source]

Collections of frequently used floodestimation.entities.Catchment objects.

The collections objects must be passed a session to a database containing the data. This is typically floodestimation.db.Session()

Parameters:
  • db_session (sqlalchemy.orm.session.Session) – SQLAlchemy database session
  • load_data (str) –
    • auto: automatically load gauged catchment data from NRFA website if required
    • force: delete all exsting data first
    • manual: manually retrieve data
Returns:

a catchment collection object

Return type:

CatchmentCollections

catchment_by_number(number)[source]

Return a single catchment by NRFA station number

Parameters:number (int) – NRFA gauging station number
Returns:relevant catchment if exist or None otherwise
Return type:floodestimation.entities.Catchment
nearest_qmed_catchments(subject_catchment, limit=None, dist_limit=500)[source]

Return a list of catchments sorted by distance to subject_catchment and filtered to only include catchments suitable for QMED analyses.

Parameters:
  • subject_catchment (floodestimation.entities.Catchment) – catchment object to measure distances to
  • limit (int) – maximum number of catchments to return. Default: None (returns all available catchments).
  • dist_limit (float or int) – maximum distance in km. between subject and donor catchment. Default: 500 km. Increasing the maximum distance will increase computation time!
Returns:

list of catchments sorted by distance

Return type:

list of floodestimation.entities.Catchment

most_similar_catchments(subject_catchment, similarity_dist_function, records_limit=500, include_subject_catchment='auto')[source]

Return a list of catchments sorted by hydrological similarity defined by similarity_distance_function

Parameters:
  • subject_catchment (floodestimation.entities.Catchment) – subject catchment to find similar catchments for
  • similarity_dist_function – a method returning a similarity distance measure with 2 arguments, both floodestimation.entities.Catchment objects
  • include_subject_catchment (str) –
    • auto: include subject catchment if suitable for pooling and if urbext < 0.03
    • force: always include subject catchment having at least 10 years of data
    • exclude: do not include the subject catchment
Returns:

list of catchments sorted by similarity

Type:

list of floodestimation.entities.Catchment