pypago.sections¶
Module for the manipulation of section endpoints and gridded section
Functions
correct_gridsec (gridsec, secname, offset, …) |
Function that allows to correct section staircases. |
extract_grid_sections (grid, sectionslist) |
Extract a list of GridSection objects from a grid object (containing coordinates and scale factors) and a list of section endpoints. |
Classes
GridSection (grid, section) |
Gridded section object |
Section (name, lon, lat, dire) |
Section endpoint object. |
-
class
GridSection
(grid, section)[source]¶ Gridded section object
-
_finalisesection
(grid)[source]¶ Function that performs the computation of section staircases. The sections arguments are the good sections which have been returned by the
pypago.sec.initsections()
. It creates a list of PyPAGO objects, each containing the sections’ properties (areavect, veci, vecj, depthvect, lvect, etc)Parameters: - sections (list) – list of the good sections, obtained by the
pypago.sec.initsections()
function - grid (pago_obj) – Pago object that contains all the model attributes (area, depthvect, scale factor, etc…)
- sections (list) – list of the good sections, obtained by the
-
_initsection
(grid, section)[source]¶ Function which allows to initialise the model sections from the sections’ endpoints, the model longitude and latitudes. The index of the sections which are out of the domain (should not be further processed) are stored in a list. If the section is in the domain, the i,j indexes of its endpoints and the directions of the segments are stored in a PyPAGO object.
Parameters: - sections (list) – list of PyPAGO objects that contains the sections’ endpoints
- lont (numpy.array) – longitude of the model subdomain
- latt (numpy.array) – latitude of the model subdomain
Returns: a list (index_badsec) that contains the indexes of the bad sections and a list (goodsec) that contains the PyPAGO objects of the good sections, containing the section endpoints locations in the model grid
-
plotsecfaces
(axes=None, **kwargs)[source]¶ Draws a gridded section as ‘staircase’, with grid points as the x and y coordinates.
Should be plotted on a map background that shows the mask variables. Must be used to check whether the all the dots associated with one section are on the same side of the line
Parameters: - axes (matplotlib.axes.Axes) – The
matplotlib axes
instance where to draw the lines - kwargs (dict) – Additional arguments to the plot function
Returns: The color of the line
Return type: list|str|unicode
- axes (matplotlib.axes.Axes) – The
-
-
correct_gridsec
(gridsec, secname, offset, position)[source]¶ Function that allows to correct section staircases. Especially useful in order to correct sections’ junctions. It extracts the section variables (veci, vecj, etc) along the length coordinates, from offset to end or from start to offset, depending on the value of position argument.
Parameters: - sec (list) – section list that contains the PyPAGO
objects, containing the veci, vecj, vect, … obtained
from the
pypago.pypago_sec.finalisesections()
- secname (type) – section points to correct
- offset (int) – number of points to remove
- position (str) – {‘start’,’end’} whether we remove the first (position=’start’) or last (position=’end’) points.
Warning
The input list is modified
- sec (list) – section list that contains the PyPAGO
objects, containing the veci, vecj, vect, … obtained
from the
-
extract_grid_sections
(grid, sectionslist)[source]¶ Extract a list of GridSection objects from a grid object (containing coordinates and scale factors) and a list of section endpoints.
Parameters: - grid (pypago.grid.Grid) – Input grid containing the coordinates, mask and scale factors.
- sectionslist (list) – List of pypago.sections.Section objects, containing section endpoints definitions.
Returns: A tuple containing the section in the model world (pypago.sections.GridSection objects) and the indexes of the discarded sections (i.e. sections out of the domain)