Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignored config parameters #51

Merged
merged 4 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions jwst_mast_query/jwst_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions jwst_mast_query/jwst_query.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
4 changes: 1 addition & 3 deletions jwst_mast_query/jwst_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions jwst_mast_query/scripts/jwst_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand All @@ -40,7 +40,7 @@ def main():
sys.exit(0)

# Make the webpages
if args.makewebpages:
if download.params['makewebpages']:
download.mk_webpages4propIDs()


Expand Down
7 changes: 4 additions & 3 deletions jwst_mast_query/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
'sortcols_summaryTable': ['date_start','proposal_id','obsnum'],
'configfile': cfgfilename,
'token': defaulttoken,
'instrument': 'nircam',
'instrument': None,
'obsmode': None,
'propID': None,
'obsnums': None,
'obsid_select': [],
'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,
Expand All @@ -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,
Expand Down