-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_awera_production_8.py
122 lines (103 loc) · 4.14 KB
/
run_awera_production_8.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import os
from AWERA import config, ChainAWERA
import time
from AWERA.utils.convenience_utils import write_timing_info
since = time.time()
if __name__ == '__main__':
# read config from jobnumber
# 8 small jobs
# 4 big jobs
settings_id = int(os.environ['SETTINGS_ID'])
n_clusters_settings = [8, 24] # 16, 80]
n_clusters = n_clusters_settings[settings_id]
# n_locs = 1 # [200, 500, 1000, 5000]
n_l = 1 # n_locs[settings_id]
scan_tag = 'final' # full_ half_ 35_vw_ more_, short full_powering_stages
settings = {
'Data': {'n_locs': 1,
'location_type': 'Marseille'},
'Clustering': {
'n_clusters': n_clusters,
'training': {
'n_locs': n_l,
'location_type': 'Marseille'
}
},
'Processing': {'n_cores': n_clusters},
'General': {'ref_height': 100},
# 'Power':{ 'bounds': bounds},
'IO': {
'result_dir': "/cephfs/user/s6lathim/AWERA_results/",
'format': {
'plot_output':
scan_tag + config.IO.format.plot_output,
'power_curve':
scan_tag + config.IO.format.power_curve,
'cut_wind_speeds':
scan_tag + config.IO.format.cut_wind_speeds,
'refined_cut_wind_speeds':
scan_tag + config.IO.format.refined_cut_wind_speeds,
# Only Power Production - no chain plot output for now
'plot_output_data':
scan_tag + config.IO.format.plot_output_data,
'training_plot_output':
scan_tag + config.IO.format.training_plot_output,
'freq_distr':
scan_tag + config.IO.format.freq_distr,
}
}
}
# settings['General'] = {'use_memmap': True}
# settings[
print(settings)
# Update settings to config
config.update(settings)
print(config)
# Initialise AWERA chain with chosen config
awera = ChainAWERA(config)
# Code Profiling
# TODO include in config -> optional
# imports at top level / optional
# import cProfile, pstats
# profiler = cProfile.Profile()
# profiler.enable()
# Run full clustering, production, aep estimation
# depending on flags set in config
# TODO include all important flags here to update conveniently
# TODO check if clustering etc has to be done?
working_title = 'run_production' # 'run_production' #'predict_labels' # 'file'
# awera.run_clustering()
# awera.plot_cluster_shapes()
# limit_estimates = awera.estimate_wind_speed_operational_limits()
# pcs, limit_refined = awera.make_power_curves(limit_estimates=limit_estimates)
pcs = [awera.read_curve(i_profile=i+1, return_constructor=True)
for i in range(n_clusters)]
# awera.compare_kpis(pcs, compare_profiles=list(range(1, n_clusters+1)))
# print(awera.read_limits(refined=True))
# print(awera.read_profiles())
# awera.plot_power_curves(plot_full_electrical=True)
# awera.plot_power_curves(speed_at_op_height=True,
# plot_full_electrical=True)
for i, pc in enumerate(pcs):
pc.plot_output_file = config.IO.plot_output
pc.plot_optimal_trajectories(plot_info='_profile_{}'.format(i+1))
# awera.get_frequency()
awera.plot_cluster_frequency()
awera.aep()
print('Done.')
print('------------------------------ Config:')
print(awera.config)
print('------------------------------ Time:')
write_timing_info('{} AWERA run finished.'.format(working_title),
time.time() - since)
# profiler.disable()
# # # Write profiler output
# file_name = awera.config.IO.plot_output.replace('.pdf', '.profile')
# with open(file_name.format(title='run_profile'), 'w') as f:
# stats = pstats.Stats(profiler, stream=f)
# stats.strip_dirs()
# stats.sort_stats('cumtime')
# stats.print_stats('py:', .1)
# print('Profile output written to: ',
# file_name.format(title=working_title))
#plt.show()