From bc07e824d2c5e7a6b884f8e60a53b5b41d85a9c4 Mon Sep 17 00:00:00 2001 From: mnCompanyPC1 Date: Fri, 13 Oct 2023 13:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=AD=A3=E5=B0=84=E8=A7=92=E5=BA=A6?= =?UTF-8?q?=E5=86=99=E5=85=A5meta.xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ortho/Ortho.xml | 8 ++++---- Ortho/OrthoMain.py | 22 +++++++++++++++++++++- tool/algorithm/image/ImageHandle.py | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Ortho/Ortho.xml b/Ortho/Ortho.xml index 44969127..9a977d45 100644 --- a/Ortho/Ortho.xml +++ b/Ortho/Ortho.xml @@ -1,7 +1,7 @@ CSAR_202107275419_0001-0 - D:\micro\WorkSpace\ + K:\mircoData\OutTest\ File ElementAlg @@ -45,7 +45,7 @@ File tar.gz Cal - E:\MicroWorkspace\Micro\neimenggu\GF3_MDJ_QPSI_031847_E116.4_N43.9_20220828_L1A_AHV_L10006708819.tar.gz + K:\mircoData\Azimuth\GF3_SAY_QPSI_011444_E118.9_N31.4_20181012_L1A_AHV_L10003515422.tar.gz True False File @@ -60,7 +60,7 @@ File File Cal - E:\MicroWorkspace\Micro\neimenggu\DEM + K:\mircoData\Azimuth\DEM True True File @@ -92,7 +92,7 @@ File tar.gz Cal - D:\micro\WorkSpace\Ortho\Output\GF3_MDJ_QPSI_031847_E116.4_N43.9_20220828_L1A_AHV_L10006708819-ortho.tar.gz + K:\mircoData\OutTest\Ortho\Output\GF3_SAY_QPSI_011444_E118.9_N31.4_20181012_L1A_AHV_L10003515422-ortho.tar.gz diff --git a/Ortho/OrthoMain.py b/Ortho/OrthoMain.py index 807b2764..b71f0987 100644 --- a/Ortho/OrthoMain.py +++ b/Ortho/OrthoMain.py @@ -358,6 +358,20 @@ class OrthoMain: self.processinfo = [hh_flag, hv_flag, vh_flag, vv_flag,dh_flag] return para_dic + + def getAzuimithFromTxt(self,Txtpath): + Azuimith = 0 + # 打开txt文件 + file = open(Txtpath, 'r') + + # 读取文件内容 + Azuimith = file.read() + + # 关闭文件 + file.close() + + return Azuimith + def process_handle(self): isError, CorrectMethod = self.__check_handler.check_input_paras(['CorrectMethod']) # //todo 获取xml中校正方法 根据不同方法进行结果处理 @@ -574,7 +588,10 @@ class OrthoMain: GTC_out_path=self.__workspace_package_path parameter_path = os.path.join(self.__workspace_package_path, "orth_para.txt") - dem_rc = os.path.join(self.__workspace_Temporary_path, "dem_rc.tiff") + # ERROR 4: K:\mircoData\OutTest\Ortho\Temporary\dem_rc.tiff: No such file or directory报错 + # c++项目中this->dem_rc_path = JoinPath(out_dir_path, "RD_sim_ori.tif");路径不对 + #dem_rc = os.path.join(self.__workspace_Temporary_path, "dem_rc.tiff") + dem_rc = os.path.join(self.__workspace_package_path, "RD_sim_ori.tif") in_tif_paths = list(glob.glob(os.path.join(slc_paths, '*.tiff'))) for in_tif_path in in_tif_paths: @@ -641,6 +658,9 @@ class OrthoMain: para_dict = CreateMetaDict(image_path, self.__in_processing_paras['META'], self.__workspace_package_path, out_path1, out_path2).calu_nature() para_dict.update({"ProductProductionInfo_BandSelection": "1,2"}) para_dict.update({"ProductProductionInfo_AuxiliaryDataDescription": "DEM"}) + #更新meta.xml中方位角信息 + Azuimith=self.getAzuimithFromTxt(self.__workspace_Temporary_path+'\Azimuth.txt') + para_dict.update({"ObservationGeometry_SatelliteAzimuth": Azuimith}) CreateProductXml(para_dict, model_path, meta_xml_path).create_standard_xml() # 生成压缩包 diff --git a/tool/algorithm/image/ImageHandle.py b/tool/algorithm/image/ImageHandle.py index 046b43bd..93671dd3 100644 --- a/tool/algorithm/image/ImageHandle.py +++ b/tool/algorithm/image/ImageHandle.py @@ -598,7 +598,7 @@ class ImageHandler: min = np.percentile(t_data, 2) # np.nanmin(t_data) max = np.percentile(t_data, 98) # np.nanmax(t_data) t_data[np.isnan(t_data)] = max - if (max - min) < 256 & (max-min) != 0: # 会报异常RuntimeWarning: divide by zero encountered in true_divide t_data = (t_data - min) / (max - min) * 255 jia's + if (max - min) < 256 : # 会报异常RuntimeWarning: divide by zero encountered in true_divide t_data = (t_data - min) / (max - min) * 255 jia's t_data = (t_data - min) / (max - min) * 255 out_img = Image.fromarray(t_data) out_img = out_img.resize((q_c, q_r)) # 重采样