Package pygeodesy :: Module nvectorBase :: Class NvectorBase
[frames] | no frames]

Class NvectorBase

  object --+            
           |            
named._Named --+        
               |        
named._NamedBase --+    
                   |    
   vector3d.Vector3d --+
                       |
                      NvectorBase
Known Subclasses:

Base class for ellipsoidal and spherical Nvectors.

Instance Methods
 
__init__(self, x, y=None, z=None, h=0, ll=None, datum=None, name='')
New n-vector normal to the earth's surface.
 
to2ab(self)
DEPRECATED, use property philam.
 
to2ll(self)
DEPRECATED, use property latlon.
 
to3abh(self, height=None)
DEPRECATED, use method philamheight or philam.to3Tuple(height).
 
to3llh(self, height=None)
DEPRECATED, use property latlonheight or latlon.to3Tuple(height).
 
to4xyzh(self, h=None)
DEPRECATED, use property xyzh or xyz.to4Tuple(h).
 
toCartesian(self, h=None, Cartesian=None, datum=None, **kwds)
Convert this n-vector to Nvector-based cartesian (ECEF) coordinates.
 
toLatLon(self, height=None, LatLon=None, datum=None, **kwds)
Convert this n-vector to an Nvector-based geodetic point.
 
toStr(self, prec=5, fmt='(%s)', sep=', ')
Return a string representation of this n-vector.
 
toVector3d(self, norm=True)
Convert this n-vector to a 3-D vector, ignoring the height.
 
unit(self, ll=None)
Normalize this n-vector to unit length.

Inherited from vector3d.Vector3d: __abs__, __add__, __cmp__, __div__, __eq__, __ge__, __gt__, __le__, __lt__, __matmul__, __mul__, __ne__, __neg__, __pos__, __radd__, __rmatmul__, __rsub__, __sub__, __truediv__, angleTo, cmp, cross, dividedBy, dot, equals, isequalTo, minus, negate, others, parse, plus, rotate, rotateAround, sum, times, to3xyz

Inherited from named._NamedBase: __repr__, __str__, toStr2

Inherited from named._Named: _dot_, attrs, classof, copy

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

Properties
  Ecef
An immutable property (Read Only).
  H
Property to get and set the height prefix (str).
  datum
An immutable property (Read Only).
  h
Property to get and set the height above surface (meter).
  isEllipsoidal
An immutable property (Read Only).
  isSpherical
An immutable property (Read Only).
  lam
An immutable property (Read Only).
  lat
An immutable property (Read Only).
  latlon
An immutable property (Read Only).
  latlonheight
An immutable property (Read Only).
  lon
An immutable property (Read Only).
  phi
An immutable property (Read Only).
  philam
An immutable property (Read Only).
  philamheight
An immutable property (Read Only).
  xyzh
An immutable property (Read Only).

Inherited from vector3d.Vector3d: crosserrors, length, x, xyz, y, z

Inherited from named._Named: classname, classnaming, name, named, named2

Inherited from object: __class__

Method Details

__init__(self, x, y=None, z=None, h=0, ll=None, datum=None, name='')
(Constructor)

 

New n-vector normal to the earth's surface.

Parameters:
  • x - An Nvector, Vector3Tuple, Vector4Tuple or the X coordinate (scalar).
  • y - The Y coordinate (scalar) if x scalar.
  • z - The Z coordinate (scalar) if x scalar.
  • h - Optional height above surface (meter).
  • ll - Optional, original latlon (LatLon).
  • datum - Optional, pass-thru datum (Datum).
  • name - Optional name (str).
Raises:
Overrides: object.__init__

Example:

>>> from pygeodesy.sphericalNvector import Nvector
>>> v = Nvector(0.5, 0.5, 0.7071, 1)
>>> v.toLatLon()  # 45.0°N, 045.0°E, +1.00m

to2ab(self)

 

DEPRECATED, use property philam.

Returns:
A PhiLam2Tuple(phi, lam).
Overrides: vector3d.Vector3d.to2ab

to2ll(self)

 

DEPRECATED, use property latlon.

Returns:
A LatLon2Tuple(lat, lon).
Overrides: vector3d.Vector3d.to2ll

to3abh(self, height=None)

 

DEPRECATED, use method philamheight or philam.to3Tuple(height).

Parameters:
  • height - Optional height, overriding this n-vector's height (meter).
Returns:
A PhiLam3Tuple(phi, lam, height).

to3llh(self, height=None)

 

DEPRECATED, use property latlonheight or latlon.to3Tuple(height).

Parameters:
  • height - Optional height, overriding this n-vector's height (meter).
Returns:
A LatLon3Tuple(lat, lon, height).

toCartesian(self, h=None, Cartesian=None, datum=None, **kwds)

 

Convert this n-vector to Nvector-based cartesian (ECEF) coordinates.

Parameters:
  • height - Optional height, overriding this n-vector's height (meter).
  • Cartesian - Optional (sub-)class to return the (ECEF)coordinates (Cartesian).
  • datum - Optional, spherical datum (Datum).
  • kwds - Optional, additional name=value pairs for Cartesian instance, provided Cartesian is not None.
Returns:
Cartesian (ECEF) coordinates (Cartesian).
Raises:
  • TypeError - Invalid Cartesian.

Example:

>>> v = Nvector(0.5, 0.5, 0.7071)
>>> c = v.toCartesian()  # [3194434, 3194434, 4487327]
>>> p = c.toLatLon()  # 45.0°N, 45.0°E

toLatLon(self, height=None, LatLon=None, datum=None, **kwds)

 

Convert this n-vector to an Nvector-based geodetic point.

Parameters:
  • height - Optional height, overriding this n-vector's height (meter).
  • LatLon - Optional (sub-)class to return the point (LatLon) or None.
  • datum - Optional, spherical datum (Datum).
  • kwds - Optional, additional name=value pairs for LatLon instance, provided LatLon is not None.
Returns:
The LatLon point (LatLon) or an Ecef9Tuple(x, y, z, lat, lon, height, C, M, datum) if LatLon is None.
Raises:
  • TypeError - Invalid LatLon.

Example:

>>> v = Nvector(0.5, 0.5, 0.7071)
>>> p = v.toLatLon()  # 45.0°N, 45.0°E

toStr(self, prec=5, fmt='(%s)', sep=', ')

 

Return a string representation of this n-vector.

Height component is only included if non-zero.

Parameters:
  • prec - Optional number of decimals, unstripped (int).
  • fmt - Optional enclosing backets format (str).
  • sep - Optional separator between components (str).
Returns:
Comma-separated "(x, y, z [, h])" enclosed in fmt brackets (str).
Raises:
Overrides: named._Named.toStr

Example:

>>> Nvector(0.5, 0.5, 0.7071).toStr()  # (0.5, 0.5, 0.7071)
>>> Nvector(0.5, 0.5, 0.7071, 1).toStr(-3)  # (0.500, 0.500, 0.707, +1.00)

toVector3d(self, norm=True)

 

Convert this n-vector to a 3-D vector, ignoring the height.

Parameters:
  • norm - Normalize the 3-D vector (bool).
Returns:
The (normalized) vector (Vector3d).

unit(self, ll=None)

 

Normalize this n-vector to unit length.

Parameters:
  • ll - Optional, original latlon (LatLon).
Returns:
Normalized vector (Nvector).
Overrides: vector3d.Vector3d.unit

Property Details

Ecef

An immutable property (Read Only).

Get Method:
Ecef(self) - Get the ECEF class (EcefKarney or EcefVeness).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

H

Property to get and set the height prefix (str).

Get Method:
H(self) - Get the height prefix (str).
Set Method:
H(self, H) - Set the height prefix.

datum

An immutable property (Read Only).

Get Method:
datum(self) - Get the pass-thru datum (Datum) or None.
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

h

Property to get and set the height above surface (meter).

Get Method:
h(self) - Get the height above surface (meter).
Set Method:
h(self, h) - Set the height above surface.

isEllipsoidal

An immutable property (Read Only).

Get Method:
isEllipsoidal(self) - Check whether this n-vector is ellipsoidal (bool or None if unknown).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

isSpherical

An immutable property (Read Only).

Get Method:
isSpherical(self) - Check whether this n-vector is spherical (bool or None if unknown).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

lam

An immutable property (Read Only).

Get Method:
lam(self) - Get the (geodetic) longitude in radians (float).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

lat

An immutable property (Read Only).

Get Method:
lat(self) - Get the (geodetic) latitude in degrees (float).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

latlon

An immutable property (Read Only).

Get Method:
latlon(self) - Get the (geodetic) lat-, longitude in degrees (LatLon2Tuple(lat, lon)).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

latlonheight

An immutable property (Read Only).

Get Method:
latlonheight(self) - Get the (geodetic) lat-, longitude in degrees and height (LatLon3Tuple(lat, lon, height)).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

lon

An immutable property (Read Only).

Get Method:
lon(self) - Get the (geodetic) longitude in degrees (float).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

phi

An immutable property (Read Only).

Get Method:
phi(self) - Get the (geodetic) latitude in radians (float).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

philam

An immutable property (Read Only).

Get Method:
philam(self) - Get the (geodetic) lat-, longitude in radians (PhiLam2Tuple(phi, lam)).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

philamheight

An immutable property (Read Only).

Get Method:
philamheight(self) - Get the (geodetic) lat-, longitude in radians and height (PhiLam3Tuple(phi, lam, height)).
Set Method:
immutable(inst, value) - Throws an AttributeError, always.

xyzh

An immutable property (Read Only).

Get Method:
xyzh(self) - Get this n-vector's components (Vector4Tuple(x, y, z, h))
Set Method:
immutable(inst, value) - Throws an AttributeError, always.