pyinterp.geometry.geographic.Ring#
- class pyinterp.geometry.geographic.Ring(self)#
- class pyinterp.geometry.geographic.Ring(self, lon: numpy.ndarray[dtype=float64, shape=(*), writable=False], lat: numpy.ndarray[dtype=float64, shape=(*), writable=False])
Bases:
objectA ring (closed linestring) in geographic coordinates.
A ring is a closed sequence of points used as polygon boundaries. The ring automatically closes itself (the last point connects back to the first).
Examples
>>> import numpy as np >>> from pyinterp.geometry.geographic import Ring Create a square ring
>>> lon = np.array([0.0, 10.0, 10.0, 0.0, 0.0]) >>> lat = np.array([0.0, 0.0, 10.0, 10.0, 0.0]) >>> ring = Ring(lon, lat) >>> len(ring) 5
Overloaded function.
__init__(self) -> None
Construct an empty ring.
__init__(self, lon: numpy.ndarray[dtype=float64, shape=(*), writable=False], lat: numpy.ndarray[dtype=float64, shape=(*), writable=False]) -> None
Construct a ring from longitude and latitude arrays.
- Parameters:
lon – Array of longitude values in degrees.
lat – Array of latitude values in degrees (must have same size as lon).
- Raises:
ValueError – If lon and lat arrays have different sizes.
Public Methods
append(self, point)Append a point to the ring.
clear(self)Remove all points from the ring.
to_arrays(self)Get the coordinate arrays of the ring points.
Special Methods
__bool__(self)Return True if the ring is not empty.
__eq__(self, other)Check if two rings are equal.
__getitem__(self, idx)Get the point at the given index.
__getstate__(self)Return the serialized state for pickling.
__iter__(self)Return an iterator over the points in the ring.
__len__(self)Return the number of points in the ring.
__ne__(self, other)Check if two rings are not equal.
__new__(*args, **kwargs)__repr__(self)Return the official string representation of the ring.
__setitem__(self, idx, point)Set the point at the given index.
__setstate__(self, state)Restore the ring from the serialized state.
__str__(self)Return the string representation of the ring.