如何在Python中使用GDAL更改MODIS hdf文件的投影?

0 投票
1 回答
1812 浏览
提问于 2025-04-17 13:37

我有一些MODIS的hdf文件,想用Python中的GDAL模块把它们的投影从正弦投影改成兰伯特等角圆锥投影。这里是我的Python代码,但运行时出现了错误信息:

import os,sys
import gdal
import numpy

os.sys('gdalwarp test.hdf outfile.hdf -t_srs "+proj=lcc"')


  File "projection_cmd.py", line 5, in ?
    os.sys('gdalwarp test.hdf outfile.hdf -t_srs "+proj=lcc"')
TypeError: 'module' object is not callable

当我在命令行中运行:

gdalwarp test.hdf outfile.hdf -t_srs "+proj=lcc"
ERROR 1: Unable to compute a transformation between pixel/line
and georeferenced coordinates for test.hdf.
There is no affine transformation and no GCPs.

我该怎么解决这个问题呢?谢谢!

1 个回答

1

os.sys 是一个模块的名字。如果你想运行系统命令行,就需要用 os.system('命令')

撰写回答