简体   繁体   中英

How to change projection with MODIS hdf file using GDAL in Python?

I have some MODIS hdf files and trying to change the projection from Sinusoidal to Lambert Conformal Conic using GDAL module in Python.Here is my python code and it returns error message:

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

When I use command line to run :

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.

How can I fix it?Thanks!

os.sys is a module name. If you need to run a system command line you need to use os.system('command')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM