如何在Python中使用GDAL更改MODIS hdf文件的投影?
我有一些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('命令')