import sys
from lib.core import query_cmr, download, convert_to_geotiff, push_to_s3, get_s3_folder


def main:
    date = sys.argv[1]
    tiles = query_cmr(date, date)
    for tile in tiles:
        file = download(tile['url'])
        files = convert_to_geotiff(file)
        folder = get_s3_folder(file)
        for f in files:
            push_to_s3(f, 'modis-pds', folder)

if __name__ == '__main__':
    main()

@@ -95,43 +95,38 @@
 lder
-%0A%0A%0Adef main:%0A    date = sys.argv%5B1%5D
+, make_index%0A%0A%0Adef main(date):
 %0A   
@@ -193,16 +193,81 @@
   file =
+ 'MCD43A4.A2011358.h03v11.006.2016139165208.hdf'%0A        # file =
  downloa
@@ -354,24 +354,310 @@
 folder(file)
+%0A%0A        # create the index.html and add to the files array for uploading%0A        index_fname = 'index.html'%0A        with open(index_fname, 'w') as outfile:%0A            html = make_index(tile%5B'thumb'%5D, file, files)%0A            outfile.write(index)%0A            files.append(index_fname)
 %0A        for
@@ -753,10 +753,26 @@
    main(
+date=sys.argv%5B1%5D
 )%0A

Write out index file in main function