Exemplo n.º 1
0
def ITRF_to_GEO_WGS84(x, y, z):
    """Convert rectangular coordinates to lat/long/height.

    Convert ITRF x, y, z rectangular coords (m) to WGS-84 referenced
    lon, lat, height (using astropy units).
    """
    # see http://en.wikipedia.org/wiki/World_Geodetic_System for constants
    Re_wgs84, f_wgs84 = 6378137.0, 1.0 / 298.257223563
    lon, lat, hgt = spice.recgeo(
        (x.to(u.m).value, y.to(u.m).value, z.to(u.m).value), Re_wgs84, f_wgs84)
    return Longitude(lon, 'radian', wrap_angle=180.0*u.degree), \
           Latitude(lat, 'radian'), hgt * u.m
Exemplo n.º 2
0
def ITRF_to_GEO_WGS84(x, y, z):
    """Convert rectangular coordinates to lat/long/height.

    Convert ITRF x, y, z rectangular coords (m) to WGS-84 referenced
    lon, lat, height (using astropy units).
    """
    # see http://en.wikipedia.org/wiki/World_Geodetic_System for constants
    Re_wgs84, f_wgs84 = 6378137.0, 1.0/298.257223563
    lon, lat, hgt = spice.recgeo((x.to(u.m).value,
                                  y.to(u.m).value,
                                  z.to(u.m).value), Re_wgs84, f_wgs84)
    return Longitude(lon, 'radian', wrap_angle=180.0*u.degree), \
           Latitude(lat, 'radian'), hgt * u.m
Exemplo n.º 3
0
def ITRF2GEO(posITRF):
    '''Converts from earth rectangular coordinate to Geodetic coordinate.

    Input will be the rectangular three coordinates [x,y,z].  Kernel
    file PCK is required.
    '''
    load_kernels()
    _, value = spice.bodvcd(399, "RADII", 3)
    # Reuturns Earh radii [larger equatorial radius, smaller
    # equatorial radius, polar radius] dim is the dimension of
    # returned values Value is the returned values
    rEquatr = value[0]
    rPolar = value[2]
    # Calculate the flattening factor for earth
    f = (rEquatr - rPolar) / rEquatr
    # Calculate the geodetic coordinate on earth. lon,lat are in
    # radius. alt is the same unit with in put posITRF
    lon, lat, alt = spice.recgeo(posITRF, rEquatr, f)
    # Return longitude and latitude in degree
    lonDeg = spice.convrt(lon, "RADIANS", "DEGREES")
    latDeg = spice.convrt(lat, "RADIANS", "DEGREES")
    return lon, lonDeg, lat, latDeg, alt
Exemplo n.º 4
0
def ITRF2GEO(posITRF):
    '''Converts from earth rectangular coordinate to Geodetic coordinate.

    Input will be the rectangular three coordinates [x,y,z].  Kernel
    file PCK is required.
    '''
    load_kernels()
    _, value = spice.bodvcd(399, "RADII", 3)
    # Reuturns Earh radii [larger equatorial radius, smaller
    # equatorial radius, polar radius] dim is the dimension of
    # returned values Value is the returned values
    rEquatr = value[0]
    rPolar = value[2]
    # Calculate the flattening factor for earth
    f = (rEquatr - rPolar) / rEquatr
    # Calculate the geodetic coordinate on earth. lon,lat are in
    # radius. alt is the same unit with in put posITRF
    lon, lat, alt = spice.recgeo(posITRF, rEquatr, f)
    # Return longitude and latitude in degree
    lonDeg = spice.convrt(lon, "RADIANS", "DEGREES")
    latDeg = spice.convrt(lat, "RADIANS", "DEGREES")
    return lon, lonDeg, lat, latDeg, alt