def jfk_local(): '''sample test set based on query from Oracle fds_flight_record''' repo='local' query = """select distinct file_path from fds_flight_record where file_repository='local' and dest_icao in ('KJFK')""".replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def jfk_local(): '''sample test set based on query from Oracle fds_flight_record''' repo = 'local' query = """select distinct file_path from fds_flight_record where file_repository='local' and dest_icao in ('KJFK')""".replace( 'REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_sql_jfk(): '''sample test set based on query from Oracle fds_flight_record''' repo = 'central' query = """select file_path from fds_flight_record where file_repository='REPO' and orig_icao='KJFK' and dest_icao in ('KFLL','KMCO' ) """.replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_sql_jfk(): '''sample test set based on query from Oracle fds_flight_record''' repo = 'central' query = """select file_path from fds_flight_record where file_repository='REPO' and orig_icao='KJFK' and dest_icao in ('KFLL','KMCO' ) """.replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_sql_ua_all(): '''sample test set based on query from Oracle fds_flight_record''' repo = 'linux' query = """select file_path from fds_flight_record where file_repository='REPO' and rownum < 10 """.replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_sql_ua_all(): '''sample test set based on query from Oracle fds_flight_record''' repo = 'linux' query = """select file_path from fds_flight_record where file_repository='REPO' and rownum < 10 """.replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_sql_jfk(): '''sample test set based on query from Oracle fds_flight_record''' query = """select distinct file_path from fds_flight_record where file_repository='central' and orig_icao='KJFK' and dest_icao in ('KFLL','KMCO' ) --and rownum<15 """ files_to_process = fds_oracle.flight_record_filepaths(query)[:40] repo='central' return repo, files_to_process
def test_sql_jfk(): '''sample test set based on query from Oracle fds_flight_record''' query = """select distinct file_path from fds_flight_record where file_repository='central' and orig_icao='KJFK' and dest_icao in ('KFLL','KMCO' ) --and rownum<15 """ files_to_process = fds_oracle.flight_record_filepaths(query)[:40] repo = 'central' return repo, files_to_process
def fll_local(): '''sample test set based on query from Oracle fds_flight_record''' repo='local' query = """select distinct file_path from fds_flight_record where file_repository='REPO' and dest_icao in ('KFLL') """.replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) #[:40] aircraft_info={'Frame': 'A320_SFIM_ED45_CFM', 'Manufacturer': 'Airbus', 'Precise Positioning': True, 'Series': 'A320-200', 'Family': 'A320', 'Frame Doubled': False} return _flight_list(files_to_process, aircraft_info, repo)
def ra_all_sweep(): '''check all flights for 'TCAS RA' to capture additional RAs ''' repo = 'linux' query = """select distinct f.file_path from fds_flight_record f where f.file_repository='REPO' and f.base_file_path is not null and f.start_month between to_date('2012-04-01','YYYY-MM-DD') and to_date('2012-06-30','YYYY-MM-DD') """.replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def ra_all_sweep(): '''check all flights for 'TCAS RA' to capture additional RAs ''' repo = 'central' query="""select distinct f.file_path from fds_flight_record f where f.file_repository='REPO' and f.base_file_path is not null and f.start_month between to_date('2012-04-01','YYYY-MM-DD') and to_date('2012-06-30','YYYY-MM-DD') """.replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_sql_jfk(): '''sample test set based on query from Oracle fds_flight_record''' query = """select distinct file_path from fds_flight_record where file_repository='central' and orig_icao='KJFK' and dest_icao in ('KFLL','KMCO' ) --and rownum<15 """ files_to_process = fds_oracle.flight_record_filepaths(query)[:40] repo='central' aircraft_info={'Frame': 'A320_SFIM_ED45_CFM', 'Manufacturer': 'Airbus', 'Precise Positioning': True, 'Series': 'A320-200', 'Family': 'A320', 'Frame Doubled': False} return _flight_list(files_to_process, aircraft_info, repo)
def ra_quickcheck(): """an ez to find but incomplete set of RAs for use in testing""" repo = 'linux' query = """select distinct f.file_path from fds_flight_record f join fds_kpv kpv on kpv.file_repository=f.file_repository and kpv.base_file_path=f.base_file_path where f.file_repository='REPO' and f.base_file_path is not null and f.dest_icao='KSFO' and kpv.name='TCAS RA Reaction Delay' """.replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query)[:40] return repo, files_to_process
def test_multifleet(): """test set to verify treatment of multiple fleet types""" repo="linux" query="""select file_path from fds_flight_record where fleet_series='B747-200' and file_repository='linux' and rownum<=5 union all select file_path from fds_flight_record where fleet_series='CRJ 700' and file_repository='linux' and rownum<=5 union all select file_path from fds_flight_record where fleet_series='A320-200' and file_repository='linux' and rownum<=5""" files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_multifleet(): """test set to verify treatment of multiple fleet types""" repo = "linux" query = """select file_path from fds_flight_record where fleet_series='B747-200' and file_repository='linux' and rownum<=5 union all select file_path from fds_flight_record where fleet_series='CRJ 700' and file_repository='linux' and rownum<=5 union all select file_path from fds_flight_record where fleet_series='A320-200' and file_repository='linux' and rownum<=5""" files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def ra_quickcheck(): """an ez to find but incomplete set of RAs for use in testing""" repo = 'linux' query="""select distinct f.file_path from fds_flight_record f join fds_kpv kpv on kpv.file_repository=f.file_repository and kpv.base_file_path=f.base_file_path where f.file_repository='REPO' and f.base_file_path is not null and f.dest_icao='KSFO' and kpv.name='TCAS RA Reaction Delay' """.replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query)[:40] return repo, files_to_process
def pkl_check(): '''verify tcas profile using flights from updated LFL and load from pkl''' repo = 'central' query = """select distinct f.file_path from (select * from fds_flight_record where analysis_time>to_date('2013-06-08 13:00','YYYY-MM-DD HH24:MI')) f join fds_kpv kpv on kpv.file_repository=f.file_repository and kpv.base_file_path=f.base_file_path where f.base_file_path is not null and f.file_repository='REPO' and orig_icao='KJFK' and dest_icao in ('KFLL') and rownum < 10""".replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def ra_sfo_sweep(): '''Compute all metrics for these, looking only at flights with an RA. These calculations may be expensive, so we want a small set of flights to deal with. ''' repo = 'central' query = """select distinct f.file_path from fds_flight_record f where f.file_repository='REPO' and f.base_file_path is not null and f.start_month between to_date('2012-04-01','YYYY-MM-DD') and to_date('2012-06-30','YYYY-MM-DD') and F.DEST_ICAO='KSFO' """.replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def ra_sfo_sweep(): '''Compute all metrics for these, looking only at flights with an RA. These calculations may be expensive, so we want a small set of flights to deal with. ''' repo = 'central' query="""select distinct f.file_path from fds_flight_record f where f.file_repository='REPO' and f.base_file_path is not null and f.start_month between to_date('2012-04-01','YYYY-MM-DD') and to_date('2012-06-30','YYYY-MM-DD') and F.DEST_ICAO='KSFO' """.replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def pkl_check(): '''verify tcas profile using flights from updated LFL and load from pkl''' repo = 'central' query="""select distinct f.file_path from (select * from fds_flight_record where analysis_time>to_date('2013-06-08 13:00','YYYY-MM-DD HH24:MI')) f join fds_kpv kpv on kpv.file_repository=f.file_repository and kpv.base_file_path=f.base_file_path where f.base_file_path is not null and f.file_repository='REPO' and orig_icao='KJFK' and dest_icao in ('KFLL') and rownum < 10""".replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_kpv_range(): '''run against flights with select kpv values.''' repo = 'linux' query="""select distinct f.file_path --, kpv.name, kpv.value from fds_flight_record f join fds_kpv kpv on kpv.file_repository=f.file_repository and kpv.base_file_path=f.base_file_path where f.file_repository='REPO' and f.base_file_path is not null and f.orig_icao='KIAD' and f.dest_icao='KFLL' and ( kpv.name='Airspeed 500 To 20 Ft Max' --and kpv.value between 100.0 and 200.0) -- or (kpv.name='Simple Kpv' and kpv.value>100) ) order by file_path """.replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def fll_local(): '''sample test set based on query from Oracle fds_flight_record''' repo = 'local' query = """select distinct file_path from fds_flight_record where file_repository='REPO' and dest_icao in ('KFLL') """.replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) #[:40] aircraft_info = { 'Frame': 'A320_SFIM_ED45_CFM', 'Manufacturer': 'Airbus', 'Precise Positioning': True, 'Series': 'A320-200', 'Family': 'A320', 'Frame Doubled': False } return _flight_list(files_to_process, aircraft_info, repo)
def test_kpv_range(): '''run against flights with select kpv values.''' repo = 'linux' query = """select distinct f.file_path --, kpv.name, kpv.value from fds_flight_record f join fds_kpv kpv on kpv.file_repository=f.file_repository and kpv.base_file_path=f.base_file_path where f.file_repository='REPO' and f.base_file_path is not null and f.orig_icao='KIAD' and f.dest_icao='KFLL' and ( kpv.name='Airspeed 500 To 20 Ft Max' --and kpv.value between 100.0 and 200.0) -- or (kpv.name='Simple Kpv' and kpv.value>100) ) order by file_path """.replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def ra_redo(): '''update tcas_keith profile using new RA detection -- shortcut by using output from all_sweep''' repo = 'central' query="""select distinct f.file_path from fds_flight_record f join fds_phase ph on ph.base_file_path=f.base_file_path where f.file_repository='central' and ph.profile='all_sweep-MM191123-PC' and ph.name in ( 'TCAS RA Sections' ) and f.start_month >= to_date('2012-04-01','YYYY-MM-DD') and f.start_month <= to_date('2012-06-30','YYYY-MM-DD') and ph.time_index<touchdown_min and ph.time_index>liftoff_min and ph.duration>2.5 and ph.duration<300 group by f.file_path """ files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def ra_redo(): '''update tcas_keith profile using new RA detection -- shortcut by using output from all_sweep''' repo = 'central' query = """select distinct f.file_path from fds_flight_record f join fds_phase ph on ph.base_file_path=f.base_file_path where f.file_repository='central' and ph.profile='all_sweep-MM191123-PC' and ph.name in ( 'TCAS RA Sections' ) and f.start_month >= to_date('2012-04-01','YYYY-MM-DD') and f.start_month <= to_date('2012-06-30','YYYY-MM-DD') and ph.time_index<touchdown_min and ph.time_index>liftoff_min and ph.duration>2.5 and ph.duration<300 group by f.file_path """ files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_sql_jfk(): '''sample test set based on query from Oracle fds_flight_record''' query = """select distinct file_path from fds_flight_record where file_repository='central' and orig_icao='KJFK' and dest_icao in ('KFLL','KMCO' ) --and rownum<15 """ files_to_process = fds_oracle.flight_record_filepaths(query)[:40] repo = 'central' aircraft_info = { 'Frame': 'A320_SFIM_ED45_CFM', 'Manufacturer': 'Airbus', 'Precise Positioning': True, 'Series': 'A320-200', 'Family': 'A320', 'Frame Doubled': False } return _flight_list(files_to_process, aircraft_info, repo)
def test_kpv_range(): '''run against flights with select kpv values. TODO check how do multi-state params work TODO add index to FDS_KPV, FDS_KTI TODO improve support for profile KPV KTI phases TODO think more about treatment of multiples for a given KPV or KTI ''' repo = 'central' query="""select f.file_path --, kpv.name, kpv.value from fds_flight_record f join fds_kpv kpv on kpv.file_repository=f.file_repository and kpv.base_file_path=f.base_file_path where f.file_repository='REPO' and ( (kpv.name='Airspeed 500 To 20 Ft Max' and kpv.value between 100.0 and 200.0) or (kpv.name='Simple Kpv' and kpv.value>100) ) order by file_path """.replace('REPO',repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
def test_kpv_range(): '''run against flights with select kpv values. TODO check how do multi-state params work TODO add index to FDS_KPV, FDS_KTI TODO improve support for profile KPV KTI phases TODO think more about treatment of multiples for a given KPV or KTI ''' repo = 'central' query = """select f.file_path --, kpv.name, kpv.value from fds_flight_record f join fds_kpv kpv on kpv.file_repository=f.file_repository and kpv.base_file_path=f.base_file_path where f.file_repository='REPO' and ( (kpv.name='Airspeed 500 To 20 Ft Max' and kpv.value between 100.0 and 200.0) or (kpv.name='Simple Kpv' and kpv.value>100) ) order by file_path """.replace('REPO', repo) files_to_process = fds_oracle.flight_record_filepaths(query) return repo, files_to_process
os.makedirs(output_dir) output_dir = output_dir if output_dir.endswith('/') or output_dir .endswith('\\') else output_dir +'/' reports_dir = reports_dir if reports_dir.endswith('/') or reports_dir.endswith('\\') else reports_dir +'/' print 'calling run_analyzer' analyzer_status =run_analyzer(profile_name, module_names, LOG_LEVEL, FILES_TO_PROCESS, 'NA', output_dir, reports_dir, make_kml=MAKE_KML_FILES, save_oracle=save_oracle, comment=COMMENT, file_repository=FILE_REPOSITORY, mortal=mortal) return analyzer_status if __name__=='__main__': # test grouping of flights by fleet frame_dict = frame_list.build_frame_list(logger) query="""select file_path from fds_flight_record where fleet_series='B747-200' and file_repository='linux' and rownum<=10 union all select file_path from fds_flight_record where fleet_series='CRJ 700' and file_repository='linux' and rownum<=10 union all select file_path from fds_flight_record where fleet_series='A320-200' and file_repository='linux' and rownum<=10""" files_to_process = fds_oracle.flight_record_filepaths(query) lfl_flights = group_flights_by_fleet(files_to_process, frame_dict) print lfl_flights print 'loaded'
print 'calling run_analyzer' analyzer_status = run_analyzer(profile_name, module_names, LOG_LEVEL, FILES_TO_PROCESS, 'NA', output_dir, reports_dir, make_kml=MAKE_KML_FILES, save_oracle=save_oracle, comment=COMMENT, file_repository=FILE_REPOSITORY, mortal=mortal) return analyzer_status if __name__ == '__main__': # test grouping of flights by fleet frame_dict = frame_list.build_frame_list(logger) query = """select file_path from fds_flight_record where fleet_series='B747-200' and file_repository='linux' and rownum<=10 union all select file_path from fds_flight_record where fleet_series='CRJ 700' and file_repository='linux' and rownum<=10 union all select file_path from fds_flight_record where fleet_series='A320-200' and file_repository='linux' and rownum<=10""" files_to_process = fds_oracle.flight_record_filepaths(query) lfl_flights = group_flights_by_fleet(files_to_process, frame_dict) print lfl_flights print 'loaded'