def test_options_conversion_st_algorithm(self):
        opts = {
            'note': '',
            'etm7_collection': {
                'inputs': ['LE07_L1TP_029030_20171222_20180117_01_T2'],
                'products': ['st']
            },
            'resampling_method': 'nn',
            'format': 'gtiff'
        }
        opts_split_window = deepcopy(opts)
        opts_split_window['etm7_collection']['products'] = [
            'st', 'stalg_split_window'
        ]
        opts_single_chan = deepcopy(opts)
        opts_single_chan['etm7_collection']['products'] = [
            'st', 'stalg_single_channel'
        ]

        self.assertDictEqual(
            OptionsConversion._flatten(opts_split_window,
                                       OptionsConversion.keywords_map), {
                                           'include_st': True,
                                           'output_format': 'gtiff',
                                           'st_algorithm': 'split_window'
                                       })

        self.assertDictEqual(
            OptionsConversion._flatten(opts_single_chan,
                                       OptionsConversion.keywords_map), {
                                           'include_st': True,
                                           'output_format': 'gtiff',
                                           'st_algorithm': 'single_channel'
                                       })
    def test_options_reanalysis_source(self):
        opts = {
            'note': '',
            'etm7_collection': {
                'inputs': ['LE07_L1TP_029030_20171222_20180117_01_T2'],
                'products': ['st']
            },
            'resampling_method': 'nn',
            'format': 'gtiff'
        }

        opts_narr = deepcopy(opts)
        opts_narr['etm7_collection']['products'] = ['st', 'reanalsrc_narr']
        self.assertDictEqual(
            OptionsConversion._flatten(opts_narr,
                                       OptionsConversion.keywords_map), {
                                           'include_st': True,
                                           'output_format': 'gtiff',
                                           'reanalysis_source': 'narr'
                                       })

        opts_merra2 = deepcopy(opts)
        opts_merra2['etm7_collection']['products'] = ['st', 'reanalsrc_merra2']
        self.assertDictEqual(
            OptionsConversion._flatten(opts_merra2,
                                       OptionsConversion.keywords_map), {
                                           'include_st': True,
                                           'output_format': 'gtiff',
                                           'reanalysis_source': 'merra2'
                                       })

        opts_fp = deepcopy(opts)
        opts_fp['etm7_collection']['products'] = ['st', 'reanalsrc_fp']
        self.assertDictEqual(
            OptionsConversion._flatten(opts_fp,
                                       OptionsConversion.keywords_map), {
                                           'include_st': True,
                                           'output_format': 'gtiff',
                                           'reanalysis_source': 'fp'
                                       })

        opts_fpit = deepcopy(opts)
        opts_fpit['etm7_collection']['products'] = ['st', 'reanalsrc_fpit']
        self.assertDictEqual(
            OptionsConversion._flatten(opts_fpit,
                                       OptionsConversion.keywords_map), {
                                           'include_st': True,
                                           'output_format': 'gtiff',
                                           'reanalysis_source': 'fpit'
                                       })
    def test_options_conversion_orca_algorithm(self):
        opts = {
            'note': '',
            'olitirs8_collection': {
                'inputs': ['LC08_L1TP_025027_20160521_20170223_01_T1'],
                'products': ['orca']
            },
            'resampling_method': 'nn',
            'format': 'gtiff'
        }

        self.assertDictEqual(
            OptionsConversion._flatten(opts, OptionsConversion.keywords_map), {
                'include_orca': True,
                'output_format': 'gtiff'
            })