Package pygeodesy :: Module ecef :: Class EcefKarney |
[frames] | no frames]

# Class EcefKarney

      object --+
               |
    named._Named --+
                   |
    named._NamedBase --+
                       |
               _EcefBase --+
                           |
                          EcefKarney

Conversion between geodetic and geocentric, aka Earth-Centered, Earth-Fixed (ECEF) coordinates based on Karney's Geocentric methods.

Instance Methods
__init__(self, a_ellipsoid, f=None, name=`'````'`) New EcefKarney converter. |
forward(self, latlonh, lon=None, height=0, M=False) Convert from geodetic `(lat, lon, height)` to geocentric `(x, y, z)`. |
reverse(self, xyz, y=None, z=None, M=False) Convert from geocentric `(x, y, z)` to geodetic `(lat, lon, height)`. |
Inherited from `_EcefBase`: `toStr` Inherited from `named._NamedBase`: `__repr__`, `__str__`, `others`, `toRepr` Inherited from `named._Named`: `_dot_`, `attrs`, `classof`, `copy`, `toStr2` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| e2
| e2a
| e2m
| e4a
| hmax
Inherited from `_EcefBase`: `a`, `datum`, `ellipsoid`, `equatorialRadius`, `f`, `flattening` Inherited from `named._Named`: `classname`, `classnaming`, `name`, `named`, `named2` Inherited from `object`: `__class__`

Method Details

### __init__ (self, a_ellipsoid, f=None, name=`'````'`) (Constructor) |
New EcefKarney converter. Arguments: `a_ellipsoid` - An ellipsoid (Ellipsoid), a datum (Datum) or `scalar` for the major, equatorial radius of the ellipsoid (`meter`). `f` - `None` or the ellipsoid flattening (`scalar`), required for `scalar` `a_datum_ellipsoid`, `f=0` represents a sphere, negative `f` a prolate ellipsoid. `name` - Optional name (`str`). Raises: `EcefError` - If `a_ellipsoid` not Ellipsoid, Datum or `scalar` or `f` not `scalar` or if `scalar` `a_ellipsoid` not positive or `f` not less than 1.0. Overrides: object.__init__

### forward (self, latlonh, lon=None, height=0, M=False) |
Convert from geodetic `(lat, lon, height)` to geocentric `(x, y, z)`. Arguments: `latlonh` - Either a `LatLon`, an Ecef9Tuple or `scalar` latitude in `degrees`. `lon` - Optional `scalar` longitude in `degrees` for `scalar` `latlonh`. `height` - Optional height in `meter`, vertically above (or below) the surface of the ellipsoid. `M` - Optionally, return the rotation EcefMatrix (`bool`). Returns: An Ecef9Tuple`(x, y, z, lat, lon, height, C, M, datum)` with geocentric `(x, y, z)` coordinates for the given geodetic ones `(lat, lon, height)`, case `C` 0, optional EcefMatrix `M` and `datum` if available. Raises: `EcefError` - If `latlonh` not `LatLon`, Ecef9Tuple or `scalar` or `lon` not `scalar` for `scalar` `latlonh` or `abs(lat)` exceeds 90°. Overrides: _EcefBase.forward Note: Let `v` be a unit vector located at `(lat, lon, h)`. We can express `v` as column vectors in one of two ways, `v1` in east, north, up coordinates (where the components are relative to a local coordinate system at `C(lat0, lon0, h0)`) or as `v0` in geocentric `x, y, z` coordinates. Then, v0 = M ⋅ v1 where `M` is the rotation matrix.

### reverse (self, xyz, y=None, z=None, M=False) |
Convert from geocentric `(x, y, z)` to geodetic `(lat, lon, height)`. Arguments: `xyz` - Either an Ecef9Tuple, an `(x, y, z)` 3-tuple or `scalar` ECEF `x` coordinate in `meter`. `y` - ECEF `y` coordinate in `meter` for `scalar` `xyz` and `z`. `z` - ECEF `z` coordinate in `meter` for `scalar` `xyz` and `y`. `M` - Optionally, return the rotation EcefMatrix (`bool`). Returns: An Ecef9Tuple`(x, y, z, lat, lon, height, C, M, datum)` with geodetic coordinates `(lat, lon, height)` for the given geocentric ones `(x, y, z)`, case `C`, optional EcefMatrix `M` and `datum` if available. Raises: `EcefError` - If `xyz` not Ecef9Tuple or `scalar` `x` or `y` and/or `z` not `scalar` for `scalar` `xyz`. Overrides: _EcefBase.reverse Note: In general, there are multiple solutions and the result which minimizes `height` is returned, i.e., `(lat, lon)` corresponds to the closest point on the ellipsoid. If there are still multiple solutions with different latitudes (applies only if `z` = 0), then the solution with `lat` > 0 is returned. If there are still multiple solutions with different longitudes (applies only if `x` = `y` = 0) then `lon` = 0 is returned. The returned `height` value is not below −E.a * (1 − E.e2) / sqrt(1 − E.e2 * sin(lat)**2). The returned `lon` is in the range [−180°, 180°]. Like `forward` above, v1 = Transpose(M) ⋅ v0.

Property Details

### e2 Get method: e2(self) - Get `E.f * (2 - E.f)`, 1st eccentricty squared (`float`). Set method: immutable(inst, value) - Throws an `AttributeError`, always.

### e2a Get method: e2a(self) - Get `abs(E.e2)` (`float`). Set method: immutable(inst, value) - Throws an `AttributeError`, always.

### e2m Get method: e2m(self) - Get `1 - E.e2a` == `(1 - E.f)**2` (`float`). Set method: immutable(inst, value) - Throws an `AttributeError`, always.

### e4a Get method: e4a(self) - Get `E.e2a**2` (`float`). Set method: immutable(inst, value) - Throws an `AttributeError`, always.

### hmax Get method: hmax(self) - Get the distance limit (`float`). Set method: immutable(inst, value) - Throws an `AttributeError`, always.