pyroSAR对Sentinel-1数据进行处理

查看了目前能够对Sentinel-1进行处理的python库,发现除了SNAP自带的snappy和另一个完全独立于SNAP的python库外,还有一个pyroSAR,基于SNAP本身的XML,但是进行了优化,平均处理每一景2min。目前网上代码很少,因此做一个分享。

geocode函数能够集合了一些常用的预处理步骤,读取下载的zip文件,直接生成入射角、HH、HV等,每个单独一个tif文件。最后存储的文件命名自动形成,不能更改。处理出来的无效值为nodata,在ENVI中可以显现,但是后面利用gdal读取,nodata的值是0.0,因此需要在后续处理中注意。

from datetime import datetime
from pyroSAR.snap.util import geocode,ID,identify,sub_parametrize

start_time = datetime.now()
file=rZ:downloadSentinel20161S1A_EW_GRDM_1SDH_20160101T013526_20160101T013630_009294_00D6C2_EF1A.zip
processed_path=rZ:downloadprocess20161
target_resolution=40
terrain_flat_bool=False
remove_therm_noise_bool=True
fileid = identify(file)
# s1file=ID(fileid)
corners=fileid.getCorners()
subsetnode=sub_parametrize(fileid,geometry=corners)
# generate sequence of integer coordinates marking the tie points of the overlapping hgt tiles

geocode(infile=file, outdir=processed_path, spacing=int(target_resolution), polarizations=[HH,HV],refarea=sigma0,t_srs=int(3413), scaling=dB,
        clean_edges=True,
            terrainFlattening=terrain_flat_bool, removeS1ThermalNoise=remove_therm_noise_bool,export_extra=[localIncidenceAngle],demName=ACE30, nodataValueAtSea=False)

interval_time = datetime.now()
print(" processed in " +str(interval_time - start_time) + " Hr:min:sec")
经验分享 程序员 微信小程序 职场和发展