Calculator

eflowcalc.calculator(sfcs, datetimes, streamflows, drainage_area, hydro_year='01/10', years=None, axis=0)

Calculate streamflow characteristics for one time series stored in a 1D array (or several time series of equal length stored in a 2D array). Typically used for streamflow time series for a same period and for a same catchment.

Parameters
sfcs: (sequence of) eflowcalc SFC functions

The (sequence of) streamflow characteristic(s) to be calculated for the given streamflows series.

Parameter example:

sfcs=ma41

Parameter example:

sfcs=(ma41, dh4, ra7)

Parameter example:

sfcs=everything
datetimes: array-like object

The array of datetimes corresponding to the date and time of the streamflows values. Must be uni-dimensional.

streamflows: array-like object

The array of daily streamflow values in cubic metres per second on which to calculate the given sfcs. Note, the array can be one- or two-dimensional. If it is 2D, the time dimension must be the one specified through axis.

drainage_area: int or float

The drainage area of the catchment in square kilometres for which streamflows are provided.

hydro_year: str, optional

The day and month of the beginning of the hydrological (or water) year. Typically ‘01/10’ (i.e. 1st of October) for the Northern Hemisphere, and ‘01/07’ (i.e. 1st of July) for the Southern Hemisphere. If not provided, set to default value ‘01/10’.

years: sequence of int, optional

A sequence of years to use to subset the streamflows series. If not provided, no subset is carried out and the whole series is considered by the calculator.

axis: int, optional

The axis along which the streamflows time dimension is if streamflows is a 2D array. If not provided, set to default value 0 (i.e. time along first axis).

Examples

>>> from datetime import datetime, timedelta
>>> times = [
...     datetime(2010, 1, 1) + timedelta(days=d)
...     for d in range(3652)
... ]
>>> import numpy
>>> numpy.random.seed(7)
>>> flows = numpy.random.uniform(3, 50, 3652)
>>> import eflowcalc as efc
>>> print(
...     efc.calculator(
...         efc.ma1,
...         times, flows, drainage_area=147.
...     )
... )
[26.29431]
>>> print(
...     efc.calculator(
...         [efc.ma1, efc.dh7],
...         times, flows, drainage_area=147.
...     )
... )
[[26.29431  ]
 [ 2.8495195]]

Computations on multiple streamflow series at once are possible.

>>> flows = numpy.random.uniform(3, 50, (3652, 3))
>>> print(
...     efc.calculator(
...         [efc.ma1, efc.dh7],
...         times, flows, drainage_area=147.
...     )
... )
[[26.548698  26.465912  26.271872 ]
 [ 2.4092593  2.8745487  2.2962854]]
>>> flows = numpy.random.uniform(3, 50, (3, 3652))
>>> print(
...     efc.calculator(
...         [efc.ma1, efc.dh7],
...         times, flows, drainage_area=147.,
...         axis=1
...     )
... )
[[26.409723   4.8691554]
 [26.398853   3.6545587]
 [26.251245   3.4656363]]