def add_metadata(self, vrt_filename):
        band_stack_dataset = gdal.Open(vrt_filename)
        assert band_stack_dataset, 'Unable to open VRT %s' % vrt_filename
        band_stack_dataset.SetMetadata(
            {'satellite': self.dataset_mdd['satellite_tag'].upper(),
             'sensor':  self.dataset_mdd['sensor_name'].upper(),
             'start_datetime': self.dataset_mdd['start_datetime'].isoformat(),
             'end_datetime': self.dataset_mdd['end_datetime'].isoformat(),
             'path': '%03d' % self.dataset_mdd['x_ref'],
             'row': '%03d' % self.dataset_mdd['y_ref']}
            )
        for band_info in self.band_dict.values():
            #Assume ordering file_number keys also orders the tile_layer
            band_number = band_info['tile_layer']
            band = band_stack_dataset.GetRasterBand(band_number)
            band.SetMetadata \
                ({'name': band_info['band_name'],
                  'filename': self.source_file_list[band_number - 1]})
            if self.nodata_list[band_number - 1] is not None:
                band.SetNoDataValue(self.nodata_list[band_number - 1])
            band_stack_dataset.FlushCache()
Add metadata to the VRT.
dataset/ETHPy150Open GeoscienceAustralia/agdc/src/landsat_ingester/landsat_bandstack.py/LandsatBandstack.add_metadata