Skip to content

Plots

LakePlotter

Plot the lake CSV output.

Class for reading the lake CSV file and creating common timseries plots on matplotlib Axes objects.

Attributes:

Name Type Description
lake_csv_path str

Path to the lake CSV file

lake_pd DataFrame

Pandas DataFrame of the lake CSV.

__init__(lake_csv_path)

Initialise LakePlotter with the lake CSV file path.

Parameters:

Name Type Description Default
lake_csv_path str

Path to the lake CSV file.

required

plot_heat_balance_comps(ax, longwave_param_dict={}, shortwave_param_dict={}, latent_heat_param_dict={}, sensible_heat_param_dict={})

Line plot of lake heat balance components.

Plots a timeseries of the following heat balance components (W/m^2)) to a matplotlib Axes object: mean longwave radiation, mean shortwave radiation, mean latent heat, mean sensible heat.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
longwave_param_dict dict

Dictionary of keyword arguments to customise the plot method for Daily Qlw. Default is {}.

{}
shortwave_param_dict dict

Dictionary of keyword arguments to customise the plot method for Daily Qsw. Default is {}.

{}
latent_heat_param_dict dict

Dictionary of keyword arguments to customise the plot method for Daily Qe. Default is {}.

{}
sensible_heat_param_dict dict

Dictionary of keyword arguments to customise the plot method for Daily Qh. Default is {}.

{}

Returns:

Type Description
list of Line2D

A list of lines representing the plotted data.

plot_surface_area(ax, param_dict={})

Line plot of lake surface area.

Plots a timeseries of lake surface area (m^2) to a matplotlib Axes object.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
param_dict dict

Dictionary of keyword arguments to customise the plot method. Default is {}.

{}

Returns:

Name Type Description
out List[Line2D]

A list of lines representing the plotted data.

plot_surface_height(ax, param_dict={})

Line plot of lake surface height.

Plots a timeseries of the lake level (m) to a matplotlib Axes object.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
param_dict dict

Dictionary of keyword arguments to customise the plot method. Default is {}.

{}

Returns:

Name Type Description
out List[Line2D]

A list of lines representing the plotted data.

plot_surface_temp(ax, param_dict={})

Line plot of lake surface temperature.

Plots a timeseries of the lake surface temperature (celsius) to a matplotlib Axes

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
param_dict dict

Dictionary of keyword arguments to customise the plot method. Default is {}.

{}

Returns:

Name Type Description
out List[Line2D]

A list of lines representing the plotted data.

plot_temp(ax, min_temp_param_dict={}, max_temp_param_dict={})

Line plot of minimum and maximum lake temperature.

Plots a timeseries of the minimum and maximum lake temperature (celsius) to a matplotlib Axes object.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
min_temp_param_dict dict

Dictionary of keyword arguments to customise the plot method for Min Temp. Default is {}.

{}
max_temp_param_dict dict

Dictionary of keyword arguments to customise the plot method for Max Temp. Default is {}.

{}

Returns:

Name Type Description
out List[Line2D]

A list of lines representing the plotted data.

plot_volume(ax, param_dict={})

Line plot of lake volume.

Plots a timeseries of lake volume (m^3) to a matplotlib Axes object.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
param_dict dict

Dictionary of keyword arguments to customise the plot method. Default is {}.

{}

Returns:

Name Type Description
out List[Line2D]

A list of lines representing the plotted data.

plot_water_balance(ax, param_dict={})

Line plot of lake water balance.

Plots a timeseries of the net water balance (m^3/day) to a matplotlib Axes object. Calculated by: Rain + Snowfall + Local Runoff + Tot Inflow Vol + Evaporation - Tot Outflow Vol.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
param_dict dict

Dictionary of keyword arguments to customise the plot method. Default is {}.

{}

Returns:

Name Type Description
out List[Line2D]

A list of lines representing the plotted data.

plot_water_balance_comps(ax, inflow_param_dict={}, outflow_param_dict={}, overflow_param_dict={}, evaporation_param_dict={}, rain_param_dict={}, runoff_param_dict={}, snowfall_param_dict={})

Line plot of lake water balance components.

Plots a timeseries of the following water balance components (m^3) to a matplotlib Axes object: total inflow, total outflow, overflow, evaporation, rain, local runoff, and snowfall.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
inflow_param_dict dict

Dictionary of keyword arguments to customise the plot method for Tot Inflow Vol. Default is {}.

{}
outflow_param_dict dict

Dictionary of keyword arguments to customise the plot method for Tot Outflow Vol. Default is {}.

{}
overflow_param_dict dict

Dictionary of keyword arguments to customise the plot method for Overflow Vol. Default is {}.

{}
evaporation_param_dict dict

Dictionary of keyword arguments to customise the plot method for Evaporation. Default is {}.

{}
rain_param_dict dict

Dictionary of keyword arguments to customise the plot method for Rain. Default is {}.

{}
runoff_param_dict dict

Dictionary of keyword arguments to customise the plot method for Local Runoff. Default is {}.

{}
snowfall_param_dict dict

Dictionary of keyword arguments to customise the plot method for Snowfall. Default is {}.

{}

Returns:

Name Type Description
out List[Line2D]

A list of lines representing the plotted data.

NCPlotter

Plot NetCDF outputs.

Class for plotting the GLM output NetCDF file.

Attributes:

Name Type Description
glm_nc_path str

Path to the output NetCDF file.

resolution float

Resolution of the depth range (m).

ice_height bool

Include ice when calculating surface height.

white_ice_height bool

Include white ice when calculating surface height.

snow_height bool

Include snow when calculating surface height.

__init__(glm_nc_path, resolution=0.1, ice_height=False, white_ice_height=False, snow_height=False)

Initialise NCPlotter with the output NetCDF file path.

Parameters:

Name Type Description Default
glm_nc_path str

Path to the output NetCDF file.

required
resolution float

Resolution of the depth range (m).

0.1
ice_height bool

Include ice when calculating surface height.

False
white_ice_height bool

Include white ice when calculating surface height.

False
snow_height bool

Include snow when calculating surface height.

False

get_long_name(var_name)

Get the long name description of a variable.

Parameters:

Name Type Description Default
var_name str

Name of the variable.

required

Returns:

Name Type Description
long_name str

Long name description of the variable.

get_profile_var_names()

Gets a list of variable names plottable with plot_profile().

Returns:

Name Type Description
var_names List[str]

Names of plottable variables.

get_start_datetime()

Get the simulation start time.

Returns:

Name Type Description
start datetime

Start time of the GLM simulation.

get_units(var_name)

Get the units of a variable.

Parameters:

Name Type Description Default
var_name str

Name of the variable.

required

Returns:

Name Type Description
unit str

Units of the variable.

get_zone_var_names()

Gets a list of variable names plottable with plot_zone().

Returns:

Name Type Description
var_names List[str]

Names of plottable variables.

plot_profile(ax, var_name, reference='bottom', param_dict={})

Raster plot of a variable profile.

Plots a variable for all depths and timesteps to a matplotlib Axes object.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
var_name str

Name of the variable to plot. To list valid variables, see the get_profile_var_names() method.

required
reference str

Reference frame for depth, either 'bottom' or 'surface'. Default is "bottom".

'bottom'
param_dict dict

Dictionary of keyword arguments to customise the imshow method. Default is {}.

{}

Returns:

Name Type Description
out AxesImage

The plotted image object.

plot_zone(ax, var_name, zone, param_dict={})

Line plot of a variable for a specified sediment zone.

Variables compatiable with plot_zone() are those returned by get_zone_var_names(). The number of valid zones equals n_zones in the sediment block of the glm nml.

Parameters:

Name Type Description Default
ax Axes

The Axes to plot on.

required
var_name str

Name of the variable to plot. To list valid variables, see the get_zone_var_names() method.

required
zone int

Zone number. Must be 0 < zone <= n_zones.

required
param_dict dict

Parameters passed to matplotlib.axes.Axes.plot. Default is {}.

{}

Returns:

Name Type Description
out AxesImage

The plotted image object.

WQPlotter

Plot WQ CSV outputs.

Class for reading the WQ CSV file, returning variable names, and plotting variables to a matplotlib Axes object.

Attributes:

Name Type Description
wq_csv_path str

Path to the WQ CSV file

wq_pd DataFrame

Pandas DataFrame of the WQ CSV.

__init__(wq_csv_path)

Initialise WQPlotter with the WQ CSV file path.

Parameters:

Name Type Description Default
wq_csv_path str

Path to the WQ CSV file.

required

get_var_names()

Returns a list of plottable with plot_var().

Returns:

Name Type Description
vars List[str]

List of variable names.

plot_var(ax, var_name, param_dict={})

Line plot of a WQ CSV variable.

Plots a valid variable from get_vars() to a matplotlib Axes object. An optional dictionary of keyword arguments can be provided to customise matplotlib's plot() method.

Parameters:

Name Type Description Default
ax Axes

The matplotlib Axes object to plot on.

required
var_name str

The name of the variable to plot.

required
param_dict dict

Dictionary of keyword arguments to customise the plot method. Default is {}.

{}

Returns:

Name Type Description
out List[Line2D]

A list of lines representing the plotted data.