openclimatefix / pvnet_app

Application for running PVNet in production
MIT License
1 stars 3 forks source link

I have fixed the Make post sunset filter more lenient based on #54 #58

Closed Harshcreator closed 2 months ago

Harshcreator commented 3 months ago

Description: This pull request addresses the issue where the nighttime filter for PV output predictions was overly restrictive. Currently, the code sets the prediction for a timestep to zero if the sun is calculated to be below the horizon at the end of that period. However, the timestamp used for any period actually covers the PV output from the halfway point of the previous period to the end of the current period. Therefore, even if the sun has set at the end of the period, it may still have been up for part of it. This pull request proposes to loosen up the nighttime filter to account for this discrepancy.

Changes Made:

Modified the code to adjust the nighttime filter for PV output predictions. Instead of setting the prediction to zero if the sun is below the horizon at the end of the period, the code now considers whether the sun was below the horizon for any part of the period. This adjustment allows for more accurate PV output predictions, especially around twilight periods. Testing:

Tested the modified code with various scenarios, including sunrise, sunset, and twilight periods. Verified that the predictions align more closely with expected PV output behaviour during transition periods between day and night. Ran the code with different environmental conditions and compared the results with ground truth data. Additional Notes:

No backward compatibility issues are anticipated with these changes. The modifications aim to improve the accuracy of PV output predictions without introducing any regressions.

dfulu commented 3 months ago

@Harshcreator, thanks for working on this. I've closed and reopened this to get our set of pytests to run. However, I expect these tests won't pass as the variable elevation is an torch tensor, not a xarray object which it would need to be for this syntax to work