Sentinel-2 产品的状态始终返回 False (0),即使它们应该返回 True (1)
我正在尝试使用 python 检查 Sentinel-2 的卫星图像产品在 ESA 服务器上是否“在线”或“离线”。我正在使用 GNU Wget 来实现这一点。
如文档中所示(https://scihub.copernicus.eu/userguide/DataRestoration) ,您可以使用以下 URI 查看某个 UUID 的产品是否在线或离线:
https://scihub.copernicus.eu/dhus/odata/v1/Products('98ca202b-2155-4181-be88-4358b2cbaaa0')/Online/$value
括号之间的部分是 UUID。当仅手动使用此链接时,它会按预期工作,对于在线产品返回 true (1),对于离线产品返回 false (0)。
我有以下代码:
import subprocess
def IsOnline(UUID):
wget_command = "wget --no-check-certificate --continue" + " --user={}".format(USERNAME) + " --password={}".format(PASSWORD)
URI = "https://scihub.copernicus.eu/dhus/odata/v1/Products('{0}')/Online/$value".format(UUID)
wget_cmd = wget_command + ' "' + URI + '"'
return subprocess.call(wget_cmd)
IsOnline(UUID)
应该在线的 UUID = '586bafc4-cfe2-4918-85e1-fe03090952ad'
应该离线的 UUID = '85fb6b2a-6559-4025-821f-b72573f339c6'
不幸的是,一切,甚至在线 UUID 都返回 False ( 0)。有人知道如何解决这个问题吗?
I'm trying to use python to check if Satellite Image Products from Sentinel-2 are 'online' or 'offline' on the ESA servers. I'm using GNU Wget to achieve this.
As seen in the documentation (https://scihub.copernicus.eu/userguide/DataRestoration), you can use the following URI to see if a product for a certain UUID is online or offline:
https://scihub.copernicus.eu/dhus/odata/v1/Products('98ca202b-2155-4181-be88-4358b2cbaaa0')/Online/$value
The part between the parenthesis is the UUID. When just manually using this link, it works as expected and returns true (1) for online products and false (0) for offline products.
I have the following code:
import subprocess
def IsOnline(UUID):
wget_command = "wget --no-check-certificate --continue" + " --user={}".format(USERNAME) + " --password={}".format(PASSWORD)
URI = "https://scihub.copernicus.eu/dhus/odata/v1/Products('{0}')/Online/$value".format(UUID)
wget_cmd = wget_command + ' "' + URI + '"'
return subprocess.call(wget_cmd)
IsOnline(UUID)
UUID which should be online = '586bafc4-cfe2-4918-85e1-fe03090952ad'
UUID which should be offline = '85fb6b2a-6559-4025-821f-b72573f339c6'
Unfortunately, everything, even online UUID's return False (0). Does someone know how to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,
subprocess.call
确实返回命令的返回码,通常0
表示命令执行没有错误。如果是这样,wget
应该创建文件,您应该能够检查该文件以确定 API 响应是什么。请检查是否是这种情况,如果是,您可以使用-O
来告知wget
下载的文件应如何命名,例如:这应该使在 python 中读取它变得容易。
Note that
subprocess.call
does return returncode of command, generally0
denotes that command was executed without errors. If it sowget
should create file, which you should be able to inspect in order to determine what was API response. Please check if this is case, if yes you might use-O
to informwget
how downloaded file should be named e.g.:which should made reading it in python easy.