runtraj.Bounds.contains#
- Bounds.contains(longitude, latitude)[source]#
Return whether each point is in the box, counting longitudes modulo 360.
A longitude is in the box when, counted east from
xmin, it is within the box’s width, so a box may cross the dateline (xmin=170,xmax=-170) or reach past 180 (xmax=190), and-175and185are the same meridian. A box 360 degrees wide or more holds every longitude. Points on an edge are inside; the longitude edges allow1e-9degree for rounding, since a sum such as184.7 + 175.3need not give exactly 360. A point with a missing coordinate is not in the box.- Parameters:
- Returns:
One value per point (a 0-d array for scalars).
- Return type:
Examples
>>> import runtraj >>> utah = runtraj.Bounds(xmin=-114, xmax=-109, ymin=37, ymax=42) >>> bool(utah.contains(-111.9, 40.8)) True >>> bool(utah.contains(-111.9, 45.0)) False
A box may cross the dateline, and
-175and185are one meridian:>>> pacific = runtraj.Bounds(xmin=170, xmax=-170, ymin=-10, ymax=10) >>> pacific.contains([175, -175, 185, 0], 0).tolist() [True, True, True, False]