0
Follow
0
View

python gdal removes pyramid problem

caiwenxuan 注册会员
2023-02-28 01:13

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > an error prompt already exists within the pyramid, unable to add external pyramid, if need to delete the internal pyramid, can use gdaladdo command, For example:

import os
import subprocess

# 执行 gdaladdo 命令删除内部金字塔
subprocess.call(["gdaladdo", "-clean", r"D:\项目\GF02_PA1_023116_20181128_MY450_01_096_L1A_01_PSH.tif"])
 
# 打开数据集并建立外部金字塔
dataset = gdal.Open(r"D:\项目\GF02_PA1_023116_20181128_MY450_01_096_L1A_01_PSH.tif", gdal.GA_Update)
dataset.BuildOverviews("AVERAGE", [2, 4, 8, 16, 32])
dataset = None  # 关闭数据集

Here, use the -clean parameter of the gdaladdo command to remove the inner pyramid, then use BuildOverviews to build the outer pyramid.

eddiekyo 注册会员
2023-02-28 01:13
gsdhdsz 注册会员
2023-02-28 01:13

Based on Monster group and GPT:
Error message indicates that the current image already has an inner pyramid, and cannot add an outer pyramid. If you want to delete the inner pyramid, you can do so using the gdaladdo command. The specific steps are as follows:

Open a command line window and enter the following command to switch to the directory where the image is located:

cd D:\项目


Enter the following command to remove the inner pyramid of the image:

gdaladdo -clean GF02_PA1_023116_20181128_MY450_01_096_L1A_01_PSH.tif


After successful deletion, you can re-run your code to add the external pyramid.
Note that deleting an inner pyramid removes all levels of the original pyramid, so you need to consider which levels to generate before regenerating the pyramid to avoid affecting subsequent operations.

About the Author

Question Info

Publish Time
2023-02-28 01:13
Update Time
2023-02-28 01:13

Related Question

如何添加蜂鸣器到我的python项目?(复制)

在Python中有应用平均曲率模糊的库吗?

MLFlow项目;Bash: python: command not found

在python中找不到指定的文件

请问下图中 not enough values to unpack(expect4,got1)如何解决?(语言-python)

减慢Python请求的速度?

在python上导入文本文件

Python终端一直无法使用,是不是电脑问题,如何解决这个问题啊

python代码运行出错

如何使python直方图百分比和达到100%?