[feature] Optimize get_daily_irradiation_map()
Summary
The method takes a lot of time and we should try to optimize it.
Current behavior
Among other things, the conversion from dictionary to numpy arrays at the end of the method takes a convoluted approach : pd.DataFrame.from_dict(irradianceMap_diffus).to_numpy()
.
Desired behavior
This specific point could be handled more efficiently by directly converting from dict values to numpy array, instead of taking a detour through a pandas dataframe.
See "Sources" section below for a detailed example.
Sources
Convert dictionary values to numpy array :
You can use
fromiter
to get the keys and values into an np array:import numpy as np Samples = {5.207403005022627: 0.69973543384229719, 6.8970222167794759: 0.080782939731898179, 7.8338517407140973: 0.10308033284258854, 8.5301143255505334: 0.018640838362318335, 10.418899728838058: 0.14427355015329846, 5.3983946820220501: 0.51319796560976771} keys = np.fromiter(Samples.keys(), dtype=float) vals = np.fromiter(Samples.values(), dtype=float) print(keys) print('-'*20) print(vals)