diff --git a/src/stcal/outlier_detection/utils.py b/src/stcal/outlier_detection/utils.py index 00b577ace..d57879e2d 100644 --- a/src/stcal/outlier_detection/utils.py +++ b/src/stcal/outlier_detection/utils.py @@ -284,7 +284,20 @@ def calc_gwcs_pixmap(in_wcs, out_wcs, in_shape): log.debug("Bounding box from data shape: {}".format(bb)) grid = gwcs.wcstools.grid_from_bounding_box(bb) - return np.dstack(reproject(in_wcs, out_wcs)(grid[0], grid[1])) + + # temporarily disable the bounding box: + if hasattr(out_wcs, "bounding_box"): + orig_bbox = getattr(out_wcs, "bounding_box", None) + out_wcs.bounding_box = None + else: + orig_bbox = None + try: + pixmap = np.dstack(reproject(in_wcs, out_wcs)(grid[0], grid[1])) + finally: + if orig_bbox is not None: + out_wcs.bounding_box = orig_bbox + + return pixmap def reproject(wcs1, wcs2):