fix(raw_to_cog): 清理导入顺序并移除未使用的参数
- 将导入语句按标准顺序重新排列(标准库、第三方库、本地模块) - 移除 tif_to_cog 函数中未使用的 scaleParams 参数 - 更新示例代码中的测试路径和输出数据类型 - 更新文件最后修改日期
This commit is contained in:
parent
f608e3afab
commit
79778dc577
@ -8,16 +8,17 @@ COG (Cloud Optimized GeoTIFF) 是一种优化设计的 GeoTIFF 文件格式, 特
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Authors: CVEO Team
|
Authors: CVEO Team
|
||||||
Last Updated: 2026-02-03
|
Last Updated: 2026-04-22
|
||||||
===============================================================================
|
===============================================================================
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from osgeo import gdal
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from osgeo import gdal
|
||||||
|
|
||||||
# 添加父目录到 sys.path 以导入 utils
|
# 添加父目录到 sys.path 以导入 utils
|
||||||
BASE_DIR = Path(__file__).parent.parent
|
BASE_DIR = Path(__file__).parent.parent
|
||||||
@ -74,7 +75,6 @@ def tif_to_cog(
|
|||||||
output_type: int = gdal.GDT_Float32,
|
output_type: int = gdal.GDT_Float32,
|
||||||
no_data: float = np.nan,
|
no_data: float = np.nan,
|
||||||
compress: str = "DEFLATE",
|
compress: str = "DEFLATE",
|
||||||
scaleParams: list = None,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
将传统 GeoTIFF 转换为 COG 格式
|
将传统 GeoTIFF 转换为 COG 格式
|
||||||
@ -205,9 +205,10 @@ def main(input_path, output_path, output_type=gdal.GDT_Float32):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# 输入目录: 包含分块tif影像的根目录
|
# 输入目录: 包含分块tif影像的根目录
|
||||||
input_root = Path(r"D:\CVEOdata\RS_Data\Terrain")
|
input_root = Path(r"D:\CVEOdata\RS_Data\Terrain\test")
|
||||||
# 输出目录: 存放最终COG结果的目录
|
# 输出目录: 存放最终COG结果的目录
|
||||||
output_root = Path(r"D:\CVEOdata\RS_Data\Terrain")
|
output_root = Path(r"D:\CVEOdata\RS_Data\Terrain")
|
||||||
input_path = input_root / "GLO30.DSM.2014.Hubei.30m.tif"
|
input_path = input_root / "GLO30.DSM.2014.Hubei.30m.tif"
|
||||||
output_path = output_root / "GLO30.DSM.2014.Hubei.30m.tif"
|
output_path = output_root / "GLO30.DSM.2014.Hubei.30m.tif"
|
||||||
output_type = gdal.GDT_Byte
|
output_type = gdal.GDT_Float32
|
||||||
|
main(input_path, output_path, output_type)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user