修改土壤水、土壤粗糙度插值模块解决内存溢出问题
parent
fb1a15151f
commit
10b484e4bf
|
@ -6,7 +6,7 @@
|
|||
@Date :2021/09/3 14:39
|
||||
@Version :1.0.0
|
||||
"""
|
||||
|
||||
import pyproj._compat #解决打包错误
|
||||
from osgeo import gdal
|
||||
import glob
|
||||
from pykrige import OrdinaryKriging # 强制引入包
|
||||
|
@ -953,7 +953,7 @@ class AtmosphericMain:
|
|||
logger.info('progress bar :35%')
|
||||
|
||||
# 二、 主影像
|
||||
# 2.1 执行stackSentinel.exe 生成运行配置文件
|
||||
# 2.1 执行stackSentinel.exe 生成运行配置文件 #
|
||||
# key_word = "20190113"
|
||||
key_word = self.mas_key_word
|
||||
self.isce_stackSentinel(slc_dir, dem_path, aux_dir, orbits_dir, isce_work_space, key_word, isce_exe_dir,box)
|
||||
|
|
|
@ -366,8 +366,8 @@ if __name__ == '__main__':
|
|||
except Exception:
|
||||
logger.exception('run-time error!')
|
||||
finally:
|
||||
# main_handler.del_temp_workspace()
|
||||
pass
|
||||
main_handler.del_temp_workspace()
|
||||
# pass
|
||||
end = datetime.datetime.now()
|
||||
msg = 'running use time: %s ' % (end - start)
|
||||
logger.info(msg)
|
|
@ -117,17 +117,17 @@ class SoilMoistureTool:
|
|||
return oh2004_tifpath
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
tif_path = r'F:\20230605\ortho\tif'
|
||||
put_path = r'F:\20230605\back\oh2004'
|
||||
cols = 7670
|
||||
rows = 7443
|
||||
incidence_file = r'F:\20230605\ortho\RD_localincidentAngle.tiff'
|
||||
xml_file = r'F:\20230605\ortho\GF3C_MYC_QPSI_005390_E121.7_N41.1_20230415_L1A_AHV_L10000135644.meta.xml'
|
||||
|
||||
soil = SoilMoistureTool(tif_path, put_path, cols, rows, incidence_file, xml_file)
|
||||
soil.soil_oh2004()
|
||||
# if __name__ == '__main__':
|
||||
#
|
||||
# tif_path = r'F:\20230605\ortho\tif'
|
||||
# put_path = r'F:\20230605\back\oh2004'
|
||||
# cols = 7670
|
||||
# rows = 7443
|
||||
# incidence_file = r'F:\20230605\ortho\RD_localincidentAngle.tiff'
|
||||
# xml_file = r'F:\20230605\ortho\GF3C_MYC_QPSI_005390_E121.7_N41.1_20230415_L1A_AHV_L10000135644.meta.xml'
|
||||
#
|
||||
# soil = SoilMoistureTool(tif_path, put_path, cols, rows, incidence_file, xml_file)
|
||||
# soil.soil_oh2004()
|
||||
# fn = r'F:\MicroWorkspace\mico_datas\GF3A_nanjing\PIESAR\test\GF3_SAY_QPSI_011444_E118.9_N31.4_20181012_L1A_HH_L10003515422.img'
|
||||
# fn1 = r'F:\MicroWorkspace\mico_datas\GF3A_nanjing\PIESAR\test11.bin'
|
||||
# data = ImageHandler().get_data(fn)
|
||||
|
|
|
@ -46,12 +46,12 @@ class SoilMoistureTool:
|
|||
atp.ahv_to_polsarpro_t3_soil(t3_path, tif_path)
|
||||
|
||||
# Lee滤波
|
||||
# leeFilter = LeeRefinedFilterT3()
|
||||
# lee_filter_path = os.path.join(self.__workspace_processing_path,
|
||||
# 'lee_filter\\')
|
||||
#
|
||||
# leeFilter.api_lee_refined_filter_T3('', t3_path, lee_filter_path, 0, 0, atp.rows(), atp.cols())
|
||||
# logger.info("refine_lee filter success!")
|
||||
leeFilter = LeeRefinedFilterT3()
|
||||
lee_filter_path = os.path.join(self.__workspace_processing_path,
|
||||
'lee_filter\\')
|
||||
|
||||
leeFilter.api_lee_refined_filter_T3('', t3_path, lee_filter_path, 0, 0, atp.rows(), atp.cols())
|
||||
logger.info("refine_lee filter success!")
|
||||
# logging.info("refine_lee filter success!")
|
||||
return t3_path
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ class VegetationHeightMain:
|
|||
para_dic.update({name: in_tif_path})
|
||||
vv_flag = 1
|
||||
elif 'IncidenceAngle' in os.path.basename(in_tif_path) or 'orth_sar_Angle' in os.path.basename(in_tif_path)\
|
||||
or "local_incidence" in os.path.basename(in_tif_path) or "orth_sar_incidence" in os.path.basename(in_tif_path):
|
||||
or "inci_Angle-ortho" in os.path.basename(in_tif_path) or "orth_sar_incidence" in os.path.basename(in_tif_path):
|
||||
name = 'IncidenceAngle_' + para_name
|
||||
para_dic.update({name: in_tif_path})
|
||||
angle_flag = 1
|
||||
|
@ -739,7 +739,7 @@ class VegetationHeightMain:
|
|||
lamda_01,height_01, width_01,lamda_02,height_02, width_02=self.calc_fe_kz()
|
||||
# self.force_del_file(self.__workspace_preprocessed_path)
|
||||
# 2、去地平效应 s2->flat_earth_removal->s2
|
||||
current_path = os.path.dirname(os.path.abspath(__file__))
|
||||
current_path = os.path.dirname(os.path.abspath(__file__))
|
||||
# flat_earth_removal_master_slave_path = os.path.join(current_path, "flat_earth_removal_MasterSlave.exe")
|
||||
flat_earth_removal_master_slave_path = os.path.join(current_path, "flat_earth_removal_Slave.exe")
|
||||
master_fer =master_s2 ## self.__workspace_preprocessed2_path + "master_fer""\\"
|
||||
|
@ -784,7 +784,7 @@ class VegetationHeightMain:
|
|||
coh_arrayt = AHVToPolSarProS2().read_none_complex_bin_to_array(t6_T11_bin)
|
||||
rows, cols=coh_arrayt.shape[0],coh_arrayt.shape[1]
|
||||
# 4、T6->boxcar_filter->T6
|
||||
logger.info('start computing the filter...')
|
||||
logger.info('start computing the filter...') # 线性平滑滤波
|
||||
boxcar_filter_tool_path = os.path.join(current_path, "boxcar_filter_T6.exe")
|
||||
# boxcar_filter_tool_path = os.path.join(current_path, "lee_refined_filter_T6.exe")
|
||||
master_slave_t6_box = self.__workspace_preprocessed2_path + "master_slave_t6_box""\\"
|
||||
|
@ -795,7 +795,7 @@ class VegetationHeightMain:
|
|||
# master_slave_t6, *(3, 3, 0, 0))
|
||||
logger.info("T6 lee_refined_filter finish")
|
||||
logger.info('progress bar :85%')
|
||||
# 5、 T6->coherence_estimation->T6
|
||||
# 5、 T6->coherence_estimation->T6 相干度估计
|
||||
coherence_estimation_path = os.path.join(current_path, "complex_coherence_estimation.exe")
|
||||
# coherence_opt_estimation_path = os.path.join(current_path, "complex_coherence_opt_estimation_T6.exe")
|
||||
master_slave_t6_box_coh = master_slave_t6_box
|
||||
|
@ -852,11 +852,11 @@ class VegetationHeightMain:
|
|||
array =np.fromfile(bin_path,dtype=np.float32).reshape(height_01, width_01) #AHVToPolSarProS2().read_none_complex_bin_to_array(bin_path)
|
||||
# 对结果进行掩膜
|
||||
#############
|
||||
if self.tif_angle_mask_path is None:
|
||||
array = array
|
||||
else:
|
||||
roi_img = self.imageHandler.get_band_array(self.tif_angle_mask_path)
|
||||
array = array * roi_img # 掩膜
|
||||
# if self.tif_angle_mask_path is None:
|
||||
# array = array
|
||||
# else:
|
||||
# roi_img = self.imageHandler.get_band_array(self.tif_angle_mask_path)
|
||||
# array = array * roi_img # 掩膜
|
||||
#self.mask_m_angle_array[np.where(self.mask_m_angle_array!=0)]=1
|
||||
#self.mask_a_angle_array[np.where(self.mask_a_angle_array!=0)]=1
|
||||
#self.mask_m_angle_array[np.where(self.mask_m_angle_array==0)]=math.nan
|
||||
|
|
Loading…
Reference in New Issue