#NEWLINE# def get_overlapping_dataset_ids( self , dataset_id , delta_t = ONE_HOUR , tile_class_filter = ( 1 , 3 ) ) : #NEWLINE# #INDENT# "Return dataset ids for overlapping datasets (incuding this dataset)\n\n        Given an original dataset specified by 'dataset_id', return the list\n        of dataset_ids for datasets that overlap this one. An overlap occurs\n        when a tile belonging to a target dataset overlaps in space and\n        time with one from the orignal dataset. 'delta_t' sets the tolerance\n        for detecting time overlaps. It should be a python datetime.timedelta\n        object (obtainable by constructor or by subtracting two datetimes).\n\n        Only tiles of a class present in the tuple 'tile_class_filter' are\n        considered. Note that if the original dataset has no tiles of the\n        relevent types an empty list will be returned. Otherwise the list\n        will contain at least the original dataset id.\n        " #NEWLINE# sql = ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( 'SELECT DISTINCT od.dataset_id\n' + 'FROM dataset d\n' ) + 'INNER JOIN tile t USING (dataset_id)\n' ) + 'INNER JOIN acquisition a USING (acquisition_id)\n' ) + 'INNER JOIN tile o ON\n' ) + '    o.x_index = t.x_index AND\n' ) + '    o.y_index = t.y_index AND\n' ) + '    o.tile_type_id = t.tile_type_id\n' ) + 'INNER JOIN dataset od ON\n' ) + '    od.dataset_id = o.dataset_id AND\n' ) + '    od.level_id = d.level_id\n' ) + 'INNER JOIN acquisition oa ON\n' ) + '    oa.acquisition_id = od.acquisition_id AND\n' ) + '    oa.satellite_id = a.satellite_id\n' ) + 'WHERE\n' ) + '    d.dataset_id = %(dataset_id)s\n' ) + ( '    AND t.tile_class_id IN %(tile_class_filter)s\n' if tile_class_filter else '' ) ) + ( '    AND o.tile_class_id IN %(tile_class_filter)s\n' if tile_class_filter else '' ) ) + '    AND (\n' ) + '        (oa.start_datetime BETWEEN\n' ) + '         a.start_datetime - %(delta_t)s AND\n' ) + '         a.end_datetime + %(delta_t)s)\n' ) + '     OR\n' ) + '        (oa.end_datetime BETWEEN\n' ) + '         a.start_datetime - %(delta_t)s AND\n' ) + '         a.end_datetime + %(delta_t)s)\n' ) + '    )\n' ) + 'ORDER BY od.dataset_id;' ) #NEWLINE# params = { #NEWLINE# #INDENT# 'dataset_id' : dataset_id , #NEWLINE# 'delta_t' : delta_t , #NEWLINE# 'tile_class_filter' : tuple ( tile_class_filter ) , #NEWLINE# #UNINDENT# } #NEWLINE# result = self . execute_sql_multi ( sql , params ) #NEWLINE# dataset_id_list = [ tup [ 0 ] for tup in result ] #NEWLINE# return dataset_id_list