Trying to get total change in value and average change in value for data set with errors, clean up meter raw data

The problem with the code currently, it doesnt properly handle all the errors it seems

what i need as output is

  • Total Change in value
  • Average change in value (based on number of vaild changes)
  • Starting value
  • Ending value (start value + total change in value)

for the most part it works except having a huge problem with one set of raw data, it appears the filtering to ignore bad changes in value is messing up with this data, not sure why.

Script – excert

  // Check if cellValue is a valid number
      if (isNaN(numericValue) || numericValue < 0) {
        numericValue = null; // Invalid data, treat as reset
      }

      if (numericValue !== null) {
        if (startValue === null) {
          startValue = numericValue; // This is the first valid reading
          firstValue = numericValue;
          lastValidValue = numericValue;
        } else {
          if (numericValue >= lastValidValue) {
            // Calculate the change (difference between current and last valid value)
            var change = numericValue - lastValidValue;
            totalUsage += change; // Increment total usage based on valid change
            lastValidValue = numericValue;
            if (change > 0) {
              countValidChanges++; // Increment the count only for valid changes > 0
            }
          } else {
            // If the value resets (lower than previous), ignore it and continue
            lastValidValue = numericValue; // Treat this as a reset point, but continue counting up from    here
          }
        }
      }
    }

    // === NEW LOGIC STARTS HERE ===

    // Calculate the initial average usage (without threshold) only if there are valid changes
    var initialAverageUsage = (countValidChanges > 0) ? (totalUsage / countValidChanges) : 0;

    // Reset totalUsage and countValidChanges to recalculate with threshold
    var threshold = initialAverageUsage + 2000;
    totalUsage = 0;
    countValidChanges = 0;
    lastValidValue = firstValue; // Reset to the first valid reading

    // Re-run the loop to apply the threshold
    for (var row = dataStartRow; row < data.length; row++) {
      var rowData = data[row];
      var cellValue = rowData[colIndex];
      var numericValue = parseFloat(cellValue);

      // Check if cellValue is a valid number
      if (isNaN(numericValue) || numericValue < 0) {
        numericValue = null; // Invalid data, treat as reset
      }

      if (numericValue !== null && numericValue >= lastValidValue) {
        // Calculate the change only if it doesn't exceed the threshold
        var change = numericValue - lastValidValue;
        if (change <= threshold) {
          totalUsage += change; // Increment total usage based on valid change
          lastValidValue = numericValue;
          if (change > 0) {
            countValidChanges++; // Increment the count only for valid changes > 0
          }
        }
      }
    }

    // Recalculate average usage with the threshold applied
    var finalAverageUsage = (countValidChanges > 0) ? (totalUsage / countValidChanges) : 0;

    // Ensure the ending value is never lower than the start value
    var endValue = (firstValue !== null) ? firstValue + totalUsage : 0; // If no valid first value, set to 0
    
    // Ensure that startValue and endValue default to 0 if no valid data was found
    reportData.push([point, totalUsage || 0, finalAverageUsage || 0, startValue || 0, endValue || 0]);
 }

here is the raw data that is causing the problem

66,360
66,360
66360
66360
66360
66360
66360
66360
66360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
66,360
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
66360
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
Data Loss
Data Loss
Data Loss
Data Loss
Data Loss
1.41E+06
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
Data Loss
Data Loss
Data Loss
1.41E+06
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
Data Loss
Data Loss
1.41E+06
1.41E+06
1.41E+06
1.41E+06
1.41E+06
1.41E+06
1.41E+06
1.41E+06
1.41E+06
1.41E+06
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
Data Loss
Data Loss
Data Loss
Data Loss
Data Loss
Data Loss
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
Data Loss
Data Loss
1.41E+06
1.41E+06
1.41E+06
1.41E+06
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
6.64E+04
Data Loss
Data Loss
1.41E+06
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
Data Loss
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0.00E+00
0
0
0
0`

Ive tried updating it and adding threshold to the data, also it should be ignoring same values and improper values, it works great on most of the data, but this one data set is causing it to give absurdly high numbers.