diff --git a/jwst_mast_query/jwst_download.py b/jwst_mast_query/jwst_download.py index 01bd552..c29759b 100755 --- a/jwst_mast_query/jwst_download.py +++ b/jwst_mast_query/jwst_download.py @@ -16,6 +16,7 @@ from jwst_mast_query.jwst_query import query_mast from jwst_mast_query.pdastro import makepath4file,AnotB +from jwst_mast_query.utils.constants import PARAM_DEFAULTS #from pdastro import makepath4file,AnotB @@ -62,10 +63,12 @@ def define_options(self,**args): # outrootdir = '.' #print('Default output rootdir: %s' % outrootdir) - parser.add_argument('-n','--skipdownload', action='store_true', default=False, help='skip downloading the data. (default=%(default)s)') + parser.add_argument('-n','--skipdownload', action='store_true', default=PARAM_DEFAULTS['skipdownload'], + help='skip downloading the data. (default=%(default)s)') # parser.add_argument('-o','--outrootdir', default=outrootdir, help=('output root directory. (default=%(default)s)')) # parser.add_argument('--outsubdir', default=None, help=('subdir added to the output root directory. If None, then propID is used (default=%(default)s)')) - parser.add_argument('--clobber', action='store_true', default=None, help='existing files are overwritten, otherwise they are skipped (default=%(default)s)') + parser.add_argument('--clobber', action='store_true', default=PARAM_DEFAULTS['clobber'], + help='existing files are overwritten, otherwise they are skipped (default=%(default)s)') return(parser) diff --git a/jwst_mast_query/jwst_query.cfg b/jwst_mast_query/jwst_query.cfg index 2b44b74..8d23ff0 100644 --- a/jwst_mast_query/jwst_query.cfg +++ b/jwst_mast_query/jwst_query.cfg @@ -87,6 +87,13 @@ date_select: # If left empty, the tables will not be saved. savetables: +# If clobber is True, all files will be downloaded. If false, only files that do not already exist in the +# local directory will be downloaded. +clobber: False + +# If True, the data will not be downloaded. Only the summary tables will be produced +skipdownload: False + # columns returned from MAST to the obsTable # The default set in the code is mastcolumns_obsTable=['proposal_id','dataURL','obsid','obs_id','t_min','t_exptime'] mastcolumns_obsTable: ['proposal_id','dataURL','obsid','obs_id','t_min','t_exptime','instrument_name'] diff --git a/jwst_mast_query/jwst_query.py b/jwst_mast_query/jwst_query.py index a9202ef..da4d516 100755 --- a/jwst_mast_query/jwst_query.py +++ b/jwst_mast_query/jwst_query.py @@ -336,8 +336,6 @@ def define_options(self, parser=None, usage=None, conflict_handler='resolve'): parser.add_argument('--webpage_thumbnails_height', default=PARAM_DEFAULTS['webpage_thumbnails_height'], help=('Height in pixels of the resized jpg images ' 'to be inserted into the index.html summary ' 'file. (default=%(default)s)')) - parser.add_argument('--skipdownload', action='store_true', default=PARAM_DEFAULTS['skipdownload'], help='If set, no files will be downloaded. (default=%(default)s)') - return(parser) def get_arguments(self, args, configfile=None): @@ -431,7 +429,7 @@ def subenvvarplaceholder(paramsdict): # skip config file if arg=='configfile': continue - if argsdict[arg] is not None and argsdict[arg] != []: + if argsdict[arg] != PARAM_DEFAULTS[arg]: if args.verbose>2: print('optional args: setting %s to %s' % (arg,argsdict[arg])) self.params[arg]=argsdict[arg] diff --git a/jwst_mast_query/scripts/jwst_download.py b/jwst_mast_query/scripts/jwst_download.py index ef87668..0288c28 100644 --- a/jwst_mast_query/scripts/jwst_download.py +++ b/jwst_mast_query/scripts/jwst_download.py @@ -30,7 +30,7 @@ def main(): if download.mk_all_tables(showtables=True): sys.exit(0) - if not args.skipdownload and len(download.ix_selected_products)>0: + if not download.params['skipdownload'] and len(download.ix_selected_products)>0: download.download_products() print('\n######################\n### Downloaded Selected Products:\n######################') download.productTable.write(indices=download.ix_selected_products,columns=download.params['outcolumns_productTable']) @@ -40,7 +40,7 @@ def main(): sys.exit(0) # Make the webpages - if args.makewebpages: + if download.params['makewebpages']: download.mk_webpages4propIDs() diff --git a/jwst_mast_query/utils/constants.py b/jwst_mast_query/utils/constants.py index c994978..503e9d5 100644 --- a/jwst_mast_query/utils/constants.py +++ b/jwst_mast_query/utils/constants.py @@ -30,7 +30,7 @@ 'sortcols_summaryTable': ['date_start','proposal_id','obsnum'], 'configfile': cfgfilename, 'token': defaulttoken, - 'instrument': 'nircam', + 'instrument': None, 'obsmode': None, 'propID': None, 'obsnums': None, @@ -38,9 +38,9 @@ 'obsid_list': [], 'sca': None, 'verbose': 0, - 'filetypes': ['uncal'], + 'filetypes': ['fits'], 'guidestars': False, - 'lookbacktime': 1, + 'lookbacktime': 1., 'calib_levels': None, 'Nobs_per_batch': 2, 'obsnum2outsubdir': None, @@ -50,6 +50,7 @@ 'makewebpages': False, 'outrootdir': None, 'outsubdir': None, + 'clobber': False, 'skip_propID2outsubdir': False, 'skip_check_if_outfile_exists': False, 'skip_check_filesize': False,