Table Of Contents

This Page

Plotting flow/discharge information

This module introduces some classes and functions to help plotting hydrographs and flow duration curves. When available, ENSO information can be taken into account.

Plotting hydrographs

class Hydrograph(hyetodata=None, hydrodata=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, linewidth=1.0, frameon=True, subplotpars=None)

Bases: scikits.timeseries.lib.plotlib.TimeSeriesFigure

Defines a subclass of TimeSeriesFigure designed to plot a hydrograph along with one hyetograph.

The figure is dived into two TimeSeriesPlot. The top plot corresponds to the hyetograph (the time evolution of the precipitation). The bottom plot corresponds to the hydrograph (the time evolution of the streamflow).

The two subplots share the same x-axis. Therefore, any modification on one subplot will be reflected on the other subplot.

Parameters:

hyetodata : {None, TimeSeries}

Time series of precipitation.

hydrodata : {None, TimeSeries}

Time series of streamflow.

figsize : {None, tuple}

Size of the figure, as a tuple (width, height) in inches. If None, defaults to rc figure.figsize.

dpi : {None, int}, optional

Resolution in dots per inches. If None, defaults to rc figure.dpi

facecolor : {None, string}, optional

Background color. If None, defaults to rc figure.facecolor.

edgecolor : {None, string}, optional

Border color. If None, defaults to rc figure.edgecolor.

linewidth : {float, None}

Width of the patch edge line.

frameon : {True, False}

Whether to draw the frame around the figure.

Raises:

TypeError :

If the hyetodata or the hydrodata are not valid TimeSeries objects.

ValueError :

If the hyetodata and the hydrodata do not have the same frequency.

Attributes

hydrodata
hyetodata
hydro ClimateSeriesPlot Handle of the subplot corresponding to the hydrograph (bottom subplot).
hyeto ClimateSeriesPlot Handle of the subplot corresponding to the hyetograph (top subplot).

Methods

add_axes
add_axobserver
add_callback
add_csplot
add_ensocomparisonplot
add_subplot
add_tsplot
autofmt_xdate
clear
clf
colorbar
contains
convert_xunits
convert_yunits
delaxes
draw
draw_artist
figimage
findobj
gca
get_agg_filter
get_alpha
get_animated
get_axes
get_children
get_clip_box
get_clip_on
get_clip_path
get_contains
get_dpi
get_edgecolor
get_facecolor
get_figheight
get_figure
get_figwidth
get_frameon
get_gid
get_label
get_picker
get_rasterized
get_size_inches
get_snap
get_tightbbox
get_transform
get_transformed_clip_path_and_affine
get_url
get_visible
get_window_extent
get_zorder
ginput
have_units
hitlist
hold
is_figure_set
is_transform_set
legend
pchanged
pick
pickable
plot_default
plot_hydro
plot_hydrograph
plot_hyeto
plot_hyetograph
properties
remove
remove_callback
savefig
sca
set
set_agg_filter
set_alpha
set_animated
set_axes
set_canvas
set_clip_box
set_clip_on
set_clip_path
set_contains
set_datelimits
set_dpi
set_edgecolor
set_ensoindices
set_facecolor
set_figheight
set_figsize_inches
set_figure
set_figwidth
set_frameon
set_gid
set_label
set_lod
set_picker
set_rasterized
set_size_inches
set_snap
set_transform
set_url
set_visible
set_zorder
subplots_adjust
suptitle
text
update
update_from
waitforbuttonpress
hydrograph(hyetodata, hydrodata, hyetoargs=None, hydroargs=None, num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, subplotpars=None)

Creates a new Hydrograph object.

Parameters:

hyetodata : TimeSeries object

Rainfall input data.

hydrograph : TimeSeries object

Streamflow data

hyetoargs : dictionary, optional

Arguments for the hyetograph plot.

hydroargs : dictionary, optional

Arguments for the hydrograph plot.

num : {None, int}, optional

Number of the figure. If None, a new figure is created and num is incremented.

figsize : {None, tuple}

Size of the figure, as a tuple (width, height) in inches. If None, defaults to rc figure.figsize.

dpi : {None, int}, optional

Resolution in dots per inches. If None, defaults to rc figure.dpi

facecolor : {None, string}, optional

Background color. If None, defaults to rc figure.facecolor.

edgecolor : {None, string}, optional

Border color. If None, defaults to rc figure.edgecolor.

linewidth : {float, None}

Width of the patch edge line.

frameon : {True, False}

Whether to draw the frame around the figure.

Plotting flow duration curves (FDCs)

plot_fdc(series, multimode=True, plot_enso=False, starting_month=None, lag=6, scale='log', xmin=0.00050000000000000001, xmax=0.99950000000000006, ax=None, **kwargs)

Plots one or several flow duration curves (FDCs) for the series.

The input series should be 1D or 2D. By default, if the series is 1D, one curve only will be plotted, whereas if the series is 2D, a curve will be plotted for each line of the series.

A 1D series can also be converted into an annual series with the starting_month parameter. In that case, starting_month should be an integer between 1 and 12 precising the month at which the 12-month period should start. For example, to plot the FDCs for each water year (usually from April to the following March), use starting_month=4.

When enso=True, ENSO phases are plotted with different colors. When the series is 2D or if it has been converted to an annual frequency, the ENSO indices are defined with the full_year=True option, where an ENSO episode lasts at least 12 consecutive months.

Parameters:

series : TimeSeries

Flow data.

ax : {None, matplotlib.axes.Axes}, optional

Subplot where to plot the flow duration curves. If None, use the current plot.

multimode : {True, False}, optional

Whether to interpret a 2D input series as several series or a single one.

starting_month : {None, integer}, optional

First month of each year. If None, plots the global flow duration curve. Otherwise, starting_month must be an integer between 1 and 12, corresponding to the first month of the water year (usually, 4 for April).

plot_enso : {True, False}, optional

Whether to plot each ENSO phase with a different color.

lag : {integer}, optional

Number of months of lag for the definition of ENSO indices. For example, if lag=6, the ENSO phase starting in Oct. 2001 is applied starting on Apr. 2002. If None, use a lag computed as the time difference between starting_month and the first month of the reference season of the ENSO indicator (or October if undefined).

scale : {‘log’,’lin’}, optional

String indicating whether the x-axis is in log ('log') or linear ('lin') scale. If 'log', each plotting position is expressed as a Gaussian pdf.

other parameters : :

The parameters recognized by the matplotlib.pyplot.plot function are also recognized.

Raises:

TypeError :

If plot_enso=True but the series is not a ClimateSeries.

ValueError :

  • If starting_month is not between 1 and 12.
  • If starting_month is defined but the initial series is not 1D.