From 385d60ce884490a2c451b2624b26b673b81c9161 Mon Sep 17 00:00:00 2001
From: Eva Schiffer <evas@ssec.wisc.edu>
Date: Wed, 8 Mar 2017 15:45:50 -0600
Subject: [PATCH] fixing double add of add_offset when correcting for unsigned
 data

---
 pyglance/glance/io.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pyglance/glance/io.py b/pyglance/glance/io.py
index 4ffc281..b03741c 100644
--- a/pyglance/glance/io.py
+++ b/pyglance/glance/io.py
@@ -460,6 +460,8 @@ class nc (object):
 
             LOG.debug("fixing unsigned values in variable " + name)
 
+            print ("********* another test *********")
+
             # load the scale factor and add offset
             scale_factor = 1.0
             add_offset = 0.0
@@ -478,7 +480,7 @@ class nc (object):
                 # now figure out where all the corrupted values are, and shift them up to be positive
                 needs_fix_mask = (scaled_data_copy < add_offset) & (scaled_data_copy != missing_val)
                 # we are adding the 2's complement, but first we're scaling it appropriately
-                scaled_data_copy[needs_fix_mask] += ((np.iinfo(np.uint16).max + 1.0) * scale_factor) + add_offset
+                scaled_data_copy[needs_fix_mask] += ((np.iinfo(np.uint16).max + 1.0) * scale_factor)
 
         return scaled_data_copy
     
-- 
GitLab