3

I have a Modis MOD13Q1 product for Pakistan, four tiles cover my complete area and I have data consisting of 14 years, after every 16-day interval.

I want to mosaic them using a batch file which will be most useful rather than manually processing one by one using MRT tool.

Kindly let me know some useful methods of mosaicing which automates my whole data by running just one script for the whole data or one script for one-year data.

I am new with programming so will be thankful if someone can provide some documents depicting how to run the script.

1

The follwing code solved my problem to mosaic a lot of Modis images on a folder. The code get the day of year of the file name and mosaic the images with the same day in common. Copy this code to a python script (example: mosaic.py), put on the images folder and run. It will create the mosaic as *.vrt files wich you can convert to *.tif later. Adapt the "MOD11_L2.A2014" and ""_LST.vrt" names to your project data.

 #!/usr/bin/env python
    #coding: utf-8
    from osgeo import gdal
    import glob
    for day in range(0, 32):
    day = str('%0.3d' % day)
    gdal.BuildVRT("MOD11_L2.A2014"+day+"_LST.vrt", glob.glob("MOD11_L2.A2014"+day+"*.tif"))

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.