diff --git a/romancal/regtest/test_skycell_generation.py b/romancal/regtest/test_skycell_generation.py index ec1b010d5..53fd177c0 100644 --- a/romancal/regtest/test_skycell_generation.py +++ b/romancal/regtest/test_skycell_generation.py @@ -4,8 +4,10 @@ import os import pytest +import roman_datamodels.datamodels as rdm from romancal.associations import skycell_asn +from romancal.pipeline.mosaic_pipeline import MosaicPipeline # mark all tests in this module pytestmark = [pytest.mark.bigdata] @@ -38,6 +40,24 @@ def run_skycell_asn(rtdata_module): return rtdata +@pytest.fixture(scope="module") +def mosaic_pipeline_on_skycell_asn(run_skycell_asn): + rtdata = run_skycell_asn + rtdata.input = EXPECTED_FILENAMES[0] + rtdata.output = f"{rtdata.input.rsplit('_', maxsplit=1)[0]}_coadd.asdf" + + # just run the first association (not all) + args = [ + "roman_mos", + rtdata, + ] + + # we don't setup or fetch a truth file here as the aim of this + # test is to check the output is resampled onto a skycell + MosaicPipeline.from_cmdline(args) + return rtdata + + @pytest.mark.parametrize("expected_filename", EXPECTED_FILENAMES) def test_file_exists(run_skycell_asn, expected_filename): """Test that the expected json files were generated""" @@ -49,3 +69,11 @@ def test_files_contain_wcsinfo(run_skycell_asn, expected_filename): with open(expected_filename) as f: asn = json.load(f) assert "skycell_wcs_info" in asn + + +def test_mosaic_output_is_skycell(mosaic_pipeline_on_skycell_asn): + """Check that the mos output for the generated association is on a skycell""" + rtdata = mosaic_pipeline_on_skycell_asn + filename = rtdata.output + with rdm.open(filename) as model: + assert model.meta.basic.location_name == "r274dp63x31y80"