Python 不能运行 SOIT:卫星过境识别工具 [已解决]

huangapple go评论56阅读模式
英文:

Python can't run SOIT: Satellite Overpass Identification Tool [Solved]

问题

我需要构建一个数据库,记录感兴趣点的每日Terra和Aqua卫星过境时间。

时间范围从2001年1月1日至2021年12月31日。地点位于纬度:-32.510;经度:-55.800。

我是一个新手,正在学习如何处理卫星图像。我花了很多时间搜索这些信息,但没有成功。尽管有强大的卫星数据管理工具,但这些基本信息似乎不容易获取。

我找到了这个Python程序:SOIT:卫星过境识别工具。
https://zenodo.org/record/6475619

根据程序的README文件:

要求:

  1. 下载最新版本的Python(Python3)。该程序在PyCharm中开发,可以在Mac、Linux或PC上公开使用。或者,您可以在具有Python 3安装的任何计算机的终端上运行该程序。您还需要以下包:requests、json、configparser、numpy、csv、math、Skyfield。您可以通过在终端中运行以下命令轻松安装它们:<pip3 install(包名)>。例如,要安装Skyfield:
  2. 在Space-Track.org上创建一个帐户(开源)。
  3. 确保有稳定的互联网连接。

在Space-Track.org上创建帐户并下载两个程序文件后,我在PowerShell提示符中打开,导航到程序目录,并使用以下命令加载库:python3 -m pip install(包名)

对于JSON、math和CSV,我收到以下消息(例如:json):

python3 -m pip install json
错误:找不到满足要求的版本 json(从版本:none)
错误:找不到匹配的分发 json

在Google上搜索时,提供的答案是:Python有一个内置的JSON模块。如果这是您要找的,请在您的脚本或shell中导入它。

我尝试使用“import”,但收到以下消息:

术语“import”不被识别为cmdlet、函数、脚本文件或可执行程序的名称。请检查您是否正确输入了名称,或者如果包含文件路径,请确保路径正确,并重试。

我尝试绕过最后一部分运行程序,但收到以下消息:

PS C:\Users\corre\anaconda3\envs\Overpass\overpassprg&gt; python3 pass_time_v2.py
Traceback (most recent call last):
  File "C:\Users\corre\anaconda3\envs\Overpass\overpassprg\pass_time_v2.py", line 429, in <module>
    main()
  File "C:\Users\corre\anaconda3\envs\Overpass\overpassprg\pass_time_v2.py", line 265, in main
    aqua_closest = closest_time.split(' ')[3]
                   ~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

编辑日期:2023年05月26日:

SLTrack.ini文件已经完成,如下所示:

[configuration]
username = martinfrancia@fagro.edu.uy
password = overpassanahi8camilo3

start date = 01/01/2001
end date = 12/31/2021

latitude of interest = -32.510
longitude of interest = -55.800

我需要这些数据,为什么这么复杂呢?如果有其他方法,请随时提出建议。

英文:

I need to build a database with daily Terra and Aqua satellite overpass times for a point of interest.

The period is from 1/1/2001 to 12/31/2021. The location is lat: -32.510 ; lon: -55.800

I am a newcomer to working with satellite imagery. I have spent a lot of time searching for that information without success. It is very frustrating that despite having powerful tools to manage satellite data, this basic information is not easily accessible.

I have found this Python program: SOIT: Satellite Overpass Identification Tool.
https://zenodo.org/record/6475619

According to the README file of the program:
> Requirements:

>1. Download the latest version of Python (Python3). This program was developed in
PyCharm and is publicly available for Mac, Linux, or PC here. Alternatively, you can run
the program from the terminal of any machine with a Python 3 installation. You will also
need the following packages: requests, json, configparser, numpy, csv, math, Skyfield.
You can install them easily by running the following command in the terminal: <pip3
install (package name)>. For example, to install Skyfield: <pip3 install skyfield>.
>2. Create an account at Space-Track.org (open-source).
>3. Make sure to have a stable internet connection.

After creating an account on Space-Track.org and downloading the two program files, I open PowerShell prompt, navigate to the program directory, and load the libraries using: python3 -m pip install (package)

With JSON, math, and CSV, I have the following message (eg:json):

python3 -m pip install json
ERROR: Could not find a version that satisfies the requirement json (from versions: none)
ERROR: No matching distribution found for json

When searching on Google, the answer provided is: Python has a built-in JSON module. If that's what you're looking for. Just import in your script or shell.

I am trying to use "import," and I receive:

The term &#39;import&#39; is not recognized as the name of a cmdlet, function, script file,
or executable program. Please check if you typed the name correctly or, 
if you included a file path, make sure that the path is correct and try again.

I have tried running the program bypassing the last part, and I get the following message:

PS C:\Users\corre\anaconda3\envs\Overpass\overpassprg&gt; python3 pass_time_v2.py
Traceback (most recent call last):
  File &quot;C:\Users\corre\anaconda3\envs\Overpass\overpassprg\pass_time_v2.py&quot;, line 429, in &lt;module&gt;
    main()
  File &quot;C:\Users\corre\anaconda3\envs\Overpass\overpassprg\pass_time_v2.py&quot;, line 265, in main
    aqua_closest = closest_time.split(&#39; &#39;)[3]
                   ~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

EDIT 05/26/2023:

The SLTrack.ini file was completed in this way:

[configuration]
username = martinfrancia@fagro.edu.uy
password = overpassanahi8camilo3

start date = 01/01/2001
end date = 12/31/2021

latitude of interest = -32.510
longitude of interest = -55.800

I need this data; how can it be so complicated?
Feel free to suggest another approach

答案1

得分: 0

从Nick O Dell的评论中,借助GPTChat4的帮助,问题可以如下修正:

替换:

aqua_closest = closest_time.split(' ')[3]

为:

closest_time_split = closest_time.split(' ')
aqua_closest = closest_time_split[3] if len(closest_time_split) >= 4 else 'unknown'

对于Terra也是一样的:

替换:

terra_closest = closest_time.split(' ')[3]

为:

closest_time_split = closest_time.split(' ')
terra_closest = closest_time_split[3] if len(closest_time_split) >= 4 else 'unknown'

当卫星每天只经过一次时,这个修正将错误替换为值"unknown"。在我的情况下,我能够获得从2001年到2021年的数据库。
谢谢,Nick O Dell。没有你的帮助,我无法完成这个任务。

英文:

From Nick O Dell's comments, with the help of GPTChat4, the problem can be corrected as follows:
Replace:

aqua_closest = closest_time.split(&#39; &#39;)[3]

With:

closest_time_split = closest_time.split(&#39; &#39;)
aqua_closest = closest_time_split[3] if len(closest_time_split) &gt;= 4 else &#39;unknown&#39;

The same for Terra would be:

Replace:

terra_closest = closest_time.split(&#39; &#39;)[3]

With:

closest_time_split = closest_time.split(&#39; &#39;)
terra_closest = closest_time_split[3] if len(closest_time_split) &gt;= 4 else &#39;unknown&#39;

When the satellite passes only once per day, this correction replaces the error with the value "unknown." In my case, I was able to obtain a database from 2001 to 2021.
Thank you, Nick O Dell. I couldn't have done it without your help.

huangapple
  • 本文由 发表于 2023年5月26日 09:40:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76337159.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定