diff --git a/mwrpy/cli.py b/mwrpy/cli.py index 7bc3285..68653fb 100755 --- a/mwrpy/cli.py +++ b/mwrpy/cli.py @@ -65,6 +65,11 @@ def _parse_args(args): metavar="YYYY-MM-DD", help="Single date to be processed.", ) + group.add_argument( + "--no-plot", + action="store_true", + help="Process without plotting.", + ) return parser.parse_args(args) diff --git a/mwrpy/process_mwrpy.py b/mwrpy/process_mwrpy.py index a367c56..ebbbe26 100644 --- a/mwrpy/process_mwrpy.py +++ b/mwrpy/process_mwrpy.py @@ -61,11 +61,12 @@ def main(args): process_product(product, date, args.site) elapsed_time = time.process_time() - start logging.info(f"Processing took {elapsed_time:.1f} seconds") - logging.info(f"Plotting {product} product, {args.site} {date}") - try: - plot_product(product, date, args.site) - except TypeError as err: - logging.error(err) + if not args.no_plot: + logging.info(f"Plotting {product} product, {args.site} {date}") + try: + plot_product(product, date, args.site) + except TypeError as err: + logging.error(err) def process_product(prod: str, date: datetime.date, site: str):