2013-01-25 18 views
0

我有一些MODIS HDF文件,並試圖將投影從正弦使用GDAL模塊Python.Here改變等角圓錐投影是我的Python代碼並返回錯誤信息:如何在Python中使用GDAL改變MODIS hdf文件的投影?

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. 

我該如何解決它?謝謝!

+0

GIS.se dupe:http://gis.stackexchange.com/questions/6669/converting-projected-geotiff-to -wgs84-with-gdal-and-python –

回答

1

os.sys是模塊名稱。如果您需要運行系統命令行,則需要使用os.system('command')

+0

[Here](http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/samples/val_repl.py)是一個使用gdal模塊。希望這可以幫助。 – Erxin

相關問題