上个博客介绍了几种Sentinel数据快速下载的方法,没看到的链接这里
https://blog.csdn.net/qq_38522168/article/details/104725218
接下来分享一下如何在python下调用cmd使用sen2cor批量对Sentinel2数据大气校正!
# author='zhanggd'
# date='2020/02/06'
import subprocess
import zipfile
import os
sen2cor_path = r"F:\SEN2COR\Sen2Cor-02.08.00-win64\L2A_Process.bat"
origin_dir = r"F:\L1C"
pattern = ".SAFE"
for in_file in os.listdir(origin_dir):
if pattern in in_file:
zip_file_path = os.path.join(origin_dir, in_file)
#print(zip_file_path)
xml_file_path=zip_file_path
xml_file_path1 = os.path.basename(xml_file_path)
xml_file_path2 =('F:/L1C/'+xml_file_path1)
os.chdir(xml_file_path2)
print(os.getcwd())
#cmd_args = [sen2cor_path, xml_file_path, \
# '--output_dir', output_dir]
cmd_args = [sen2cor_path, xml_file_path]
print(cmd_args)
subprocess.call(cmd_args)
因为是今年2月份做实验时写的代码,这里就不上运行截图了,数据不知道扔哪里去了。