Skip to content

Instantly share code, notes, and snippets.

@ethanabrooks
Created June 21, 2024 14:06
Show Gist options
  • Save ethanabrooks/e6ab0b8cd4b05c00c59c785a91ce5f56 to your computer and use it in GitHub Desktop.
Save ethanabrooks/e6ab0b8cd4b05c00c59c785a91ce5f56 to your computer and use it in GitHub Desktop.

1

First, let's list the files in the current directory to understand the structure of the repository. This will help us locate the pvlib.irradiance.reindl function and any relevant test files.

ls -F

2

The pvlib directory likely contains the implementation of the reindl function. Let's navigate into the pvlib directory and list its contents to locate the irradiance module.

cd pvlib && ls -F

3

The irradiance.py file likely contains the reindl function. Let's open this file and navigate to the reindl function to examine its implementation.

open irradiance.py

4

Since the file is quite large, let's search for the reindl function within this file to locate its exact position.

search_file "def reindl" irradiance.py

5

The reindl function is defined at line 793. Let's navigate to that line to examine the function's implementation.

goto 793

6

We can see the implementation of the reindl function. The issue seems to be with the term term3 in the equation, which involves a quotient that divides by GHI. To fix this, we need to ensure that GHI is not zero before performing the division.

Let's scroll down to see the full implementation of the reindl function.

scroll_down

7

We can see the full implementation of the reindl function. To fix the issue, we need to ensure that GHI is not zero before performing the division in the term3 calculation.

Let's edit the reindl function to add a check for GHI being zero before performing the division.

edit 889:889
    term3 = 1 + np.sqrt(HB / np.maximum(ghi, 1e-6)) * (tools.sind(0.5 * surface_tilt) ** 3)
end_of_edit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment