更新后向散射系数,修改配准内存溢出问题
parent
07bf00a634
commit
e27e358610
|
@ -1,6 +1,28 @@
|
||||||
# -*- mode: python ; coding: utf-8 -*-
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
import sys
|
||||||
|
from shutil import copy
|
||||||
|
import os
|
||||||
|
|
||||||
|
cwdpath = os.getcwd()
|
||||||
|
toolDir = os.path.join(cwdpath, 'tool')
|
||||||
|
if os.path.exists(toolDir):
|
||||||
|
os.remove(toolDir)
|
||||||
|
os.mkdir(toolDir)
|
||||||
|
source_folder = '../tool'
|
||||||
|
|
||||||
|
def copy_file(path_read, path_write):
|
||||||
|
names = os.listdir(path_read)
|
||||||
|
for name in names:
|
||||||
|
path_read_new = os.path.join(path_read, name)
|
||||||
|
path_write_new = os.path.join(path_write, name)
|
||||||
|
if os.path.isdir(path_read_new):
|
||||||
|
if not os.path.exists(path_write_new):
|
||||||
|
os.mkdir(path_write_new)
|
||||||
|
copy_file(path_read_new, path_write_new)
|
||||||
|
else:
|
||||||
|
copy(path_read_new, path_write_new)
|
||||||
|
|
||||||
|
copy_file(source_folder, toolDir)
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -300,6 +300,7 @@ class ScatteringMain:
|
||||||
# 对映射表进行校正
|
# 对映射表进行校正
|
||||||
sim_ori_tiff = out_dir_path + "\\" + "RD_sim_ori.tif"
|
sim_ori_tiff = out_dir_path + "\\" + "RD_sim_ori.tif"
|
||||||
out_sim_ori = out_dir_path + "\\" + "sim_ori-ortho.tif"
|
out_sim_ori = out_dir_path + "\\" + "sim_ori-ortho.tif"
|
||||||
|
out_sim_ori_temp = self.__workspace_baseMap_path + "\\" + "sim_ori-ortho.tif"
|
||||||
parameter_path = os.path.join(self.__workspace_processing_path, "orth_para.txt")
|
parameter_path = os.path.join(self.__workspace_processing_path, "orth_para.txt")
|
||||||
in_tif_paths = list(glob.glob(os.path.join(slc_paths, '*.tiff')))
|
in_tif_paths = list(glob.glob(os.path.join(slc_paths, '*.tiff')))
|
||||||
out_rpc_db = os.path.join(self.__workspace_baseMap_path, 'rpc_line.tif')
|
out_rpc_db = os.path.join(self.__workspace_baseMap_path, 'rpc_line.tif')
|
||||||
|
@ -335,7 +336,8 @@ class ScatteringMain:
|
||||||
lon_new = im_geotrans[0] + x
|
lon_new = im_geotrans[0] + x
|
||||||
lat_new = im_geotrans[3] - y
|
lat_new = im_geotrans[3] - y
|
||||||
im_geosNew = [lon_new, im_geotrans[1], im_geotrans[2], lat_new, im_geotrans[4], im_geotrans[5]]
|
im_geosNew = [lon_new, im_geotrans[1], im_geotrans[2], lat_new, im_geotrans[4], im_geotrans[5]]
|
||||||
ImageHandler().write_img(out_sim_ori, im_proj, im_geosNew, im_arr)
|
ImageHandler().write_img(out_sim_ori_temp, im_proj, im_geosNew, im_arr)
|
||||||
|
pp.resample_by_gdal(out_sim_ori_temp, out_sim_ori) # todo 重采样为方像元
|
||||||
os.remove(sim_ori_tiff)
|
os.remove(sim_ori_tiff)
|
||||||
return out_sim_ori
|
return out_sim_ori
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,28 @@
|
||||||
# -*- mode: python ; coding: utf-8 -*-
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
import sys
|
||||||
|
from shutil import copy
|
||||||
|
import os
|
||||||
|
|
||||||
|
cwdpath = os.getcwd()
|
||||||
|
toolDir = os.path.join(cwdpath, 'tool')
|
||||||
|
if os.path.exists(toolDir):
|
||||||
|
os.remove(toolDir)
|
||||||
|
os.mkdir(toolDir)
|
||||||
|
source_folder = '../tool'
|
||||||
|
|
||||||
|
def copy_file(path_read, path_write):
|
||||||
|
names = os.listdir(path_read)
|
||||||
|
for name in names:
|
||||||
|
path_read_new = os.path.join(path_read, name)
|
||||||
|
path_write_new = os.path.join(path_write, name)
|
||||||
|
if os.path.isdir(path_read_new):
|
||||||
|
if not os.path.exists(path_write_new):
|
||||||
|
os.mkdir(path_write_new)
|
||||||
|
copy_file(path_read_new, path_write_new)
|
||||||
|
else:
|
||||||
|
copy(path_read_new, path_write_new)
|
||||||
|
|
||||||
|
copy_file(source_folder, toolDir)
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<ParaType>File</ParaType>
|
<ParaType>File</ParaType>
|
||||||
<DataType>tar.gz</DataType>
|
<DataType>tar.gz</DataType>
|
||||||
<ParaSource>Man</ParaSource>
|
<ParaSource>Man</ParaSource>
|
||||||
<ParaValue>F:\MicroWorkspace\20240814tw\HJ2E_KRN_QPS_008852_E110.6_N20.1_20240515_SLC_AHV_L10000208028-Ortho.tar.gz</ParaValue>
|
<ParaValue>F:\MicroWorkspace\S_SAR\AHV\HJ2E_MYC_QPS_001752_E118.0_N37.7_20230204_SLC_AHV_L10000010458-Ortho.tar.gz</ParaValue>
|
||||||
<EnModification>True</EnModification>
|
<EnModification>True</EnModification>
|
||||||
<EnMultipleChoice>False</EnMultipleChoice>
|
<EnMultipleChoice>False</EnMultipleChoice>
|
||||||
<Control>File</Control>
|
<Control>File</Control>
|
||||||
|
@ -51,9 +51,9 @@
|
||||||
<ParaChsName>标记数据</ParaChsName>
|
<ParaChsName>标记数据</ParaChsName>
|
||||||
<Description>标记的样本数据</Description>
|
<Description>标记的样本数据</Description>
|
||||||
<ParaType>File</ParaType>
|
<ParaType>File</ParaType>
|
||||||
<DataType>csv</DataType>
|
<DataType>zip</DataType>
|
||||||
<ParaSource>Man</ParaSource>
|
<ParaSource>Man</ParaSource>
|
||||||
<ParaValue>F:\MicroWorkspace\20240814tw\LandCover.csv</ParaValue>
|
<ParaValue>F:\al_zhongji\S-SAR-data\landCover\SSAR_landcover_landaCoverSample.zip</ParaValue>
|
||||||
<EnModification>True</EnModification>
|
<EnModification>True</EnModification>
|
||||||
<EnMultipleChoice>True</EnMultipleChoice>
|
<EnMultipleChoice>True</EnMultipleChoice>
|
||||||
<Control>UploadInput</Control>
|
<Control>UploadInput</Control>
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
<ParaType>File</ParaType>
|
<ParaType>File</ParaType>
|
||||||
<DataType>tar.gz</DataType>
|
<DataType>tar.gz</DataType>
|
||||||
<ParaSource>Man</ParaSource>
|
<ParaSource>Man</ParaSource>
|
||||||
<ParaValue>D:\micro\SWork\LandCover\Output\HJ2E_KRN_QPS_008852_E110.6_N20.1_20240515_SLC_AHV_L10000208028-Ortho-LANDCLASS.tar.gz</ParaValue>
|
<ParaValue>D:\micro\SWork\LandCover\Output\HJ2E_MYC_QPS_001752_E118.0_N37.7_20230204_SLC_AHV_L10000010458-Ortho-LANDCLASS.tar.gz</ParaValue>
|
||||||
</Parameter>
|
</Parameter>
|
||||||
</Outputs>
|
</Outputs>
|
||||||
</AlgCompt>
|
</AlgCompt>
|
||||||
|
|
|
@ -386,7 +386,7 @@ class MoistureMain:
|
||||||
# data[data > soil_moisture_value_max] = soil_moisture_value_max
|
# data[data > soil_moisture_value_max] = soil_moisture_value_max
|
||||||
data[data < soil_moisture_value_min] = -9999
|
data[data < soil_moisture_value_min] = -9999
|
||||||
data[data > soil_moisture_value_max] = -9999
|
data[data > soil_moisture_value_max] = -9999
|
||||||
self.imageHandler.write_img(product_path, proj, geos, data)
|
self.imageHandler.write_img(product_path, proj, geos, data, '-9999')
|
||||||
|
|
||||||
# 生成快视图
|
# 生成快视图
|
||||||
self.imageHandler.write_quick_view(product_path)
|
self.imageHandler.write_quick_view(product_path)
|
||||||
|
|
|
@ -1,6 +1,28 @@
|
||||||
# -*- mode: python ; coding: utf-8 -*-
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
import sys
|
||||||
|
from shutil import copy
|
||||||
|
import os
|
||||||
|
|
||||||
|
cwdpath = os.getcwd()
|
||||||
|
toolDir = os.path.join(cwdpath, 'tool')
|
||||||
|
if os.path.exists(toolDir):
|
||||||
|
os.remove(toolDir)
|
||||||
|
os.mkdir(toolDir)
|
||||||
|
source_folder = '../tool'
|
||||||
|
|
||||||
|
def copy_file(path_read, path_write):
|
||||||
|
names = os.listdir(path_read)
|
||||||
|
for name in names:
|
||||||
|
path_read_new = os.path.join(path_read, name)
|
||||||
|
path_write_new = os.path.join(path_write, name)
|
||||||
|
if os.path.isdir(path_read_new):
|
||||||
|
if not os.path.exists(path_write_new):
|
||||||
|
os.mkdir(path_write_new)
|
||||||
|
copy_file(path_read_new, path_write_new)
|
||||||
|
else:
|
||||||
|
copy(path_read_new, path_write_new)
|
||||||
|
|
||||||
|
copy_file(source_folder, toolDir)
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -276,6 +276,40 @@ class PreProcess:
|
||||||
logger.error('shapely.geos.TopologicalError occurred!')
|
logger.error('shapely.geos.TopologicalError occurred!')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def resample_by_gdal(in_path, out_path):
|
||||||
|
src_ds = gdal.Open(in_path, gdal.GA_ReadOnly)
|
||||||
|
|
||||||
|
# 设置目标影像的投影和范围
|
||||||
|
target_projection = src_ds.GetProjection()
|
||||||
|
target_geotransform = src_ds.GetGeoTransform()
|
||||||
|
|
||||||
|
x_scale = target_geotransform[1]
|
||||||
|
y_scale = target_geotransform[5]
|
||||||
|
scale = [x_scale, np.abs(y_scale)]
|
||||||
|
new_scale = np.max(scale)
|
||||||
|
|
||||||
|
dst_geotransform = [target_geotransform[0], new_scale, target_geotransform[2], target_geotransform[3],
|
||||||
|
target_geotransform[4], -new_scale]
|
||||||
|
target_x_size = int(src_ds.RasterXSize * x_scale / new_scale) # 假设我们要将影像大小缩小到原来的一半
|
||||||
|
target_y_size = int(src_ds.RasterYSize * np.abs(y_scale) / new_scale)
|
||||||
|
|
||||||
|
# 创建输出驱动
|
||||||
|
driver = gdal.GetDriverByName('GTiff')
|
||||||
|
|
||||||
|
# 创建输出文件
|
||||||
|
dst_ds = driver.Create(out_path, target_x_size, target_y_size, src_ds.RasterCount,
|
||||||
|
src_ds.GetRasterBand(1).DataType)
|
||||||
|
dst_ds.SetGeoTransform(dst_geotransform)
|
||||||
|
dst_ds.SetProjection(target_projection)
|
||||||
|
|
||||||
|
# 执行重采样
|
||||||
|
gdal.ReprojectImage(src_ds, dst_ds, None, None, gdal.GRA_Bilinear) # 使用双线性插值
|
||||||
|
|
||||||
|
# 关闭数据集
|
||||||
|
dst_ds = None
|
||||||
|
src_ds = None
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def write_polygon_shp(out_shp_path, point_list, EPSG =32649):
|
def write_polygon_shp(out_shp_path, point_list, EPSG =32649):
|
||||||
|
|
|
@ -693,7 +693,12 @@ class ImageHandler:
|
||||||
img_col_start = x_split * 1
|
img_col_start = x_split * 1
|
||||||
img_col_end = x_split * 3
|
img_col_end = x_split * 3
|
||||||
img_row_start = y_split * 1
|
img_row_start = y_split * 1
|
||||||
img_row_end = y_split *3
|
img_row_end = y_split * 3
|
||||||
|
cols = img_col_end - img_col_start
|
||||||
|
rows = img_row_end - img_row_start
|
||||||
|
if cols > 10000 or rows > 10000:
|
||||||
|
img_col_end = img_col_start + 10000
|
||||||
|
img_row_end = img_row_start + 10000
|
||||||
|
|
||||||
point_upleft = self.trans_rowcol2geo(img_geotrans, img_col_start, img_row_start)
|
point_upleft = self.trans_rowcol2geo(img_geotrans, img_col_start, img_row_start)
|
||||||
point_upright = self.trans_rowcol2geo(img_geotrans, img_col_end, img_row_start)
|
point_upright = self.trans_rowcol2geo(img_geotrans, img_col_end, img_row_start)
|
||||||
|
|
Loading…
Reference in New Issue