使用 Python 查询和下载 Sentinel-1 轨道数据
本文主要介绍通过 Python 从 美国阿拉斯加大学费尔班克斯分校运营的卫星数据分发平台 https://s1qc.asf.alaska.edu/ 下载哨兵1(Sentinel-1)号轨道数据(AUX_POEORB、AUX_RESORB等)产品数据(2025年9月~12月)。整体流程如下:
申请一个 earthdata 账号配置 Python 依赖查询数据下载数据
1 申请一个 earthdata 账号
申请地址: https://urs.earthdata.nasa.gov/
按步操作,不再赘述:

在账户中生成一个 token

2 配置 Python 依赖
Python: 3.12
安装以下库(内置库或关联库已忽略):
requests: 2.32.3
tqdm: 4.67.1
bs4: 4.12.3
3 查询数据
查询地址:https://s1qc.asf.alaska.edu/
注:查询数据不需要账号
import requests, re, os, tqdm from bs4 import BeautifulSoup url ="https://s1qc.asf.alaska.edu/aux_resorb/" query_res = requests.get(url) months =[202509,202510,202511,202512] pattern =rf'{"|".join([str(m)for m in months])}' soup = BeautifulSoup(query_res.text,'html.parser') POEORBs =[]# 查询结果for link in soup.find_all('a'): text = link.get('href')if'S1A'in text andbool(re.search(pattern, text)): POEORBs.append(f'{url}/{text}')查询结果示例:

4 下载数据
注:下载数据需要账号
4.1 登录NASA账号,获得 cookie
经检测,直接通过 requests 登录 NASA 账号依然会报 账户错误。这里使用已登录 NASA 的浏览器 cookies。
步骤一: 浏览器(Edge为例)打开查询结果中的一个链接。

步骤二: 登录跳转到的 NASA 账户

步骤三: 返回步骤一的链接(浏览器已能下载或打开文件)

步骤四: 进入浏览器开发人员工具,找到cookies
【···】 --> 【更多工具】 --> 【开发人员工具】

【网络】 --> 【全部】 --> 【名称(文件名)】–>【标头】–>【请求标头】–>【Cookie】

复制 cookie
4.2 通过 cookie 批量下载查询结果
session = requests.Session() cookie ='''4.1 复制的 cookie''' headers ={"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0","cookie": cookie } session.headers.update(headers) out_path =r'D:\下载\aux_resorb' chunk_size =8192for i, link inenumerate(POEORBs): out_file =f"{out_path}\\{os.path.basename(link)}"if os.path.exists(out_file):print(f'跳过已存在的下载({i +1}/{len(POEORBs)}):{out_file}')continue response = session.get(link, stream=True)if response.status_code ==200:## 创建进度条print(f'当前下载({i +1}/{len(POEORBs)}):{out_file}') total_size =int(response.headers.get('content-length',0))# 数据总大小 total =int(np.ceil(total_size / chunk_size))# 分块数量withopen(out_file,"wb")asfile:# 分块下载for chunk in tqdm.tqdm(response.iter_content(chunk_size = chunk_size), total = total):if chunk:file.write(chunk)else:print(f"Error: {response.status_code}. {response.text}")下载过程示例:
