I am using gdalwarp in python to extract and re-project reflectance bands from MODIS level 1B (MOD021km). An example of the command that I am using is the following:

gdalwarp -of GTIFF -tps -t_srs EPSG:4326 -tr 0.01 0.01 -r bilinear -overwrite HDF4_EOS:EOS_SWATH:"C:\tmp\MYD021KM.A2007094.0935.006.2012075055042.hdf":MODIS_SWATH_Type_L1B:EV_500_Aggr1km_RefSB C:\tmp\Output.tif

It converts the hdf subdataset without any problem but the output file seems to have some sort of artifact, specially close to the edges. (See below) MODIS Reflectance at band 3, gdal

I converted the same data using Modis Conversion Toolkit (MCTK) and it seems to be much better. (Below) MODIS Reflectance at band 3, MCTK

I tried different resampling method and different output projection but still the same results! Is there anyone having this issue with gdalwarp?

P.S. The data can be downloaded from this address: ftp://ladsweb.nascom.nasa.gov/allData/6/MYD021KM/2007/094/MYD021KM.A2007094.0935.006.2012075055042.hdf

  • 1
    I would test if result without -tr would look better. Also -et 0 might be worth a try. Or even -wo SAMPLE_STEPS=100 (warp options gdal.org/…) Try one change at a time. If those do not help the sample image to play with would be nice. – user30184 Jul 18 '15 at 20:59
  • Thanks @user30184 for your comment. I had tried it without '-tr' and it does not make a difference. Changing the error threshold and warp options did not help as well! The link to the data is added to the question. It would be appreciated if you or anyone could have a look at it to see if better results can be obtained. – Monobakht Jul 19 '15 at 8:41
  • Try also without -tps. Unfortunately I can't have a proper look at your data within a few days. Please edit and test your GDAL command so that it can be used simply as copy-paste in a default directory for input/output, for example in c:\temp. – user30184 Jul 19 '15 at 9:49
  • Avoiding '-tps' makes it even worse. The accuracy of registration gets worse and the artefact stays. I edited the command so it works if you copy the hdf file in 'c:\tmp'. @user30184 – Monobakht Jul 19 '15 at 10:54
  • 1
    Please look at this closely related question and answer: gis.stackexchange.com/a/39058/8104 – Aaron Jul 19 '15 at 11:33

So after discussing this problem with other developers in Gdal-Dev mailing list it turned out that MODIS swath data can not be perfectly re-projected by using gdalwarp. It is because of bow-tie effect of the MODIS scanning sensor which gdal can not deal with. The best option is to download associated geolocation datasets (MOD03) and use MRTswath for re-projection of desired sub-datasets.

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.