-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun_download_cache.py
40 lines (34 loc) · 1.38 KB
/
run_download_cache.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import logging
import photometry
#--------------------------------------------------------------------------------------------------
def main():
# Parse command line arguments:
parser = argparse.ArgumentParser(description='Download all auxiliary data for pipeline.')
parser.add_argument('-d', '--debug', help='Print debug messages.', action='store_true')
parser.add_argument('-q', '--quiet', help='Only report warnings and errors.', action='store_true')
parser.add_argument('--testing', help='Only download data needed for testing.', action='store_true')
args = parser.parse_args()
# Set logging level:
logging_level = logging.INFO
if args.quiet:
logging_level = logging.WARNING
elif args.debug:
logging_level = logging.DEBUG
# Setup logging:
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
console = photometry.utilities.TqdmLoggingHandler()
console.setFormatter(formatter)
logger = logging.getLogger(__name__)
logger.addHandler(console)
logger.setLevel(logging_level)
logger_parent = logging.getLogger('photometry')
logger_parent.addHandler(console)
logger_parent.setLevel(logging_level)
# Download all data:
photometry.download_cache(testing=args.testing)
#--------------------------------------------------------------------------------------------------
if __name__ == '__main__':
main()