V0.5 LT1AB CPP 适配完成,调整了部分 python代码中的部分错误
parent
fef48a75b1
commit
3588ada87c
|
@ -1,7 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<Root>
|
||||
<TaskID>CSAR_202107275419_0001-0</TaskID>
|
||||
<WorkSpace>D:\micro\LWork\</WorkSpace>
|
||||
<WorkSpace>D:\micro\WorkSpace\</WorkSpace>
|
||||
<AlgCompt>
|
||||
<DataTransModel>File</DataTransModel>
|
||||
<Artificial>ElementAlg</Artificial>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<ParaType>File</ParaType>
|
||||
<DataType>tar.gz</DataType>
|
||||
<ParaSource>Cal</ParaSource>
|
||||
<ParaValue>E:\MicroWorkspace\LT1B\LT230919\LT1B_MONO_MYC_STRIP4_005860_E130.9_N47.7_20230327_SLC_AHV_L1A_0000086966.tar.gz</ParaValue>
|
||||
<ParaValue>D:\micro\LTOrth\LT1B_MONO_KSC_STRIP2_007065_E100.8_N26.6_20230616_SLC_HH_L1A_0000135014.tar.gz</ParaValue>
|
||||
<EnModification>True</EnModification>
|
||||
<EnMultipleChoice>False</EnMultipleChoice>
|
||||
<Control>File</Control>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<ParaType>File</ParaType>
|
||||
<DataType>File</DataType>
|
||||
<ParaSource>Cal</ParaSource>
|
||||
<ParaValue>E:\MicroWorkspace\LT1B\LT230919\dem</ParaValue>
|
||||
<ParaValue>D:\micro\LTOrth\dem</ParaValue>
|
||||
<EnModification>True</EnModification>
|
||||
<EnMultipleChoice>True</EnMultipleChoice>
|
||||
<Control>File</Control>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<ParaType>File</ParaType>
|
||||
<DataType>tar.gz</DataType>
|
||||
<ParaSource>Cal</ParaSource>
|
||||
<ParaValue>D:\micro\LWork\Ortho\Output\LT1B_MONO_MYC_STRIP4_005860_E130.9_N47.7_20230327_SLC_AHV_L1A_0000086966-ortho.tar.gz</ParaValue>
|
||||
<ParaValue>D:\micro\WorkSpace\Ortho\Output\LT1B_MONO_KSC_STRIP2_007065_E100.8_N26.6_20230616_SLC_HH_L1A_0000135014-ortho.tar.gz</ParaValue>
|
||||
<MaxValue>DEFAULT</MaxValue>
|
||||
<MinValue>DEFAULT</MinValue>
|
||||
<OptionValue>DEFAULT</OptionValue>
|
||||
|
|
|
@ -1131,11 +1131,11 @@ class Orthorectification(object):
|
|||
FindInfomationFromJson(HeaderFile_dom_json, self.config['imageinfo']['Azspace']['NodePath']))
|
||||
|
||||
# 4、影像的近斜距
|
||||
NearRange = float(FindInfomationFromJson(HeaderFile_dom_json, self.config['imageinfo']['NearRange']['NodePath']))
|
||||
NearRange = NearRange * LightSpeed / 2
|
||||
NearRangeTime = float(FindInfomationFromJson(HeaderFile_dom_json, self.config['imageinfo']['NearRange']['NodePath']))
|
||||
NearRange = NearRangeTime * LightSpeed / 2
|
||||
HeaderInformation_json['ImageInformation']['NearRange'] = float(NearRange)
|
||||
FarRange = float(FindInfomationFromJson(HeaderFile_dom_json, self.config['imageinfo']['FarRange']['NodePath']))
|
||||
FarRange = FarRange * LightSpeed / 2
|
||||
FarRangeTime = float(FindInfomationFromJson(HeaderFile_dom_json, self.config['imageinfo']['FarRange']['NodePath']))
|
||||
FarRange = FarRangeTime * LightSpeed / 2
|
||||
# 远斜距
|
||||
HeaderInformation_json['ImageInformation']['FarRange'] = float(FarRange)
|
||||
# 5、入射角
|
||||
|
@ -1183,7 +1183,7 @@ class Orthorectification(object):
|
|||
DopplerRates = FindInfomationFromJson(HeaderFile_dom_json, self.config['imageinfo']['DopplerRate']['NodePath'])
|
||||
DopplerRate = []
|
||||
for doppler in DopplerRates:
|
||||
DopplerRate.append(doppler.get('#text'))
|
||||
DopplerRate.append(float(doppler.get('#text'))) # 嘉兴
|
||||
HeaderInformation_json['ImageInformation']['DopplerRate'] = DopplerRate
|
||||
# 11、参考斜距
|
||||
# HeaderInformation_json['ImageInformation']['refRange'] = float(
|
||||
|
@ -1201,16 +1201,14 @@ class Orthorectification(object):
|
|||
self.config['imageinfo']['StartImageTime']['Format']).timestamp()
|
||||
lastpixeltime=float(FindInfomationFromJson(HeaderFile_dom_json, self.config['imageinfo']['FarRange']['NodePath']))
|
||||
firstpixeltime=float(FindInfomationFromJson(HeaderFile_dom_json, self.config['imageinfo']['NearRange']['NodePath']))
|
||||
eqvFs = ((ImageHeight - 2)/(lastpixeltime - firstpixeltime))/2
|
||||
eqvFs = ((HeaderInformation_json['ImageInformation']['width'] - 1)/(lastpixeltime - firstpixeltime))
|
||||
|
||||
# 12、PRF
|
||||
|
||||
# HeaderInformation_json['PRF'] = float(
|
||||
# FindInfomationFromJson(HeaderFile_dom_json, self.config['sensor']['PRF']['NodePath']))
|
||||
|
||||
HeaderInformation_json['PRF'] = float((ImageHeight-2)/(EndImageTime-StartImageTime)) # eqvPRF
|
||||
|
||||
|
||||
HeaderInformation_json['PRF'] = float((ImageHeight-1)/(EndImageTime-StartImageTime)) # eqvPRF
|
||||
HeaderInformation_json['Fs'] = float(eqvFs) # FindInfomationFromJson(HeaderFile_dom_json, self.config['sensor']['Fs']['NodePath'])
|
||||
# 13、中心时间
|
||||
HeaderInformation_json['ImageInformation']['CenterTime'] = (EndImageTime + StartImageTime)/2
|
||||
|
@ -1502,7 +1500,7 @@ class IndirectOrthorectification(Orthorectification):
|
|||
fp.write("{}\n".format(self.header_info['ImageInformation']['StartTime']))
|
||||
fp.write("{}\n".format(self.header_info['PRF']))
|
||||
fp.write("{}\n".format(self.header_info['ImageInformation']['NearRange'])) # LT
|
||||
fp.write("{}\n".format(self.Fs/2))
|
||||
fp.write("{}\n".format(self.Fs))
|
||||
fp.write("{}\n".format(self.header_info['ImageInformation']['DopplerParametersReferenceTime']))
|
||||
#fp.write("{}\n".format(self.widthspace))
|
||||
|
||||
|
@ -1709,17 +1707,20 @@ class IndirectOrthorectification(Orthorectification):
|
|||
print("==========================================================================")
|
||||
|
||||
def test_PSTN(self):
|
||||
landpoint=np.array([-1945072.5,5344083.0,2878316.0]).reshape(1,3)
|
||||
landpoint=np.array(OrthoAuxData.LLA2XYZ(100.3470449857,27.4318507628,3451))
|
||||
|
||||
landpoint=landpoint.reshape(1,3)
|
||||
# 间接定位法所需的参数
|
||||
Doppler_d = np.array(self.header_info['ImageInformation']['DopplerCentroidCoefficients']).reshape(-1, 1)
|
||||
Doppler_d = np.array(self.header_info['ImageInformation']['DopplerRate']).reshape(-1, 1)
|
||||
LightSpeed = self.config['LightSpeed']
|
||||
T0 = self.header_info['ImageInformation']['refRange'] * 2 / LightSpeed
|
||||
T0 = self.header_info['ImageInformation']['DopplerParametersReferenceTime']
|
||||
lamda = self.header_info['ImageInformation']['lambda']
|
||||
StartTime = self.header_info['ImageInformation']['StartTime']
|
||||
PRF = self.header_info['PRF']
|
||||
Fs=self.Fs
|
||||
R0 = self.header_info['ImageInformation']['NearRange']
|
||||
r,c,ti=self.PSTN_block(landpoint, Doppler_d, StartTime, lamda, T0, LightSpeed, PRF, R0)
|
||||
|
||||
r,c,ti=self.PSTN_block(landpoint, Doppler_d, StartTime, lamda, T0, LightSpeed, PRF, R0,Fs)
|
||||
print(r,c,ti)
|
||||
pass
|
||||
def findInitPoint(self,sim_mask,dem_gt,sim_r_tif,sim_c_tif,sampling_f):
|
||||
|
||||
|
@ -2223,7 +2224,7 @@ class IndirectOrthorectification(Orthorectification):
|
|||
ti[start_i:end_i,:]=ti_temp.copy()
|
||||
return r,c,ti
|
||||
|
||||
def PSTN_block(self, TargetPostion, Doppler_d, StartTime, lamda, T0, LightSpeed, PRF, R0):
|
||||
def PSTN_block(self, TargetPostion, Doppler_d, StartTime, lamda, T0, LightSpeed, PRF, R0,Fs):
|
||||
'''
|
||||
间接求解方法,使用矩阵方法
|
||||
args:
|
||||
|
@ -2276,15 +2277,15 @@ class IndirectOrthorectification(Orthorectification):
|
|||
# 斜距
|
||||
R = np.sqrt(np.sum(R_sc ** 2, axis=1)).reshape(-1, 1) # nx1
|
||||
# 根据多普勒数值求解公式求解多普勒频移值
|
||||
TSR= R * (2 / LightSpeed) - T0 # nx1
|
||||
TSR= R * (2 / LightSpeed) # - T0 # nx1
|
||||
TSRx[:,0]=TSR[:,0]**0 # nx5
|
||||
TSRx[:,1]=TSR[:,0]**1
|
||||
TSRx[:,2]=TSR[:,0]**2
|
||||
TSRx[:,3]=TSR[:,0]**3
|
||||
TSRx[:,4]=TSR[:,0]**4
|
||||
# TSRx[:,4]=TSR[:,0]**4
|
||||
# 根据多普勒物理公式求解求解多普勒频移值
|
||||
FdTheory=-2*np.reciprocal(lamda*R)*np.sum(R_sc * V_sc, axis=1).reshape(-1, 1) # nx1
|
||||
FdNumerical= np.matmul(TSRx, Doppler_d) # nx1
|
||||
FdNumerical= 0;np.matmul(TSRx, Doppler_d) # nx1
|
||||
|
||||
FdTheory_grad = np.reciprocal((FdTheory_grad - FdTheory) * dt_rec) # nx1
|
||||
inc_t = (FdTheory - FdNumerical) * FdTheory_grad #(FdTheory - FdNumerical) * (1 / FdTheory_grad) # nx1
|
||||
|
@ -2295,16 +2296,14 @@ class IndirectOrthorectification(Orthorectification):
|
|||
#del Rs,R_sc,V_sc,R,satelliteSpaceState,FdTheory_grad,FdNumerical,inc_t
|
||||
#print("当前python程序,{} step, inc_t {} 求解内存占用 {}G".format(i,np.max(inc_t),psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024))
|
||||
# 计算行号
|
||||
ti_=copy.deepcopy(ti.copy())
|
||||
r_ = (ti_ - StartTime)*PRF
|
||||
|
||||
r= (ti - StartTime)*PRF
|
||||
delta_t_light=delta_t*LightSpeed
|
||||
r=copy.deepcopy(r_.copy())
|
||||
del r_
|
||||
c_ = (R - R0) * (1 / delta_R)
|
||||
c=copy.deepcopy(c_.copy())
|
||||
del c_
|
||||
ti = copy.deepcopy(ti_.copy())
|
||||
del ti_
|
||||
c = 2*(R - R0) / LightSpeed * Fs
|
||||
"""
|
||||
<refRow>1</refRow>
|
||||
<refColumn>26669</refColumn>
|
||||
"""
|
||||
return r, c, ti
|
||||
pass
|
||||
|
||||
|
@ -2983,3 +2982,11 @@ class IndirectOrthorectification(Orthorectification):
|
|||
return None
|
||||
pass
|
||||
'''
|
||||
|
||||
if __name__=="__main__":
|
||||
path2=r"D:\LTOrth\Ortho"
|
||||
slcpath=r"D:\micro\WorkSpace\Ortho\Temporary\unpack\LT1B_MONO_KSC_STRIP2_007065_E100.8_N26.6_20230616_SLC_HH_L1A_0000135014"
|
||||
workspace_package_path=r"D:\micro\WorkSpace\Ortho\Temporary\package"
|
||||
Orthorectification = IndirectOrthorectification(os.path.join(path2,"config.yaml"))
|
||||
Orthorectification.IndirectOrthorectification(slcpath, workspace_package_path) # 改动1
|
||||
Orthorectification.test_PSTN() # 测试代码
|
||||
|
|
|
@ -525,6 +525,7 @@ class OrthoMain:
|
|||
Orth_Slc=[]
|
||||
in_dem_path = self.__in_processing_paras['DEM']
|
||||
meta_file_path = self.__in_processing_paras['META'] # .meta文件路径
|
||||
|
||||
out_dem_path = self.__workspace_ResampledDEM_path
|
||||
dem_merged_path=DEMProcess.dem_merged(in_dem_path, meta_file_path, out_dem_path) # 生成TestDEM\mergedDEM_VRT.tif
|
||||
|
||||
|
@ -538,7 +539,7 @@ class OrthoMain:
|
|||
path2 = env_str
|
||||
Orthorectification = IndirectOrthorectification(os.path.join(path2,"config.yaml"))
|
||||
Orthorectification.IndirectOrthorectification(self.__in_processing_paras["SLC"], self.__workspace_package_path) # 改动1
|
||||
# 2.3 输出结果
|
||||
Orthorectification.test_PSTN() # 测试代码
|
||||
|
||||
# 3 处理RD
|
||||
in_slc_path=None
|
||||
|
@ -725,7 +726,7 @@ class OrthoMain:
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
DEBUG=False
|
||||
DEBUG=True
|
||||
if '-DEBUG' in sys.argv:
|
||||
DEBUG=True
|
||||
start = datetime.datetime.now()
|
||||
|
|
|
@ -52,7 +52,7 @@ imageinfo: # 影像信息
|
|||
"%Y-%m-%dT%H:%M:%S.%f"
|
||||
EndImageTime: # 影像中止时间
|
||||
NodePath:
|
||||
['level1Product','productInfo','sceneInfo', 'stop', 'timeUTC']
|
||||
['level1Product','productInfo','sceneInfo', 'stop', 'timeUTC']
|
||||
Format:
|
||||
"%Y-%m-%dT%H:%M:%S.%f"
|
||||
CenterImageTime: # 中心像元时间
|
||||
|
|
Loading…
Reference in New Issue