auromat.draw_helpers module¶
Internal module used by the .draw module.
-
class
auromat.draw_helpers.
MplColors
¶ Bases:
tuple
MplColors(facecolor, textcolor)
-
facecolor
¶ Alias for field number 0
-
textcolor
¶ Alias for field number 1
-
-
auromat.draw_helpers.
createPolygonsAndColors
(latDeg, lonDeg, rgb, colorMode=None)[source]¶ Returns polygons (in lat/lon coords) and a color for each polygon.
Parameters: - latDeg – latitude for each pixel corner (h+1,w+1)
- lonDeg – longitude for each pixel corner (h+1,w+1)
- rgb – RGB array of (h,w,3) shape
- colorMode – ‘matplotlib’ normalizes colors to [0,1]
Return type: verts of shape (h*w,4,2), colors of shape (h*w,3)
-
auromat.draw_helpers.
ensureContinuousPath
(points)[source]¶ Reorders a maximum of two logical segments in the given path whose points must be at most one (also diagonal) pixel apart.
For example, the first segment goes from the middle to the right, and the second from the left to the middle. This function detects and swaps the two segments such that one continuous segment results.
Parameters: points – shape (n,2) Return type: points with segments swapped, or original array if no swap necessary
-
auromat.draw_helpers.
fixDiscontinuityPolys
(verts, colors)[source]¶ Splits polygons which cross the 180deg discontinuity into two parts.
NOTE: The vertices must lie on a regular lat/lon grid!
Currently not used, see comment on _drawPolygons.
Parameters: - verts – (n,4,2) in degrees (:,:,0 = lat)
- colors – (n,3)
-
auromat.draw_helpers.
generatePolygonsFromMapping
(mapping, colorMode=None, coordsFn=None)[source]¶ Parameters: colorMode – ‘matplotlib’ normalizes colors to [0,1]
-
auromat.draw_helpers.
loadFigImage
(im)[source]¶ Return a matplotlib Figure with the given raster image spanning the plot extents and with data coordinates equal to pixel coordinates. All axis and labels are hidden.
Parameters: im – either path to image file, or RGB image array in uint8 or uint16 type Return type: tuple(Figure,Axes)
-
auromat.draw_helpers.
overlapPolygons
(verts)[source]¶ See https://github.com/matplotlib/matplotlib/issues/2823
NOTE: the bigger the polygons, the higher the resulting error