diff --git a/src/opera/pge/disp_s1/disp_s1_pge.py b/src/opera/pge/disp_s1/disp_s1_pge.py index be59f2d8..6d75dffe 100644 --- a/src/opera/pge/disp_s1/disp_s1_pge.py +++ b/src/opera/pge/disp_s1/disp_s1_pge.py @@ -351,6 +351,30 @@ def _netcdf_filename(self, inter_filename): return netcdf_filename + def _compressed_cslc_filename(self, inter_filename): + """ + Returns the file name to use for compressed CSLC files produced by the + DISP-S1 PGE. + + The current convention is to maintain the filename assigned by the DISP-S1 + SAS, but this function is still required to ensure the compressed CSLC products + are moved to the output directory defined by the RunConfig. + + Parameters + ---------- + inter_filename : str + The intermediate filename of the compressed CSLC product to generate + a filename for. This parameter may be used to inspect the file + in order to derive any necessary components of the returned filename. + + Returns + ------- + compressed_cslc_filename : str + The file name to assign to compressed CSLC product(s) created by this PGE. + + """ + return os.path.basename(inter_filename) + def _ancillary_filename(self): """ Helper method to derive the core component of the file names for the @@ -747,6 +771,7 @@ def __init__(self, pge_name, runconfig_path, **kwargs): { # Note: ordering matters here! '*.nc': self._netcdf_filename, - '*.png': self._browse_filename + '*.png': self._browse_filename, + 'compressed*.h5': self._compressed_cslc_filename } ) diff --git a/src/opera/test/data/test_disp_s1_config.yaml b/src/opera/test/data/test_disp_s1_config.yaml index 31ad5990..f03895ec 100644 --- a/src/opera/test/data/test_disp_s1_config.yaml +++ b/src/opera/test/data/test_disp_s1_config.yaml @@ -40,8 +40,8 @@ RunConfig: - '-p disp_s1_pge_test/output_dir/compressed_slcs;' - 'python3 -c "from opera.util.h5_utils import create_test_disp_metadata_product; create_test_disp_metadata_product(\"disp_s1_pge_test/output_dir/20180101_20180330.unw.nc\")";' - 'dd if=/dev/urandom of=disp_s1_pge_test/output_dir/20180101_20180330.unw.png bs=1M count=1;' - - 'dd if=/dev/urandom of=disp_s1_pge_test/output_dir/compressed_slcs/compressed_slc_t087_185683_iw2_20180222_20180330.h5 bs=1M count=1;' - - 'dd if=/dev/urandom of=disp_s1_pge_test/output_dir/compressed_slcs/compressed_slc_t087_185684_iw2_20180222_20180330.h5 bs=1M count=1;' + - 'dd if=/dev/urandom of=disp_s1_pge_test/output_dir/compressed_slcs/compressed_t087_185683_iw2_20180222_20180330.h5 bs=1M count=1;' + - 'dd if=/dev/urandom of=disp_s1_pge_test/output_dir/compressed_slcs/compressed_t087_185684_iw2_20180222_20180330.h5 bs=1M count=1;' - '/bin/echo DISP-S1 invoked with RunConfig' ErrorCodeBase: 500000 SchemaPath: pge/disp_s1/schema/disp_s1_sas_schema.yaml diff --git a/src/opera/test/pge/disp_s1/test_disp_s1_pge.py b/src/opera/test/pge/disp_s1/test_disp_s1_pge.py index fc02df71..7b6aedb3 100644 --- a/src/opera/test/pge/disp_s1/test_disp_s1_pge.py +++ b/src/opera/test/pge/disp_s1/test_disp_s1_pge.py @@ -213,7 +213,7 @@ def test_disp_s1_pge_execution(self): expected_log_file = pge.logger.get_file_name() self.assertTrue(os.path.exists(expected_log_file)) - # Lastly, check that the dummy output product was created and renamed + # Lastly, check that the dummy output products were created and renamed expected_disp_product = join( pge.runconfig.output_product_path, pge._netcdf_filename( @@ -222,6 +222,12 @@ def test_disp_s1_pge_execution(self): ) self.assertTrue(os.path.exists(expected_disp_product)) + expected_compressed_cslc_product = join( + pge.runconfig.output_product_path, + pge._compressed_cslc_filename('compressed_t087_185683_iw2_20180222_20180330.h5') + ) + self.assertTrue(os.path.exists(expected_compressed_cslc_product)) + # Open and read the log with open(expected_log_file, 'r', encoding='utf-8') as infile: log_contents = infile.read()