[GRASS-SVN] r42764 - grass/trunk/imagery/i.atcorr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 12 05:06:32 EDT 2010


Author: aghisla
Date: 2010-07-12 09:06:32 +0000 (Mon, 12 Jul 2010)
New Revision: 42764

Modified:
   grass/trunk/imagery/i.atcorr/Iwave.cpp
   grass/trunk/imagery/i.atcorr/create_iwave.py
Log:
small edits in create_iwave.py, cleaned up code block for AVNIR in Iwave.cpp

Modified: grass/trunk/imagery/i.atcorr/Iwave.cpp
===================================================================
--- grass/trunk/imagery/i.atcorr/Iwave.cpp	2010-07-12 08:19:32 UTC (rev 42763)
+++ grass/trunk/imagery/i.atcorr/Iwave.cpp	2010-07-12 09:06:32 UTC (rev 42764)
@@ -1958,70 +1958,68 @@
     }
 }
 
+/* Following filter function created using create_iwave.py */
+
 void IWave::avnir(int iwa)
 {
-    /* band 1 of avnir */
+    /* "band 1" of AVNIR */
     static const float sr1[64] = {
-        0.00,    0.00,    0.00,    0.00,    0.00,    0.01,    0.01,
-        0.02,    0.03,    0.08,    0.13,    0.27,    0.40,    0.54,
-        0.67,    0.70,    0.72,    0.72,    0.73,    0.72,    0.72,
-        0.77,    0.82,    0.85,    0.88,    0.91,    0.93,    0.93,
-        0.93,    0.93,    0.93,    0.93,    0.94,    0.94,    0.94,
-        0.94,    0.94,    0.94,    0.94,    0.96,    0.98,    0.96,
-        0.94,    0.89,    0.85,    0.80,    0.75,    0.70,    0.66,
-        0.61,    0.56,    0.52,    0.47,    0.42,    0.38,    0.33,
-        0.28,    0.24,    0.19,    0.14,    0.09,    0.05,    0.00,
-        0.00 };
+		.0000, .0000, .0000, .0008, .0017, .0049, .0080,
+		.0293, .0776, .1260, .2609, .3958, .5315, .6672,
+		.7223, .7262, .7300, .7272, .7245, .7717, .8189,
+		.8815, .9068, .9322, .9496, .9669, .9708, .9747,
+		1.0000, .9849, .9699, .9507, .9316, .9365, .9415,
+		.9849, .9600, .9351, .7552, .5754, .3911, .2068,
+		.0655, .0440, .0226, .0150, .0075, .0046, .0018,
+		.0000, .0000, .0000, .0000, .0000, .0000, .0000
+    };
 
-    /* band 2 of avnir */
-    static const float sr2[84] = {
-        0.00,    0.00,    0.00,    0.00,    0.00,    0.04,    0.09,
-        0.13,    0.17,    0.22,    0.26,    0.30,    0.35,    0.39,
-        0.43,    0.48,    0.52,    0.57,    0.61,    0.65,    0.70,
-        0.74,    0.78,    0.83,    0.87,    0.87,    0.87,    0.89,
-        0.90,    0.93,    0.95,    0.96,    0.98,    0.99,    1.00,
-        0.99,    0.98,    0.94,    0.89,    0.83,    0.78,    0.77,
-        0.75,    0.72,    0.69,    0.56,    0.44,    0.30,    0.16,
-        0.10,    0.04,    0.03,    0.01,    0.01,    0.00,    0.00,
-        0.00,    0.01,    0.03,    0.04,    0.06,    0.07,    0.09,
-        0.11,    0.12,    0.14,    0.15,    0.17,    0.18,    0.20,
-        0.21,    0.23,    0.24,    0.26,    0.27,    0.29,    0.30,
-        0.32,    0.33,    0.35,    0.36,    0.38,    0.39,    0.41 };
+    /* "band 2" of AVNIR */
+    static const float sr2[56] = {
+		.0000, .0000, .0000, .0008, .0015, .0030, .0045,
+		.0202, .0470, .0739, .1358, .1977, .3205, .4433,
+		.6832, .7137, .7442, .7594, .7746, .8089, .8432,
+		.8719, .8721, .8724, .8873, .9022, .9254, .9486,
+		.9764, .9882, 1.0000, .9904, .9808, .9349, .8890,
+		.7843, .7651, .7458, .7156, .6854, .5639, .4425,
+		.1586, .0985, .0384, .0236, .0088, .0053, .0017
+    };
 
-
-    /* band 3 of avnir */
+    /* "band 3" of AVNIR */
     static const float sr3[80] = {
-        0.00,    0.00,    0.00,    0.00,    0.00,    0.00,    0.00,
-        0.00,    0.00,    0.00,    0.00,    0.01,    0.01,    0.01,
-        0.01,    0.01,    0.02,    0.03,    0.03,    0.04,    0.06,
-        0.10,    0.14,    0.21,    0.28,    0.39,    0.49,    0.57,
-        0.66,    0.72,    0.78,    0.79,    0.80,    0.78,    0.76,
-        0.74,    0.72,    0.70,    0.68,    0.66,    0.64,    0.62,
-        0.60,    0.58,    0.56,    0.54,    0.52,    0.50,    0.48,
-        0.46,    0.44,    0.42,    0.40,    0.38,    0.36,    0.34,
-        0.32,    0.30,    0.28,    0.26,    0.24,    0.22,    0.20,
-        0.15,    0.09,    0.07,    0.04,    0.03,    0.02,    0.01,
-        0.01,    0.01,    0.01,    0.01,    0.00,    0.00,    0.00,
-        0.00,    0.00,    0.00 };
+		.0000, .0000, .0000, .0000, .0000, .0000, .0000,
+		.0016, .0025, .0034, .0043, .0051, .0075, .0099,
+		.0153, .0228, .0304, .0462, .0620, .0995, .1370,
+		.2844, .3857, .4871, .5747, .6624, .7198, .7771,
+		.8021, .7991, .7960, .7989, .8017, .8312, .8606,
+		.9359, .9592, .9825, .9912, 1.0000, .9931, .9862,
+		.9275, .9046, .8818, .8607, .8395, .8344, .8293,
+		.8136, .7470, .6804, .5481, .4158, .3100, .2043,
+		.0898, .0634, .0369, .0273, .0177, .0135, .0093,
+		.0060, .0045, .0030, .0023, .0015, .0016, .0016
+    };
 
-    /* band 4 of avnir */
-    static const float sr4[90] = {
-        0.00,    0.00,    0.00,    0.00,    0.00,    0.00,    0.00,
-        0.00,    0.00,    0.00,    0.00,    0.00,    0.00,    0.01,
-        0.01,    0.02,    0.03,    0.05,    0.07,    0.12,    0.16,
-        0.23,    0.31,    0.44,    0.57,    0.72,    0.88,    0.94,
-        1.00,    0.99,    0.98,    0.96,    0.93,    0.91,    0.89,
-        0.88,    0.86,    0.86,    0.86,    0.88,    0.89,    0.92,
-        0.94,    0.94,    0.95,    0.95,    0.96,    0.94,    0.92,
-        0.90,    0.87,    0.84,    0.82,    0.78,    0.75,    0.73,
-        0.71,    0.69,    0.67,    0.66,    0.64,    0.64,    0.63,
-        0.63,    0.62,    0.62,    0.62,    0.60,    0.58,    0.58,
-        0.59,    0.59,    0.59,    0.57,    0.55,    0.53,    0.50,
-        0.45,    0.39,    0.32,    0.25,    0.19,    0.13,    0.10,
-        0.07,    0.06,    0.04,    0.03,    0.02,    0.01 };
+    /* "band 4" of AVNIR */
+    static const float sr4[120] = {
+		.0000, .0000, .0000, .0000, .0000, .0000, .0000,
+		.0023, .0023, .0022, .0033, .0045, .0080, .0115,
+		.0264, .0484, .0704, .1138, .1572, .2351, .3129,
+		.5733, .7244, .8754, .9377, 1.0000, .9884, .9768,
+		.9288, .9091, .8894, .8763, .8633, .8627, .8622,
+		.8885, .9136, .9388, .9437, .9486, .9531, .9576,
+		.9247, .8969, .8691, .8467, .8242, .7893, .7545,
+		.7117, .6911, .6705, .6560, .6414, .6357, .6299,
+		.6217, .6227, .6237, .6025, .5812, .5843, .5874,
+		.5860, .5696, .5532, .5251, .4969, .4438, .3908,
+		.2475, .1906, .1338, .1033, .0727, .0543, .0359,
+		.0224, .0161, .0097, .0069, .0040, .0038, .0036,
+		.0025, .0024, .0024, .0015, .0007, .0004, .0000,
+		.0007, .0006, .0006, .0006, .0006, .0003, .0000,
+		.0000, .0000, .0000, .0000, .0000, .0000, .0000
+    };
 
     static const float wli[4] = {0.390, 0.485, 0.545, 0.700};
-    static const float wls[4] = {0.550, 0.695, 0.745, 0.925};
+    static const float wls[4] = {0.550, 0.625, 0.745, 1.000};
 
     ffu.wlinf = (float)wli[iwa-1];
     ffu.wlsup = (float)wls[iwa-1];
@@ -2031,13 +2029,13 @@
 
     switch(iwa)
     {
-    case 1: for(i = 0; i < 64; i++)  ffu.s[56+i]  = sr1[i];
+    case 1: for(i = 0; i < 64; i++)  ffu.s[56+i] = sr1[i];
         break;
-    case 2: for(i = 0; i < 84; i++)  ffu.s[94+i]  = sr2[i];
+    case 2: for(i = 0; i < 56; i++)  ffu.s[94+i] = sr2[i];
         break;
     case 3: for(i = 0; i < 80; i++)  ffu.s[118+i] = sr3[i];
         break;
-    case 4: for(i = 0; i < 90; i++)  ffu.s[180+i] = sr4[i];
+    case 4: for(i = 0; i < 120; i++)  ffu.s[180+i] = sr4[i];
         break;
     }
 }

Modified: grass/trunk/imagery/i.atcorr/create_iwave.py
===================================================================
--- grass/trunk/imagery/i.atcorr/create_iwave.py	2010-07-12 08:19:32 UTC (rev 42763)
+++ grass/trunk/imagery/i.atcorr/create_iwave.py	2010-07-12 09:06:32 UTC (rev 42764)
@@ -155,9 +155,9 @@
     outfile.write('/* Following filter function created using create_iwave.py */\n\n')
     
     if len(bands) == 1:
-        outfile.write('void IWave::%s()\n{\n\n' % (sensor))
+        outfile.write('void IWave::%s()\n{\n\n' % (sensor.lower()))
     else:
-        outfile.write('void IWave::%s(int iwa)\n{\n\n' % (sensor))
+        outfile.write('void IWave::%s(int iwa)\n{\n\n' % (sensor.lower()))
         
     # single band case
     if len(bands) == 1:
@@ -168,7 +168,7 @@
         
         # calculate wl slot for band start
         # slots range from 250 to 4000 at 2.5 increments (total 1500)
-        s_start = int((limits[0] - 0.250)/2.5)
+        s_start = int((limits[0]*1000 - 250)/2.5)
         
         outfile.write('\n')
         outfile.write('    ffu.wlinf = %.4ff;\n' % (limits[0]))
@@ -191,10 +191,6 @@
         for b in range(len(bands)):
             inf = ", ".join(["%.3f" % i[0] for i in limits])
             sup = ", ".join(["%.3f" % i[1] for i in limits])
-            
-#            for j in zip(['[',']'],['{','}']):
-#                inf = inf.replace(j[0],j[1])
-#                sup = sup.replace(j[0],j[1])
         
         outfile.write('    static const float wli[%i] = {%s};\n' % (len(bands), inf))
         outfile.write('    static const float wls[%i] = {%s};\n' % (len(bands), sup))



More information about the grass-commit mailing list