[gdal-dev] gdal/python/bash: Project level 2 hdf files only and automatically project the newest files added everyday(batch process)

Love ljvillarin30 at gmail.com
Thu Oct 2 19:18:29 PDT 2014


I have numerous hdf files dowloaded from ftp site and saved it to my local
directory.The hdf files has level 1 and level 2(e.g.
A2001037040000.L1A_LAC.hdffiles.hdf, A2001037040000.L2_LAC.hdffiles.hdf).
How will I project the level 2 files ONLY in batch process and
automatically create a directory for the projected files?And what should I
do so that I would be able to project/process the newest files I have
downloaded EVERYDAY, this means that the projection should update everyday
and if there are files added that should only be projected?

IMPORTANT: The hdf files for today aren't available yet so the newest files
to be projected/processed are those files uploaded yesterday because all
the files uploaded in the ftp site are delayed one day.

Thanks in advance for your help!

Code:

def projectData(self, event):

    def findSDS (path, filter):
        for root, dirs, files in os.walk(path):
            for file in fnmatch.filter(files, filter):
                yield file

    for sds in findSDS('D:/folder/hdf/files', '*.hdf'):
        inSDS = 'HDF4_SDS:' + 'D:/folder/hdf/files' + '/' + sds + ':01'
        path = 'D:/save/newprojected'
        outTIFF = path + sds + '.tif'
        cmd = 'gdalwarp -geoloc -t_srs "proj=longlat +datum=WGS84" -te
111.157 1.075 129.225 15.205 %s %s' % (inSDS, outTIFF)

        os.system(cmd)
        os.mkdir(path)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20141003/1ffa9e44/attachment.html>


More information about the gdal-dev mailing list