microproduct/deformation-sentiral/testCP.py

50 lines
1.8 KiB
Python
Raw Permalink Normal View History

2023-08-28 10:17:29 +00:00
"""
@Project microproduct
@File DeformationMain.py
@Function 干涉形变
@Author SHJ
@Contactk
@Date 2021/9/1
@Version 1.0.0
"""
import datetime
import logging
import os
import shutil
import sys
import tarfile
from tool.algorithm.xml.AlgXmlHandle import CheckSource, ManageAlgXML
# from tool.algorithm.xml.CreatMetafile import CreateMetafile
# from ImageHandle import ImageHandler
from save_gdal import save_gdal_main
from view import view_main
from autorun import auto_run_main
from logHandler import LogHandler
from ConfigeHandle import Config as cf
import pyproj._compat # 解决打包报错
import scipy #解决打包错误
import scipy.spatial.transform # 用于解决打包错误
import scipy.spatial.transform._rotation_groups # 用于解决打包错误
import scipy.special.cython_special # 用于解决打包错误
# h5数据转tif
import glob
path_list = list(glob.glob(os.path.join(r'D:\kongjitest\DeformationMain\testdata\output\Deformation\Temporary\preprocessed\mintpy_workspace\geo', '*.h5')))
for path in path_list:
#logger.info('write:{}'.format(path))
fname, fext = os.path.splitext(os.path.basename(path))
# 转为tif
save_gdal_main([path, '-o', os.path.join(r'D:\kongjitest\DeformationMain\testdata\output\Deformation\Temporary\preprocessed\mintpy_workspace\geo', fname + '.tif')])
if fname == 'geo_velocity':
# 生成快视图
view_main([path, 'velocity', '--nodisplay'])
else:
# 生成快视图
view_main([path, '--nodisplay'])
# 复制快视图到产品目录
in_quik_img_path = fname + '.png'
out_quik_img_path = os.path.join(r'D:\kongjitest\DeformationMain\testdata\output\Deformation\Temporary\preprocessed\mintpy_workspace\geo', fname + '.jpg')
shutil.copy(in_quik_img_path, out_quik_img_path)