Closed vorugantia closed 7 years ago
I would suggest to also change the "source_all" and "cat_all" functions to this click method of ctx.invoke
on the other steps.
Also, I would suggest to just take a list of source IDs to process. The min/ max range thing is unnecessarily complex, when the main use case is for debugging, you just want to select one or two sources and run those repeatedly until the code works.
I would do this:
@click.option('--sources', default='all', help='Either "all" or comma-separated string of source IDs')
and then to process something like:
cat = # load catalog
# compute sources to process
if sources == 'all':
sources = list(range(len(cat)))
else:
sources = [int(_) for _ in sources.split(',')]
# process the requested sources
for idx in sources:
source = cat[idx]
# process this source
If you use this pattern multiple times, the four lines that compute the sources to process can go in a helper function that you call multiple times.
@cdeil - See here for what I've done in
make.py
and let me know if you have any suggestions:source_tev()
to only write sources in a given start/end range.