caesarplotlib package

Submodules

caesarplotlib.labellines module

Created on Mon Oct 10 16:09:29 2016

@author: NauticalMile @stackoverflow: http://stackoverflow.com/questions/16992038/inline-labels-in-matplotlib

caesarplotlib.labellines.labelLine(line, x, label=None, align=True, **kwargs)[source]
caesarplotlib.labellines.labelLines(lines, align=True, xvals=None, **kwargs)[source]

caesarplotlib.timeseriesplot module

Caesar Lisflood timeseries plotting tools

This module is for plotting output fromt the CAESAR-Lisflood model timeseries files (i.e. the .dat file from a simulation, if you’ve stuck with the default naming convention.)

author:DAV
class caesarplotlib.timeseriesplot.CaesarTimeseriesPlot(data_dir, fname, datametric, time_delta=60, time_label='hours', colormap='jet')[source]

Bases: object

This class creates objects composed of matplotlib figures and axes, that display the timeseries plotted data.

There are methods for extracting data from input files, and plotting it in different formats.

add_line_labels()[source]

Experimental. Adds text labels to individual lines in the hydrograph plots. Positioning of the labels can sometimes be a bit weird, so use with trial and error.

create_inset_axes()[source]
get_datametric_array(filename, data_name)[source]

Reads data into an array from a filename, which should be the caesar-lisflood output file. (.dat”)

Parameters:
  • filename – Full path to the filename
  • data_name – Name of the measurement you want to plot.
Supported metrics (data_name) are:
time_step q_losflood q_topmodel sed_tot d1, d2, d3, ..., d9 (i.e. Grain size fraction amounts) cumulative_sed_tot
make_line_label(fname)[source]
plot_ensemble_hydrograph(draw_inset=False, labellines=False)[source]

Plots multiple hydrographs on the same axes

plot_external_data(filename)[source]

Plots external data, such as recorded discharge from a gauging station

plot_hydrograph(current_timeseries=None, draw_inset=False, ax_inset=None)[source]

Plots a hydrograph

plot_inset(x_data, y_data)[source]

Plots an inset window to show a zooomed in portion of the graph

plot_legend()[source]

Plots the legend

save_figure(save_name='test.png')[source]
set_labels()[source]

Returns formatted labels from a dictionary based on the data_name supplied in get_data_metric_array()

showfig()[source]

Note: this will only work in GUI. If you are using an IPython console session, for example, just type CatchmentPlot.fig to re-draw the figure in the console.

caesarplotlib.timeseriesplot.convert_timestep(time_step, time_delta, time_label)[source]

This converts a unitless timestep from model output, for example, into one with units based on the difference between timesteps and the time unit

caesarplotlib.timeseriesplot.create_data_arrays(data_dir, input_raster1, input_raster2)[source]

This function creates data arrays from two input rasters.

Parameters:
  • data_dir – The path to your rasters
  • input_raster1 – The name of raster 1, with extension
  • input_raster2 – The name of raster 2, with extension
Returns:

Two numpy arrays, containing the raster data.

Author:

DAV

caesarplotlib.timeseriesplot.plot_scatter_rasterdata(data_array1, data_array2)[source]

Plots data from a raster dataset as an x-y scattergraph.

So if you have two rasters, one of elevation, and one of erosion, you could plot erosion amount as a function of elevation.

Parameters:
  • data_array1 – A numpy array
  • data_array2 – Another numpy array

Module contents

Created on Mon Dec 5 16:00:30 2016

@author: dav