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
def test_bodvXds(self): self.assertEqual( spice.bodvcd( 399, 'VARS', 10), self.var399 ) self.assertEqual( spice.bodvcd( 99, 'VARS', 10), self.var99 ) self.assertEqual( spice.bodvrd( 'earth', 'VARS', 10), self.var399 ) self.assertEqual( spice.bodvrd( 'mybod', 'VARS', 10), self.var99 )