I am working with Modis Data (MOD02, MOD11, MOD03, MOD35). In particular I am looking for a solution to reproject the subdatasets below, into albers equal. Because I am using NLCD dataset which uses albers.(PROJ4: +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs) area in 1000 m resolution. I will run a model for whole USA so I thats why I chose Albers.

Can somebody help me? By the way I am aware of the MRT Swath but I want to do this in Python environment.

So far I tried this but there was shifts in the pixels. (Alignment problems).

gdalwarp -tr 1000 1000 -of GTIFF -tps -t_srs "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23  +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs” -r cubic 'HDF4_EOS:EOS_SWATH:
"MOD021KM.A2007181.1750.005.2010199133141.hdf”:MODIS_SWATH_Type_L1B:EV_250_Aggr1km_RefSB’ x.tif

This one works for the MOD021KM but I couldn't work it out for the rest. I am confused.

These are the subdatasets that I want to extract as geotiffs.

  • What do you mean by: I couldn't work it out for the rest ? Do you get error messages, or is the result misplaced?
    – AndreJ
    May 2, 2014 at 17:04
  • Hi I appreciate the fast comment. I can do it with MOD02 product even if it is little bit of shifted. But MOD03, MOD35 and MOD11 I get this error: Creating output file that is 0P x 0L. ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero. May 2, 2014 at 19:40
  • What you want to do is not simple and hard to do with Python, mostly because of the bowtie effect. Either you code the correction up yourself, or you use the NASA codes.
    – Jose
    Mar 22, 2017 at 11:08

1 Answer 1


I ran into this problem as well a few years back. From researching the issue on osgeo.org (issue #805), the consensus from the gdal team was that the MODIS sinusoidal projection spheroid is defined incorrectly(But corrected for in MRT) which resulted in a shift when using gdal_warp(or any tool that is PROJ4 based). The problem is solved by explicitly setting the -s_srs in gdal_warp. i.e.

-s_srs "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs"

And for performance comparison, using gdal based tools to mosaic and reproject MODIS data resulted in a decrease in time by a factor of 22 compared to the MRT tool

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.