question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Numpy-isation" of irradiance decomposition functions

See original GitHub issue

Problem 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:open
  • Created a year ago
  • Comments:17 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
adriessecommented, May 25, 2022

@mikofski Beta was also better than VHS. 😃

2reactions
kanderso-nrelcommented, May 11, 2022

Is there another solution I did not consider ?

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.

There was an issue with some discussion of this a year or two ago, but I don’t recall where.

Maybe https://github.com/pvlib/pvlib-python/issues/959

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solar Decomposition Models
Knowing the direct or beam normal irradiance (DNI) is useful for many solar and energy applications, e.g., calculating the yield of solar concetrating...
Read more >
Irradiance & Radiation – PlantPredict
This function computes the extraterrestrial irradiance outside of the earth's ... PlantPredict implements three diffuse-direct decomposition models to ...
Read more >
Decomposing Functions - Composition of Functions - YouTube
This precalculus video tutorial explains how to decompose a composite function into two functions f(x) and g(x). This video contains plenty ...
Read more >
Evaluation of Global Horizontal Irradiance to Plane of Array ...
nations of models that estimate plane-of-array (POA) irradiance ... consider decomposition model errors as a function of clearness.
Read more >
Solar radiation influence on the decomposition process of ...
Diclofenac can be detected in surface water of many rivers with human impacts worldwide. The observed decrease of the diclofenac concentration in waters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found