return orthodrome.geodetic_to_ecef(lat, lon, -depth)
''' Geographical location.
The location is given by a reference point at the earth's surface (:py:attr:`lat`, :py:attr:`lon`, :py:attr:`elevation`) and a cartesian offset from this point (:py:attr:`north_shift`, :py:attr:`east_shift`, :py:attr:`depth`). The offset corrected lat/lon coordinates of the location can be accessed though the :py:attr:`effective_latlon`, :py:attr:`effective_lat`, and :py:attr:`effective_lon` properties. '''
default=0.0, optional=True, help='latitude of reference point [deg]')
default=0.0, optional=True, help='longitude of reference point [deg]')
default=0., optional=True, help='northward cartesian offset from reference point [m]')
default=0., optional=True, help='eastward cartesian offset from reference point [m]')
default=0.0, optional=True, help='surface elevation, above sea level [m]')
default=0.0, help='depth, below surface [m]')
def effective_latlon(self): ''' Property holding the offset-corrected lat/lon pair of the location. '''
else: self.lat, self.lon, self.north_shift, self.east_shift))
def effective_lat(self): ''' Property holding the offset-corrected latitude of the location. '''
def effective_lon(self): ''' Property holding the offset-corrected longitude of the location. '''
''' Check whether other location object has the same reference location. '''
''' Compute surface distance [m] to other location object.
'''
other_north_shift, other_east_shift = get_offset(other)
return math.sqrt((self.north_shift - other_north_shift)**2 + (self.east_shift - other_east_shift)**2)
else:
slat, slon, rlat, rlon)[0])
''' Compute 3D distance [m] to other location object.
All coordinates are transformed to cartesian coordinates if necessary then distance is:
.. math::
\\Delta = \\sqrt{\\Delta {\\bf x}^2 + \\Delta {\\bf y}^2 + \ \\Delta {\\bf z}^2}
'''
if self.same_origin(other): other_north_shift, other_east_shift = get_offset(other) return math.sqrt((self.north_shift - other_north_shift)**2 + (self.east_shift - other_east_shift)**2 + (self.depth - other.depth)**2)
else: slat, slon = self.effective_latlon rlat, rlon = get_effective_latlon(other)
sx, sy, sz = latlondepth_to_cartesian(slat, slon, self.depth) rx, ry, rz = latlondepth_to_cartesian(rlat, rlon, other.depth)
return math.sqrt((sx-rx)**2 + (sy-ry)**2 + (sz-rz)**2)
if self.same_origin(other): other_north_shift, other_east_shift = get_offset(other) return ( other_north_shift - self.north_shift, other_east_shift - self.east_shift)
else: azi, bazi = self.azibazi_to(other) dist = self.distance_to(other) return dist*math.cos(azi*d2r), dist*math.sin(azi*d2r)
''' Compute azimuth and backazimuth to and from other location object. '''
other_north_shift, other_east_shift = get_offset(other) azi = r2d * math.atan2(other_east_shift - self.east_shift, other_north_shift - self.north_shift)
bazi = azi + 180. else:
lat = float(lat) lon = float(lon) elat, elon = self.effective_latlon n, e = orthodrome.latlon_to_ne_numpy(lat, lon, elat, elon) self.lat = lat self.lon = lon self.north_shift = float(n) self.east_shift = float(e) self._latlon = elat, elon # unchanged
def coords5(self): self.lat, self.lon, self.north_shift, self.east_shift, self.depth])
try: return obj.north_shift, obj.east_shift except AttributeError: return 0.0, 0.0
except AttributeError: return obj.lat, obj.lon |