Skip to content

Commit

Permalink
Merge pull request #2 from manaakiwhenua/master
Browse files Browse the repository at this point in the history
Updated blendArrays function
  • Loading branch information
tretherington authored Dec 15, 2020
2 parents 33a64e3 + 90062cb commit 646d47f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Binary file modified nlmpy/__pycache__/nlmpy.cpython-37.pyc
Binary file not shown.
11 changes: 5 additions & 6 deletions nlmpy/nlmpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,12 @@ def classifyArray(array, weights, classifyMask=None):

#------------------------------------------------------------------------------

def blendArray(primaryArray, arrays, scalingFactors=None):
def blendArrays(arrays, scalingFactors=None):
"""
Blend a primary array with other arrays weighted by scaling factors.
Blend arrays weighted by scaling factors.
Parameters
----------
primaryArray : array
2D array of data values.
arrays : list
List of 2D arrays of data values.
scalingFactors : list
Expand All @@ -240,9 +238,10 @@ def blendArray(primaryArray, arrays, scalingFactors=None):
"""
if scalingFactors is None:
scalingFactors = np.ones(len(arrays))
combinedArrays = np.zeros(arrays[0].shape)
for n in range(len(arrays)):
primaryArray = primaryArray + (arrays[n] * scalingFactors[n])
blendedArray = primaryArray / len(arrays)
combinedArrays = combinedArrays + (arrays[n] * scalingFactors[n])
blendedArray = combinedArrays / len(arrays)
rescaledArray = linearRescale01(blendedArray)
return(rescaledArray)

Expand Down

0 comments on commit 646d47f

Please sign in to comment.