geocontour.geocontour module

Functions for construction of geocontours from contours

Notes

Is it nonsensical that a package named geocontour contains a module named geocontour which is used to build something referred to as a geocontour? Yes. Is the developer sorry they chose to do it this way? Also yes.

geocontour.geocontour.build(contour, latitudes, longitudes, connecttype='cell', simplify=False)

Construct a geocontour from a contour input

Parameters:
  • contour (ndarray) – 2D Nx2 array of ordered latitude/longitude points (degrees) describing the edge of a mask

  • latitudes (ndarray, optional) – 1D Nx1 array of latitude points (degrees)

  • longitudes (ndarray, optional) – 1D Nx1 array of longitude points (degrees)

  • connecttype ({'cell', 'center'}, default='cell') –

    method of linking contour cells

    cell

    implies drawing a single connection through a cell from the preceding to the following cell, resulting in a geocontour the same length as the input contour

    center

    implies drawing two lines through a cell, intersecting the center of the cell, resulting in a geocontour double the length of the input contour

  • simplify (bool, default=False) – select whether to remove cells for which outward vectors sum to 0, and merge cells containing multiple contour segments

Returns:

geocontour – 3D Nx2x5 array defining a list of N contour cells (column 1), their edge points (columns 2,3), segment lengths (column 4), and outward unit vectors (column 5)

Return type:

ndarray

Notes

  • Both connecttype methods functionally provide the same output when using the geocontour with data

  • Simplification will functionally reduce size and provide the same output when using the geocontour with data, but the directional information contained in the contour may not be preserved