#NEWLINE# def find_band_file( self , file_pattern ) : #NEWLINE# #INDENT# 'Find the file in dataset_dir matching file_pattern and check\n        uniqueness.\n\n        Returns the path to the file if found, raises a DatasetError\n        otherwise.' #NEWLINE# dataset_dir = os . path . join ( self . metadata_dict [ 'dataset_path' ] , 'scene01' ) #NEWLINE# if ( not os . path . isdir ( dataset_dir ) ) : #NEWLINE# #INDENT# raise DatasetError ( ( '%s is not a valid directory' % dataset_dir ) ) #NEWLINE# #UNINDENT# filelist = [ filename for filename in os . listdir ( filelist ) if re . match ( file_pattern , filename ) ] #NEWLINE# if ( not ( len ( filelist ) == 1 ) ) : #NEWLINE# #INDENT# raise DatasetError ( ( 'Unable to find unique match ' + ( 'for file pattern %s' % file_pattern ) ) ) #NEWLINE# #UNINDENT# return os . path . join ( dataset_dir , filelist [ 0 ] )