diff --git a/stixcore/processing/L1toL2.py b/stixcore/processing/L1toL2.py index e2bbd50f..5f838413 100644 --- a/stixcore/processing/L1toL2.py +++ b/stixcore/processing/L1toL2.py @@ -104,16 +104,20 @@ def process_type(files, *, processor, soopmanager, spice_kernel_path, config): for l2 in tmp.from_level1( l1, parent=complete_file_name, idlprocessor=idlprocessor, ecc_manager=ecc_manager ): - new_files = processor.write_fits(l2) - all_files.extend(new_files) + try: + new_files = processor.write_fits(l2) + all_files.extend(new_files) + # we have to check in the for loop as some products might create + # multiple files and some of them might be combinable and some not + except NotCombineException as nc: + logger.warning(nc) + # if a batch of X files have summed up run the IDL processing if idlprocessor.opentasks >= max_idlbatch: all_files.extend(idlprocessor.process()) idlprocessor = SSWIDLProcessor(processor) except (NoMatchError, KeyError): logger.warning("No L2 product match for product %s", l1) - except NotCombineException as nc: - logger.info(nc) except Exception as e: logger.error("Error processing file %s", file, exc_info=True) logger.error("%s", e) diff --git a/stixcore/products/CAL/energy.py b/stixcore/products/CAL/energy.py index e24a8b03..9b3e6053 100644 --- a/stixcore/products/CAL/energy.py +++ b/stixcore/products/CAL/energy.py @@ -13,6 +13,7 @@ from stixcore.calibration.ecc_post_fit import ecc_post_fit_on_fits from stixcore.calibration.elut_manager import ELUTManager from stixcore.config.config import CONFIG +from stixcore.products.level0.scienceL0 import NotCombineException from stixcore.products.product import EnergyChannelsMixin, GenericProduct, L2Mixin from stixcore.time import SCETimeRange from stixcore.util.logging import get_logger @@ -412,3 +413,6 @@ def from_level1(cls, l1product, parent="", idlprocessor=None, ecc_manager=None): # end of for each spectrum return products + + def __add__(self, other): + raise NotCombineException(f"Tried to combine 2 cal_energy products: \n{self} and \n{other}")