pymgp.orbplot.rewrap2d#
- pymgp.orbplot.rewrap2d(x, y, method='rewrap', xwrapat=[-180, 180], ywrapat=[-90, 90], verbose=0)[source]#
Rewrap cyclic x and y data for plotting line segments.
Re-wrap cyclic data in two dimensions and insert breaks in the lines so that when plotted they are properly terminated at the borders of the 2D wrapping region. This function solves two issues with plotting lines for cyclic data:
the near vertical and horizontal line segments at the wraps,
lines do not extend to the wrapping boundaries (instead they take the opposite direction)
If unsolved, line plots on cyclic data can be misleading or unclear at best, while a scatter plot may not provide all the information.
This version corrects for wraps in both the x and y data. The default values are choosen to operate typically on longitude (x) and latitude (y) data for mapping purposes.
- Parameters:
- x, yarray_like, float
The absissae (x) and ordinates (y), e.g. longitude and latitude
- method{‘rewrap’, ‘unwrap’, split’, rewrap_nosplit’}, optional
- The rewrapping method. Defines what action is taken at a data wrap
- rewrapestimate time of wrap by interpolation from the data, and insert
the upper/lower wrap limits and ‘np.nan’ to cause a split in the line. The output arrays are larger than the the input arrays (3 additional data points per wrap)
- splitsplit the lines at a wrap by inserting ‘np.nan’. The output arrays
are larger than the the input arrays (1 additional data point per wrap)
unwrap : make the data continuous. The length of the arrays is unchanged
- xwrapat, ywrapatlist, optional
List with the lower and upper wrap boundaries.
- verboseint, optional
Vebosity level.
- Returns:
- xout, youtndarray, float
The rewrapped abcissae (x) and rewrapped ordinates (y) for plotting
- insndarray, int64
Index array for ‘np.insert’, can be applied to other arrays (‘z’) of similar shape with ‘zout = np.insert(z, ins, new_z_values_to_insert)’
See also
rewrap
Rewrap cyclic data in one dimension.
Notes
The ouput should only be used for plotting purposes, as with some options interpolated data points and/or np.nan are inserted which could bias scientific analysis.