forked from MeteoSwiss-APN/ecrad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timing.py
60 lines (49 loc) · 1.72 KB
/
timing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import click
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
@click.command()
@click.argument("ref_file")
@click.argument("cur_file")
def cli(ref_file, cur_file):
ref = pd.read_csv(
ref_file,
delim_whitespace=True,
names=["routine", "time", "ncalls"],
index_col=0,
)
cur = pd.read_csv(
cur_file,
delim_whitespace=True,
names=["routine", "time", "ncalls"],
index_col=0,
)
cur = cur.sort_values(by=["time"], ascending=False)
ref = ref.sort_values(by=["time"], ascending=False)
cur = cur.rename(index=lambda s: s.replace("_lr", ""))
cur = cur.rename(index=lambda s: s.replace("_acc", ""))
selection = set(
[
"radiation_two_stream:calc_two_stream_gammas_lw",
"radiation_two_stream:calc_reflectance_transmittance_lw",
"radiation_adding_ica_lw:adding_ica_lw",
"radiation_two_stream:calc_no_scattering_transmittance_lw",
"radiation_adding_ica_lw:calc_fluxes_no_scattering_lw",
"radiation_cloud_generator:cloud_generator",
"radiation_adding_ica_lw:fast_adding_ica_lw",
"radiation_lw_derivatives:modify_lw_derivatives_ica",
"radiation_lw_derivatives:calc_lw_derivatives_ica",
"radiation_mcica_lw:solver_mcica_lw",
]
)
selection = selection.intersection(set(cur.index)).intersection(set(ref.index))
a = cur.loc[selection, "time"]
b = ref.loc[selection, "time"]
print("\ncurrent time")
print("-------------------------------------")
print(a)
print("\nreference time")
print("-------------------------------------")
print(b)
if __name__ == "__main__":
cli()