diff --git a/landcover-S-SAR/LandCover-S-SAR.xml b/landcover-S-SAR/LandCover-S-SAR.xml index 72f12a6..973ad82 100644 --- a/landcover-S-SAR/LandCover-S-SAR.xml +++ b/landcover-S-SAR/LandCover-S-SAR.xml @@ -38,7 +38,7 @@ File tar.gz Man - F:\MicroWorkspace\S_SAR\AHV\HJ2E_MYC_QPS_001752_E118.0_N37.7_20230204_SLC_AHV_L10000010458-Ortho.tar.gz + F:\xibei_LandCover\S-SAR-西北实验\1116\HJ2E_KSC_QPS_006084_E86.2_N44.4_20231116_SLC_AHV_L10000132474-Ortho.tar.gz True False File @@ -51,9 +51,9 @@ 标记数据 标记的样本数据 File - zip + csv Man - F:\al_zhongji\S-SAR-data\landCover\SSAR_landcover_landaCoverSample.zip + F:\xibei_LandCover\landCoverSamples.csv True True UploadInput @@ -86,7 +86,7 @@ Value string Man - 0,1,2 + 0,1,2,3,4,5,6,7,8,9 True True UploadInput @@ -103,7 +103,7 @@ File tar.gz Man - D:\micro\SWork\LandCover\Output\HJ2E_MYC_QPS_001752_E118.0_N37.7_20230204_SLC_AHV_L10000010458-Ortho-LANDCLASS.tar.gz + D:\micro\SWork\LandCover\Output\HJ2E_KSC_QPS_006084_E86.2_N44.4_20231116_SLC_AHV_L10000132474-Ortho-LANDCLASS.tar.gz diff --git a/leafAreaIndex-S-SAR/LeafAreaIndex.xml b/leafAreaIndex-S-SAR/LeafAreaIndex.xml index b8414d1..ee3c1e3 100644 --- a/leafAreaIndex-S-SAR/LeafAreaIndex.xml +++ b/leafAreaIndex-S-SAR/LeafAreaIndex.xml @@ -1,7 +1,7 @@ CSAR_202107275419_0001-0 - D:\613NET\ComputingNode\ftproot\Production\PL_20240507155658_0002\ + D:\micro\SWork\ File ElementAlg @@ -53,7 +53,7 @@ File tar.gz Man - F:\MicroWorkspace\S_SAR\AHV\HJ2E_MYC_QPS_001752_E118.0_N37.7_20230204_SLC_AHV_L10000010458-cal.tar.gz + F:\MicroWorkspace\20240814tw\HJ2E_KRN_QPS_008852_E110.6_N20.1_20240515_SLC_AHV_L10000208028-cal.tar.gz True False File @@ -81,9 +81,9 @@ 土壤水分产品 土壤水分产品 File - zip + tif Man - F:\al_zhongji\S-SAR-data\leafAreaIndex\SSAR_leafAreaIndex_SMC.zip + F:\Tian-GF3-Wenchang\GF3_MYC_QPSI_040611_E110.6_N20.0_20240427_L1A_AHV_L10006928143-cal-SMC.tif True False File @@ -96,9 +96,9 @@ 叶面积指数实测数据 叶面积指数实测数据 File - zip + csv Man - F:\al_zhongji\S-SAR-data\leafAreaIndex\SSAR_leafAreaIndex_LAI.zip + F:\Tian-GF3-Wenchang\LAI\LAi.csv True False File @@ -111,9 +111,9 @@ NDVI NDVI影像,坐标系要求:WGS84 File - zip + tif Cal - F:\al_zhongji\S-SAR-data\leafAreaIndex\SSAR_leafAreaIndex_NDVI.zip + F:\Tian-GF3-Wenchang\NDVI\S2_NDVImed_SMC_GF3.tif True False File @@ -128,7 +128,7 @@ Value string Man - 0;1 + -1;1 True False UploadInput @@ -141,9 +141,9 @@ 地表覆盖度 地表覆盖度数据,坐标系要求:WGS84 File - zip + tif Cal - F:\al_zhongji\S-SAR-data\leafAreaIndex\SSAR_leafAreaIndex_LandCover.zip + F:\Tian-GF3-Wenchang\landCover_Glob30.tif True False File @@ -158,7 +158,7 @@ Value string Man - empty + 10;20;30;40;50;70;90 True False UploadInput @@ -235,7 +235,7 @@ File tar.gz Cal - D:\613NET\ComputingNode\ftproot\Production\PL_20240507155658_0002\LeafAreaIndex\Output\HJ2E_MYC_QPS_001752_E118.0_N37.7_20230204_SLC_AHV_L10000010458-cal-LAI.tar.gz + D:\micro\SWork\LeafAreaIndex\Output\HJ2E_KRN_QPS_008852_E110.6_N20.1_20240515_SLC_AHV_L10000208028-cal-LAI.tar.gz DEFAULT DEFAULT DEFAULT diff --git a/tool.rar b/tool.rar deleted file mode 100644 index 4964c91..0000000 Binary files a/tool.rar and /dev/null differ diff --git a/tool/algorithm/algtools/MetaDataHandler.py b/tool/algorithm/algtools/MetaDataHandler.py index 931c5b9..d12f60e 100644 --- a/tool/algorithm/algtools/MetaDataHandler.py +++ b/tool/algorithm/algtools/MetaDataHandler.py @@ -11,9 +11,13 @@ [修改序列] [修改日期] [修改者] [修改内容] 1 2022-6-29 石海军 1.兼容GF3元文件和正射校正元文件提取信息 """ +import json import logging from xml.etree.ElementTree import ElementTree import math + +import xmltodict + logger = logging.getLogger("mylog") class GF3L1AMetaData: @@ -27,6 +31,18 @@ class GF3L1AMetaData: QualifyValue = float(root.find('imageinfo').find('QualifyValue').find(polarization).text) return QualifyValue + @staticmethod + def get_SubQualifyValue(meta_file_path, polarization, pol_id): + try: + with open(meta_file_path, 'r', encoding='utf-8') as fp: + HeaderFile_dom_str = fp.read() + HeaderFile_dom = xmltodict.parse(HeaderFile_dom_str) # 将XML转成json文本 + HeaderFile_dom_json = json.loads(json.dumps(HeaderFile_dom)) + QualifyValue = float(HeaderFile_dom_json['product']['imageinfo']['QualifyValue'][pol_id][polarization]) + return QualifyValue + except Exception as e: + raise('get QualifyValue failed') + @staticmethod def get_Kdb(meta_file_path, polarization): @@ -89,6 +105,15 @@ class MetaDataHandler: logger.info('GF3L1AMetaData.get_QualifyValue() success!') return QualifyValue + def get_SubQualifyValue(meta_file_path, polarization, pol_id): + try: + QualifyValue = OrthoMetaData.get_QualifyValue(meta_file_path, polarization) + except Exception: + logger.warning('OrthoMetaData.get_QualifyValue() error!') + QualifyValue = GF3L1AMetaData.get_SubQualifyValue(meta_file_path, polarization, pol_id) + logger.info('GF3L1AMetaData.get_QualifyValue() success!') + return QualifyValue + @staticmethod def get_Kdb(meta_file_path, polarization): try: diff --git a/tool/algorithm/block/blockprocess.py b/tool/algorithm/block/blockprocess.py index db3555e..69e694a 100644 --- a/tool/algorithm/block/blockprocess.py +++ b/tool/algorithm/block/blockprocess.py @@ -280,8 +280,8 @@ class BlockProcess: block_y = int(np.ceil(image.shape[0] / out_size)) # todo 修改分块 for i in range(block_y): for j in range(block_x): - start_x = image.shape[1] - out_size if (j == block_x - 1) else j * out_size - start_y = image.shape[0] - out_size if (i == block_x - 1) else i * out_size + start_x = image.shape[1] - out_size if (j == block_x - 1 and block_x != 1) else j * out_size + start_y = image.shape[0] - out_size if (i == block_y - 1 and block_y != 1) else i * out_size end_x = image.shape[1] if (j + 1) * out_size > image.shape[1] else (j + 1) * out_size end_y = image.shape[0] if (i + 1) * out_size > image.shape[0] else (i + 1) * out_size diff --git a/tool/algorithm/image/ImageHandle.py b/tool/algorithm/image/ImageHandle.py index 9c641bb..bb00a7c 100644 --- a/tool/algorithm/image/ImageHandle.py +++ b/tool/algorithm/image/ImageHandle.py @@ -7,6 +7,8 @@ @Version :1.0.0 """ import os +from xml.etree.ElementTree import ElementTree + from PIL import Image from osgeo import gdal from osgeo import osr @@ -758,6 +760,19 @@ class ImageHandler: return quick_view_path + @staticmethod + def get_inc_angle(inc_xml, rows, cols, out_path): + tree = ElementTree() + tree.parse(inc_xml) # 影像头文件 + root = tree.getroot() + values = root.findall('incidenceValue') + angle_value = [value.text for value in values] + angle_value = np.array(angle_value) + inc_angle = np.tile(angle_value, (rows, 1)) + ImageHandler.write_img(out_path, '', [0.0, 1.0, 0.0, 0.0, 0.0, 1.0], inc_angle) + + pass + if __name__ == '__main__': fn = r"C:\Users\sxwcc\Downloads\HJ2E_MYC_QPS_001752_E118.0_N37.7_20230204_SLC_AHV_L10000010458-cal-SMC\HJ2E_MYC_QPS_001752_E118.0_N37.7_20230204_SLC_AHV_L10000010458-cal-SMC.tif" diff --git a/tool/algorithm/xml/AnalysisXml.py b/tool/algorithm/xml/AnalysisXml.py index 5910cc5..abfb611 100644 --- a/tool/algorithm/xml/AnalysisXml.py +++ b/tool/algorithm/xml/AnalysisXml.py @@ -1,6 +1,8 @@ from xml.etree.ElementTree import ElementTree import os +import numpy as np + class DictXml: def __init__(self, xml_path): @@ -39,18 +41,23 @@ class DictXml: if bottomRight is None: raise Exception("get bottomRight failed") + lons = [float(topLeft.find("longitude").text), float(topRight.find("longitude").text), float(bottomLeft.find("longitude").text), float(bottomRight.find("longitude").text)] + lats = [float(topLeft.find("latitude").text), float(topRight.find("latitude").text), float(bottomLeft.find("latitude").text), float(bottomRight.find("latitude").text)] + lon_min = np.min(lons) + lon_max = np.max(lons) + lat_min = np.min(lats) + lat_max = np.max(lats) + point_upleft = [float(topLeft.find("longitude").text), float(topLeft.find("latitude").text)] point_upright = [float(topRight.find("longitude").text), float(topRight.find("latitude").text)] point_downleft = [float(bottomLeft.find("longitude").text), float(bottomLeft.find("latitude").text)] point_downright = [float(bottomRight.find("longitude").text), float(bottomRight.find("latitude").text)] scopes = [point_upleft, point_upright, point_downleft, point_downright] - point_upleft_buf = [float(topLeft.find("longitude").text) - 0.6, float(topLeft.find("latitude").text) + 0.6] - point_upright_buf = [float(topRight.find("longitude").text) + 0.6, float(topRight.find("latitude").text) + 0.6] - point_downleft_buf = [float(bottomLeft.find("longitude").text) - 0.6, - float(bottomLeft.find("latitude").text) - 0.6] - point_downright_buf = [float(bottomRight.find("longitude").text) + 0.6, - float(bottomRight.find("latitude").text) - 0.6] + point_upleft_buf = [lon_min - 0.6, lat_max + 0.6] + point_upright_buf = [lon_max + 0.6, lat_max + 0.6] + point_downleft_buf = [lon_min - 0.6, lat_min - 0.6] + point_downright_buf = [lon_max + 0.6, lat_min - 0.6] scopes_buf = ([point_upleft_buf, point_upright_buf, point_downleft_buf, point_downright_buf], ) return scopes, scopes_buf