Skip to content

Commit

Permalink
change filt variable from global to local
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-springer committed Sep 12, 2023
1 parent 20bc73c commit 73f2e3e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rdtools/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def irradiance_rescale(irrad, irrad_sim, max_iterations=100,
'''

if method == 'iterative':
def _rmse(fact):
def _rmse(fact, filt):
"""
Calculates RMSE with a given rescale fact(or) according to global
filt(er)
Expand All @@ -392,10 +392,9 @@ def _rmse(fact):

def _single_rescale(irrad, irrad_sim, guess):
"Optimizes rescale factor once"
global filt
csi = irrad / (guess * irrad_sim) # clear sky index
filt = (csi >= 0.8) & (csi <= 1.2) & (irrad > 200)
min_result = minimize(_rmse, guess, method='Nelder-Mead')
min_result = minimize(_rmse, guess, (filt), method='Nelder-Mead')

factor = min_result['x'][0]
return factor
Expand Down

1 comment on commit 73f2e3e

@martin-springer
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdeceglie - Please take a look at this suggestion. I'm not entirely sure why filt was defined as global. If there's a reason for that, we'll have to find a different solution. The current fix works for the fleets_analysis runs. If the changes look good to you, could we merge that into the aggregated_filters_for_trial branch?

Please sign in to comment.