def setUpClass(cls): """ Runs once before all tests are ran. Loads and reads in the fitacf file that will be used in all the unit tests. """ fitacf_file = "../testfiles/20180220.C0.rkn.fitacf" darn_read = pydarn.DarnRead(fitacf_file) cls.fitacf_data = darn_read.read_fitacf()
def map_mem_profile(): map_file = "../testfiles/20170114.map" darn = pydarn.DarnRead(map_file) map_data = darn.read_map() return map_data
def grid_mem_profile(): grid_file = "../testfiles/20180220.C0.rkn.grid" darn = pydarn.DarnRead(grid_file) grid_data = darn.read_grid() return grid_data
def fitacf_mem_profile(): fitacf_file = "../testfiles/20180220.0001.00.rkn.3.0.fitacf" darn = pydarn.DarnRead(fitacf_file) fitacf_data = darn.read_fitacf() return fitacf_data
def rawacf_mem_profile(): rawacf_file = "../testfiles/20170410.1801.00.sas.rawacf" darn = pydarn.DarnRead(rawacf_file) rawacf_data = darn.read_rawacf() return rawacf_data
def iqdat_mem_profile(): iqdat_file = "../testfiles/20160316.1945.01.rkn.iqdat" darn = pydarn.DarnRead(iqdat_file) iqdat_data = darn.read_iqdat() return iqdat_data
""" Testing script for the performance on the various SuperDARN file types for read and writing. This script requires files so may fail if the same structure is not setup. """ logging.getLogger('pydarn').setLevel(logging.INFO) fitacf_file = "../testfiles/20180220.0001.00.rkn.3.0.fitacf" rawacf_file = "../testfiles/20170410.1801.00.sas.rawacf" map_file = "../testfiles/20170114.map" iqdat_file = "../testfiles/20160316.1945.01.rkn.iqdat" grid_file = "../testfiles/20180220.C0.rkn.grid" print("*" * 60) print("Performance testing for Darn Read") print("*" * 60) dmap = pydarn.DarnRead(rawacf_file) pr = cProfile.Profile() pr.enable() d = dmap.read_rawacf() pr.disable() s = io.StringIO() sortby = 'cumtime' ps = pstats.Stats(pr, stream=s).sort_stats(sortby) ps.print_stats() print("=" * 60) print("Read Rawacf") print("File: ", rawacf_file) print("Size: {} MB".format(os.path.getsize(rawacf_file) / 1000000)) print("=" * 60) print(s.getvalue())