99caf99e982a57edda479aab39a53fc8a19cdf46,functions/HeatIndex.py,HeatIndex,updatePixels,#HeatIndex#,72

Before Change


        return kwargs

    def updatePixels(self, tlc, shape, props, **pixelBlocks):
        t = np.array(pixelBlocks["temperature_pixels"], dtype="f4", copy=False).flatten()
        r = np.array(pixelBlocks["rh_pixels"], dtype="f4", copy=False).flatten()

        // transform t to Fahrenheit space
        if self.tempUnits == "k":
            t = (1.8 * t) - 459.67
        elif self.tempUnits == "c":
            t = (1.8 * t) + 32.

        tr = t * r
        rr = r * r
        tt = t * t
        ttr = tt * r
        trr = t * rr
        ttrr = ttr * r

        // compute simple heat index
        H = .5 * (t + 61. + (((t - 68.) * 1.2) + (r * .094)))   // simple heat index
        a = ((H + t) / 2.) > 80

        // compute heat-index using Rothfusz"s full regression model
        fullHI = (-42.379 + (2.04901523 * t) + (10.14333127 * r) - (0.22475541 * tr) 
                    - (6.83783e-3 * tt) - (5.481717e-2 * rr) + (1.22874e-3 * ttr) 
                    + (8.5282e-4 * trr) - (1.99e-6 * ttrr))

        // apply adjustments
        b = a & ((r < 13) & ((t >= 80.) | (t <= 112)))
        fullHI[b] -= (((13. - r) / 4.) * np.sqrt((17. - np.abs(t-95.)) / 17.))[b]
        
        b = a & ((r > 85) & ((t >= 80.) | (t <= 87)))
        fullHI[b] += (((t - 85.) / 10.) * ((87. - t) / 5.))[b]
        
        // use full heat-index conditionally
        H[a] = fullHI[a]

        // transform HI to desired output space
        if self.hiUnits == "k":
            H = (H + 459.67) / 1.8
        elif self.hiUnits == "c":
            H = (H - 32.) / 1.8

After Change


        return kwargs

    def updatePixels(self, tlc, shape, props, **pixelBlocks):
        t = np.array(pixelBlocks["temperature_pixels"], dtype="f4", copy=False)[0].flatten()
        r = np.array(pixelBlocks["rh_pixels"], dtype="f4", copy=False)[0].flatten()

        // transform t to Fahrenheit space
        if self.tempUnits == "k":
            t = (1.8 * t) - 459.67
        elif self.tempUnits == "c":
            t = (1.8 * t) + 32.

        tr = t * r
        rr = r * r
        tt = t * t
        ttr = tt * r
        trr = t * rr
        ttrr = ttr * r

        // compute simple heat index
        H = .5 * (t + 61. + (((t - 68.) * 1.2) + (r * .094)))   // simple heat index
        a = ((H + t) / 2.) > 80

        // compute heat-index using Rothfusz"s full regression model
        fullHI = (-42.379 + (2.04901523 * t) + (10.14333127 * r) - (0.22475541 * tr) 
                    - (6.83783e-3 * tt) - (5.481717e-2 * rr) + (1.22874e-3 * ttr) 
                    + (8.5282e-4 * trr) - (1.99e-6 * ttrr))

        // apply adjustments
        b = a & ((r < 13) & (t >= 80.) & (t <= 112))
        fullHI[b] -= (((13. - r) / 4.) * np.sqrt((17. - np.abs(t-95.)) / 17.))[b]

        b = a & ((r > 85) & (t >= 80.) & (t <= 87))
        fullHI[b] += (((t - 85.) / 10.) * ((87. - t) / 5.))[b]

        // use full heat-index conditionally
        H[a] = fullHI[a]

        // transform HI to desired output space
        if self.hiUnits == "k":
            H = (H + 459.67) / 1.8
        elif self.hiUnits == "c":
            H = (H - 32.) / 1.8

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: Esri/raster-functions
Commit Name: 99caf99e982a57edda479aab39a53fc8a19cdf46
Time: 2016-05-10
Author: akferoz@esri.com
File Name: functions/HeatIndex.py
Class Name: HeatIndex
Method Name: updatePixels


Project Name: alexandrebarachant/muse-lsl
Commit Name: dc9475d91c960eca1a033752ba95a9bc9e8d1d3b
Time: 2017-06-19
Author: alexandre.barachant@gmail.com
File Name: lsl-record.py
Class Name:
Method Name: