pypago.plot

Module that contains various functions dedicated to plotting using PyPAGO

Functions

contourplot(secstruct, vartoplot, istracer) Contourplot of a variable contained in a gridded section.
pcolplot(secstruct, vartoplot, istracer[, …]) Pcolor of a variable contained in a gridded section.
plot_dom_mask(grid[, gridsec, mask, ax]) Draws the final plot.
preplot(secstruct, secdata, istracer) Function that prepares a section tracer (T or S array) variable to do both a contourf and a pcolor plot.
_data_prep(secstruct, vartoplot, istracer=None, itime=None)[source]

Data extraction, preparation and masking prior to plotting

_make_atracer_pcol(atracer)[source]

Returns the field vector for a pcolor plot

Parameters:atracer (numpy.array) – vector that contains the field array without the duplications (obtained with the pypago.plot._nodouble_tsr() or pypago.plot._nodouble_v())
Returns:array that contains the field array formatted for a pcolor plot
Return type:numpy.array
_make_lvect_pcol(lvect)[source]

Returns the length vector for a pcolor plot

Parameters:lvect (numpy.array) – length vector
Returns:array that contains the lvect array formatted for a pcolor plot
Return type:numpy.array
_make_zvect_pcol(zvect)[source]

Returns the depth vector for a pcolor plot.

Parameters:zvect (numpy.array) – vector that contains the zvect array without the duplications (obtained with the pypago.plot._nodouble_tsr() module)
Returns:array that contains the zvect array formatted for a pcolor plot
Return type:numpy.array
_nodouble_tsr(veci, vecj, vectsr)[source]

Returns the tracer field after removing the duplicated values of (veci, vecj)

Parameters:
  • veci (numpy.array) – i indexes of the section
  • vecj (numpy.array) – j indexes of the section
  • vectsr (numpy.array) – tracer field of the section
Returns:

the tracer field without the duplications

Return type:

list

_nodouble_v(veci, vecj, vecv)[source]

Returns the velocity field after removing the duplicated values of (veci, vecj)

Warning

Relies on the assumption that all sections go from West to East

Parameters:
  • veci (numpy.array) – i indexes of the section
  • vecj (numpy.array) – j indexes of the section
  • vecv (numpy.array) – velocity field of the section
Returns:

the new velocity

Return type:

numpy.array

contourplot(secstruct, vartoplot, istracer, itime=None, ax=None, **kwargs)[source]

Contourplot of a variable contained in a gridded section.

Parameters:
  • secstruct (pypago.sections.GridSection) – Gridded section
  • vartoplot (str) – Variable to plot
  • istracer (bool) – True if tracer field (i.e. temperature), False if velocity field (or transport field).
  • itime (int) – Time index to extract. If None, temporal mean is computed
  • ax (ax) – Axis. If None, gca()
Returns:

cs, cb

pcolplot(secstruct, vartoplot, istracer, itime=None, ax=None)[source]

Pcolor of a variable contained in a gridded section.

Parameters:
  • secstruct (pypago.sections.GridSection) – Gridded section
  • vartoplot (str) – Variable to plot
  • istracer (bool) – True if tracer field (i.e. temperature), False if velocity field (or transport field).
  • itime (int) – Time index to extract. If None, temporal mean is computed
  • ax (ax) – Axis. If None, gca()
Returns:

cs, cb

plot_dom_mask(grid, gridsec=None, mask=None, ax=None)[source]

Draws the final plot. It draws the model mask and the model sections, and it fills the mask of the area

Parameters:
  • grid (pago_obj) – PyPAGO object that contains the model grid
  • gridsec (pago_obj) – PyPAGO object that contains the model sections
  • mask (numpy.array) – mask of the area
preplot(secstruct, secdata, istracer)[source]

Function that prepares a section tracer (T or S array) variable to do both a contourf and a pcolor plot.

Parameters:
  • secstruct (pago_obj) – The PyPAGO object that contains the section variables (veci, vecj, etc.)
  • secdata (numpy.array) – Array that contains the value to plot (vect or vecs, could be a mean, a snapshot, etc.)
  • istracer (str) – True if a tracer field (vect, vecs) is plotted