"Numpy-isation" of irradiance decomposition functions
See original GitHub issueProblem
I generate GHI data in maps and I want to run it through irradiance decomposition models (specifically dirindex
) in order to obtain DNI and DHI data. My data is in three dimensions (time, latitude, longitude) so passing it through pvlib’s built-in functions requiring pandas.DataFrame
isn’t easy nor very efficient.
Solution I already adapted all necessary functions to accept numpy arrays of any dimension, just with the time dimension last (see the linked PR). Results are coherent with the pvlib’s functions output and the computation is extremely fast compared to the alternative below. However, I am looking for some advices :
- Is there another solution I did not consider ?
- Is numpy the best choice, should I be using xarray so that the time dimension could be at any position?
- Is it something that could/should be implemented throughout the whole pvlib? Is it interseting
Alternatives I’ve considered
I tried looping over all the lat/lon points and calling dirindex
for each of them, with multiprocessing but it took too long/ was too computationally heavy for the volume of data I was using
Issue Analytics
- State:
- Created a year ago
- Comments:17 (15 by maintainers)
Top GitHub Comments
@mikofski Beta was also better than VHS. 😃
It is a bit clunky, but the general task of applying a function only vectorized across time to data with other dimensions (e.g. spatial) can often be achieved by reshaping the data into a very long 1-D representation, running the function, and then reshaping the result back to N-D.
Maybe https://github.com/pvlib/pvlib-python/issues/959