Skip to content

Commit

Permalink
check existence of index file
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhanson committed Feb 6, 2017
1 parent 811ee7f commit f450376
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modispds/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ def ingest(start_date, end_date, product=_PRODUCT, outdir=''):
d2 = parse(end_date)
dates = [d1 + datetime.timedelta(n) for n in range((d2 - d1).days)]
for day in dates:
index_fname = os.path.join(product, str(day.date()) + '_scenes.txt')
if exists(os.path.join('s3://%s' bucket, index_fname)):
logger.info("Scenes for %s already processed" % day)
continue
logger.info('Processing date %s' % day.date())
granules = query(day, day, product=product)

metadata = []
for gran in granules:
metadata.append(ingest_granule(gran, outdir=outdir))
# upload index file
fname = make_scene_list(metadata, fout=str(day.date()) + '_scenes.txt')
fname = make_scene_list(metadata, fout=index_fname)
push_to_s3(fname, bucket, prefix=product)
logger.info('End processing date %s' % day.date())

Expand Down

0 comments on commit f450376

Please sign in to comment.