예제 #1
0
def _lerp(a, b, t, out=None):
    """ Linearly interpolate from a to b by a factor of t """
    diff_b_a = subtract(b, a)
    # asanyarray is a stop-gap until gh-13105
    lerp_interpolation = asanyarray(add(a, diff_b_a * t, out=out))
    subtract(b, diff_b_a * (1 - t), out=lerp_interpolation, where=t >= 0.5)
    if lerp_interpolation.ndim == 0 and out is None:
        lerp_interpolation = lerp_interpolation[()]  # unpack 0d arrays
    return lerp_interpolation
예제 #2
0
 def CalcLSWI (self, NIR, SWIR, Blue, fill):
     Blue [Blue >= 0.27] = fill
     Swir_lower=numpy.where(Blue == fill, fill , add(NIR, SWIR))
     Swir_upper=numpy.where(Blue == fill, fill , subtract(NIR, SWIR))
     Swir_lower=numpy.where(Swir_lower ==0 , fill, Swir_lower)
     LSWI=numpy.where(Swir_lower==fill, fill ,Swir_upper/Swir_lower)
     return LSWI
예제 #3
0
 def CalcNDVI ( self , NIR , Red, fill):
     Ndvi_lower = numpy.where (NIR == fill, fill , add (NIR , Red))
     Ndvi_upper = numpy.where (NIR == fill, fill ,subtract (NIR , Red))
     #Mask = Numpy.Greater (Ndvi_lower, 0)
     Ndvi_lower = numpy.where (Ndvi_lower == 0 , fill , Ndvi_lower)
     NDVI = numpy.where (Ndvi_lower == fill , fill , Ndvi_upper/Ndvi_lower)
     return NDVI
예제 #4
0
 def CalcEVI ( self , NIR , Red , Blue, fill ):
     #for cloud-cover  blue >= 0.27
     Blue [Blue >= 0.27] = fill
     Evi_upper = numpy.where (Blue == fill , fill , 2.5 *  subtract (NIR , Red))
     Evi_lower = numpy.where (Blue == fill , fill , (NIR + (6 * Red) - (7.5 * Blue) + 1))
     Evi_lower = numpy.where (Evi_lower == 0 , fill , Evi_lower)
     EVI = numpy.where(Evi_lower == fill , fill , Evi_upper/Evi_lower)
     #EVI [EVI <= 0] = fill
     EVI [EVI >= 1] = fill
     #EVI = 2.5 * (NIR - Red) / (NIR + 6 * Red - 7.5 * Blue + 1) * mask
     return EVI
예제 #5
0
파일: index_class.py 프로젝트: Fazi99/Lab
    def CalcMLSWI ( self , NIR , SWIR, fill):
        mlswi_lower = numpy.where (NIR == fill, fill , add (NIR , SWIR))
        mlswi_upper = numpy.where (NIR == fill, fill ,subtract (NIR , SWIR))
        #Mask = Numpy.Greater (Ndvi_lower, 0)
        mlswi_lower = numpy.where (mlswi_lower == 0 , fill , mlswi_lower)
        lower = (1-mlswi_lower)
        lower = numpy.where (lower == 0 , fill , lower)
        mlswi = numpy.where (mlswi_lower == fill , fill , (1-mlswi_upper)/lower)
        #mlswi1= numpy.where (((mlswi>= 0.75) & (mlswi <= 1.0)), 1, 0)
        #MLSWI = numpy.where (NIR == fill , fill , mlswi1 )

        return mlswi
예제 #6
0
def _ptp(a, axis=None, out=None, keepdims=False):
    return um.subtract(
        umr_maximum(a, axis, None, out, keepdims),
        umr_minimum(a, axis, None, None, keepdims),
        out,
    )
예제 #7
0
 def myfunc(x):
     return clf.predict([Data[0][x], Data[1][x], subtract(Data[0][x], Data[1][x])])
예제 #8
0
 def myfunc(x):
     '''
     並列に計算したい関数
     '''
     return clf.predict([Data[0][x], Data[1][x], subtract(Data[0][x], Data[1][x])])
예제 #9
0
def _ptp(a, axis=None, out=None, keepdims=False):
    return um.subtract(
        umr_maximum(a, axis, None, out, keepdims),
        umr_minimum(a, axis, None, None, keepdims),
        out
    )
예제 #10
0
    def CalcDVEL(self, EVI, LSWI, fill):

        DVEL=numpy.where(LSWI == fill, fill , subtract(EVI,LSWI))
        return DVEL
예제 #11
0
파일: image.py 프로젝트: Fazi99/Lab
 def CalcNDVI(self, NIR, Red):
     ndvi_lower = add(NIR, Red)
     ndvi_upper = subtract(NIR, Red)
     NDVI = numpy.where(ndvi_lower == 0, 0.0, ndvi_upper/ndvi_lower)
     return NDVI