美国航天局辣妹

2024-06-01 00:42:58 发布

您现在位置:Python中文网/ 问答频道 /正文

以美国宇航局为例,试图得到行星的固定状态。 ftp://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/tipbod.html

TIPBOD用于将J2000惯性坐标系中的位置转换为固定坐标系下的状态。 TIPM=TIPBOD('J2000',车身,ET)

然后将位置(状态的前三个元素)转换为固定坐标。什么是国家? BDPOS=MXVG(TIPM,POSTN)

我的代码:

Targ = 399 (Earth)
et = spice.str2et(indate)
TIPM = spice.tipbod( "J2000", Targ, et )  
BDPOS = spice.mxvg(TIPM, POSTN, BDPOS )

但是什么是POSTN,什么是BDPOS?在


Tags: 状态ftpjpl行星etspice坐标系naif
2条回答

通过搜索相关函数here,您可以获得更多有关spiceypy函数输入的详细信息。在

在你的特殊情况下,TIPM将是一个3x32d矩阵,它提供惯性系中物体和物体固定框架之间的变换。给mxvg函数所需的输入here。在您的例子中,POSTN应该是一个由3个值组成的列表(或numpy数组),给出您感兴趣的实体的x、y和z位置。BODPOS将是mxvg的输出,它将是矩阵TIPM乘以向量{},因此将是一个包含三个值的向量:身体的变换后的x、y和z位置。在

我不完全确定您需要什么,但可以举个例子:

from astropy.time import Time
from spiceypy import spiceypy as spice

# create a time
t = Time('2010-03-19 11:09:00', format='iso')

# put in spice format - this may require a leap seconds kernel to be
# downloaded, e.g. download https://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/naif0012.tls
# and then load it with spice.furnsh('naif0012.tls')
et = spice.str2et(t.iso)

# get the transformation matrix - this may require a kernel to be
# downloaded, e.g. download https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00010.tpc
# and then load it with spice.furnsh('pck00010.tpc')
target = 399 # Earth
TIPM = spice.tipbod( "J2000", target, et )

# get the position that you want to convert
from astropy.coordinates import Angle, ICRS
ra = Angle('12:32:12.23', unit='hourangle')
dec= Angle('-01:23:52.21', unit='deg')

# make an ICRS object (you can also input a proper motion as a radial velocity or using 'pm_dec' and 'pm_ra_cosdec' keyword arguments)
sc = ICRS(ra=ra, dec=dec)

# get position in xyz
xyz = sc.cartesian.xyz.value

# perform conversion to body centred frame
newpos = spice.mxvg(TIPM, xyz, 3, 3)

# convert to latitude and longitude
scnew = SkyCoord(x=newpos[0], y=newpos[1], z=newpos[2], representation_type='cartesian')

# print out new RA and dec
print(scnew.spherical.lon, scnew.spherical.lat)

可能有完全在astropy中实现这一点的方法,要么使用预定义的框架,要么根据自己的定义,使用^{}对象的transform_to()方法。例如,可以将ICRS转换为GCRS。在

谢谢你,马特,看起来像是tipbod和reclat的作品。如果我错了告诉我,但是数字看起来没问题。在

#Saturn Tilt Negative rotation
    Targ = 699
    TIPM = spice.tipbod( "J2000", Targ, et )   
    #Rotation
    Radius, Long, lat = spice.reclat(TIPM[0])
    fy = r2d * Long
    if fy < 0.0:
        fy = fy + 360.0 #if degrees/radians are negative, add 360
    #print 'X Longitude  = ' +str(fy)

    #Tilt
    Radius, Long, lat = spice.reclat(TIPM[1])
    fy = r2d * Long
    if fy < 0.0:
        fy = fy + 360.0
    #print 'Y Longitude = ' +str(fy)

相关问题 更多 >