Package pygeodesy :: Module simplify :: Class Numpy2points
[frames] | no frames]

Class Numpy2points

object --+
         |
        Numpy2points

Wrapper for NumPy arrays as "on-the-fly" LatLon points.

Instance Methods
 
__init__(self, array, lat=1, lon=0)
Handle a NumPy array as simplify...-compatible LatLon points.
 
__getitem__(self, index)
Return row[index] as LatLon or return a Numpy2points slice.
 
__iter__(self)
Iterate thru all rows and yield each as LatLon.
 
__len__(self)
Return the number of rows.
 
__repr__(self)
Return a string representation.
 
__str__(self)
Return a string representation.
 
subset(self, indices)
Return a sub-set of the NumPy array.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties
  lat
Get the latitudes column index.
  lon
Get the longitudes column index.
  shape
Get the shape of the NumPy array.

Inherited from object: __class__

Method Details

__init__(self, array, lat=1, lon=0)
(Constructor)

 

Handle a NumPy array as simplify...-compatible LatLon points.

Parameters:
  • array - NumPy array (numpy.array).
  • lat - index of the latitudes column (integer).
  • lon - index of the longitudes column (integer).
Raises:
  • IndexError - If array.shape is not (1+, 2+).
  • TypeError - If array is not a NumPy array.
  • ValueError - If the lat or lon value(s) are out of range or the same.
Overrides: object.__init__

Example:

>>> type(array)
<type 'numpy.ndarray'>  # <class ...> in Python 3+
>>> points = Numpy2points(array, lat=0, lon=1)
>>> simply = simplifyRDP(points, ...)
>>> type(simply)
<type 'numpy.ndarray'>  # <class ...> in Python 3+
>>> sliced = points[1:-1]
>>> type(sliced)
<class '...Numpy2points'>

__repr__(self)
(Representation operator)

 

Return a string representation.

Overrides: object.__repr__

__str__(self)
(Informal representation operator)

 

Return a string representation.

Overrides: object.__str__

Property Details

lat

Get the latitudes column index.

Get Method:
lat(self) - Get the latitudes column index.

lon

Get the longitudes column index.

Get Method:
lon(self) - Get the longitudes column index.

shape

Get the shape of the NumPy array.

Get Method:
shape(self) - Get the shape of the NumPy array.