英文:
Skyfield Moon Coordinate System Conversion
问题
我正在进行一个项目,需要计算月球上某位置的太阳角度。我可以使用以下代码实现这个目标(改编自Skyfield文档链接在此):
lunar_latitude = 55.0
lunar_longitude = 86.4
lunar_altitude = 2000
time = "2022,12,20,19,59,12"
input_time = [int(x) for x in time.split(",")]
eph = load('de421.bsp')
sun, moon = eph['sun'], eph['moon']
pc = PlanetaryConstants()
pc.read_text(load('moon_080317.tf'))
pc.read_text(load('pck00008.tpc'))
pc.read_binary(load('moon_pa_de421_1900-2050.bpc'))
frame = pc.build_frame_named('MOON_ME_DE421')
lunar_position = moon + pc.build_latlon_degrees(frame, lunar_latitude, lunar_longitude, elevation_m=lunar_altitude)
ts = load.timescale()
time = ts.utc(*input_time)
apparent = location.at(time).observe(solar_system_body).apparent()
print("apparent", apparent.position)
alt, az, distance = apparent.altaz()
print(alt, 'degrees above the horizon')
print(az, 'degrees around the horizon from north')
这段代码给出了相对于指定位置(55.0, 86.4)的太阳位置的角度。然而,我有一个GIS文件,可以从中提取以moon2000_npole格式表示的月球高程。我希望能够在脚本的这两个组件之间进行转换和匹配位置,因此我需要能够在skyfield坐标参考系统之间进行转换,但是从文档中我不清楚这个格式是什么?
我会感谢对skyfield的细节更了解的人提供帮助,以确定我在这里使用的代码中是否有假定的坐标参考系统,或者是否有一种确定坐标参考系统的方式。
我已经在Skyfield文档中(上面链接的文档)搜索了坐标参考系统(或假定的坐标参考系统),但除了在代码中用于地球位置的WGS84之外,我找不到任何特定的参考信息。
英文:
I am working on a project in which I need to calculate the angle of the sun for a position on the moon. I can achieve this with the following code (adapted from Skyfield Docs here):
lunar_latitude = 55.0,
lunar_longitude = 86.4,
lunar_altitude = 2000,
time = "2022,12,20,19,59,12",
input_time = [int(x) for x in time.split(",")]
eph = load('de421.bsp')
sun, moon = eph['sun'], eph['moon']
pc = PlanetaryConstants()
pc.read_text(load('moon_080317.tf'))
pc.read_text(load('pck00008.tpc'))
pc.read_binary(load('moon_pa_de421_1900-2050.bpc'))
frame = pc.build_frame_named('MOON_ME_DE421')
lunar_position = moon + pc.build_latlon_degrees(frame, lunar_latitude, lunar_longitude, elevation_m = lunar_altitude)
ts = load.timescale()
time = ts.utc(*input_time)
apparent = location.at(time).observe(solar_system_body).apparent()
print("apparent", apparent.position)
alt, az, distance = apparent.altaz()
print(alt, 'degrees above the horizon')
print(az, 'degrees around the horizon from north')
The code gives me the sun position relative to the position specified in degrees (55.0, 86.4). However, I have a gis file from which I can extract lunar elevation which is in moon2000_npole format. I want to be able to convert and match locations between the two components of this script, and so I need to be able to convert to and from the skyfield coordinate reference system, however it is not clear to me from the documentation what this format would be?
I'd appreciate any help from those more knowledgeable on the intricacies of skyfield as to whether there is an assumed CRS in the code that I am using here, or whether there is some way to determine what the CRS is.
I have searched for the CRS (or assumed CRS) in the Skyfield Docs (linked above) but can't find any particular references beyond WGS84 being used in the code for Earth positions.
答案1
得分: 1
Skyfield没有关于行星参考系统的内置想法。它只是从 .tf
文件中加载数据并应用这些文件描述的转换。要了解有关已加载的参考框架的更多信息,请打开名为 moon_080317.tf
的文本文件,查找名为 Frames Specified by this Kernel
的部分。
您应该在那里找到有关内核定义的月球表面参考框架的详细描述,以及它们之间的比较。
英文:
Skyfield does not have any built-in ideas about planetary reference systems. It simply loads the data from .tf
files and applies the transforms those files describe. So to learn more about the frame of reference you have loaded, open the moon_080317.tf
text file and look for the section entitled Frames Specified by this Kernel
.
You should find there a detailed description of the lunar-surface reference frames defined by the kernel, along with a comparison between them.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论