Skip to content

Commit

Permalink
change filt variable from global to local (#399)
Browse files Browse the repository at this point in the history
* change filt variable from global to local

* fix single_opt method

* update changelog

---------

Co-authored-by: Michael Deceglie <[email protected]>
  • Loading branch information
martin-springer and mdeceglie authored Nov 17, 2023
1 parent e7c402f commit 17970d3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/sphinx/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RdTools Change Log
==================
.. include:: changelog/v2.1.8.rst
.. include:: changelog/v2.1.7.rst
.. include:: changelog/v2.1.6.rst
.. include:: changelog/v2.1.5.rst
Expand Down
11 changes: 11 additions & 0 deletions docs/sphinx/source/changelog/v2.1.8.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**************************
v2.1.8 (November 17, 2023)
**************************

Bug fixes
---------
* Fix a bug in parallel computing environments (:issue:`388` :pull:`399`)

Contributors
------------
* Martin Springer (:ghuser:`martin-springer`)
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

0 comments on commit 17970d3

Please sign in to comment.