[GRASS-SVN] r44575 - grass/branches/releasebranch_6_4/imagery/i.atcorr

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 9 12:08:15 EST 2010


Author: neteler
Date: 2010-12-09 09:08:15 -0800 (Thu, 09 Dec 2010)
New Revision: 44575

Modified:
   grass/branches/releasebranch_6_4/imagery/i.atcorr/create_iwave.py
Log:
Daniel Victoria: bugfixes for filter function

Modified: grass/branches/releasebranch_6_4/imagery/i.atcorr/create_iwave.py
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.atcorr/create_iwave.py	2010-12-09 17:07:57 UTC (rev 44574)
+++ grass/branches/releasebranch_6_4/imagery/i.atcorr/create_iwave.py	2010-12-09 17:08:15 UTC (rev 44575)
@@ -19,6 +19,10 @@
 file name is used for sensor name
 
 Updated by: Anne Ghisla, 2010
+Bug fix (9/12/2010) by Daniel:
+   1) function interpolate_band was not generating the spectral response for the last value in the filter function. Fixed
+   2) function pretty_print was not printing the 8th value of every line, cutting the filter function short.
+ 
 """
 import os
 import sys
@@ -86,7 +90,7 @@
     # interpolating
     f = interpolate.interp1d(response[:,0],response[:,1])
     
-    filter_f = f(np.arange(response[0,0], response[-1,0], 2.5))
+    filter_f = f(np.arange(response[0,0], response[-1,0] + 2.5, 2.5))
     
     # convert limits from nanometers to micrometers
     lowerlimit = response[0,0]/1000
@@ -117,8 +121,11 @@
     8 values per line, with spaces, commas and all the rest
     """
     pstring = ''
-    for i in range(len(filter_f)):
+    for i in range(len(filter_f)+1):
         if i%8 is 0:
+            if i is not 0:
+                value_wo_leading_zero = ('%.4f' % (filter_f[i-1])).lstrip('0')
+                pstring += value_wo_leading_zero+', '
             if i is not 1: 
                 # trim the trailing whitespace at the end of line
                 pstring = pstring.rstrip()



More information about the grass-commit mailing list