|
ocssw
1.0
|
00001 /* 00002 00003 $Header$ 00004 $Log$ 00005 00006 00007 00008 From yeh@calval Tue Mar 19 16:04:26 1996 00009 Received: from calval.gsfc.nasa.gov by manua.gsfc.nasa.gov via ESMTP (950911.SGI.8.6.12.PATCH825/931108.SGI.AUTO.ANONFTP) 00010 for <frank@manua.gsfc.nasa.gov> id QAA24118; Tue, 19 Mar 1996 16:04:25 -0500 00011 Received: by calval.gsfc.nasa.gov (950911.SGI.8.6.12.PATCH825/931108.SGI.AUTO.ANONFTP) 00012 for frank@manua id QAA03350; Tue, 19 Mar 1996 16:04:24 -0500 00013 From: yeh@calval (Eueng-nan Yeh) 00014 Message-Id: <199603192104.QAA03350@calval.gsfc.nasa.gov> 00015 Subject: out-of-band subroutine 00016 To: frank 00017 Date: Tue, 19 Mar 1996 16:04:18 -0500 (EST) 00018 Reply-To: yeh@calval (Eueng-nan Yeh) 00019 Organization: NASA/Goddard/Laboratory for Hydrospheric Processes/SeaWiFS 00020 X-Mailer: ELM [version 2.4 PL0] 00021 MIME-Version: 1.0 00022 Content-Type: text/plain; charset=US-ASCII 00023 Content-Length: 2794 00024 Status: RO 00025 00026 */ 00027 00028 00029 #include <stdio.h> 00030 #define NBAND 8 00031 #define NSAMPLE 1285 00032 00033 00034 #ifdef __STDC__ 00035 int out_band_corr(float r[8][1285],float oxygen,int xsample) 00036 #else 00037 int out_band_corr(r,oxygen,xsample) 00038 /************************************************************2******* 00039 /To perform out-of-band correction 00040 /------------------------------------------------------------- 00041 /Inputs: 00042 / r float[8][1285] level-1 radiances (band 1 to 8) per line. 00043 / oxygen float Oxygen correction factor; =1 if r(765nm) already 00044 / corrected; =1.12 if not. 00045 / xsample int Number of data points per line (max 1285). 00046 /Outputs: 00047 / r float[8][1285] Out-of-band corrected radiances per line. 00048 / Return value=-1 for open data file failure; otherwise O.K. 00049 /------------------------------------------------------------- 00050 / 00051 / Created by Eueng-nan Yeh GSC/SAIC 10/10/95 00052 / 00053 /%***********************************************************2******/ 00054 float r[NBAND][NSAMPLE]; 00055 float oxygen; 00056 int xsample; 00057 #endif /* __STDC__ */ 00058 { 00059 int i,m,id=1; 00060 00061 float wl[9]={412.,443.,490.,510.,555.,670.,765.,865.,965.}; 00062 /*Spectral response of band 8 divided into six components. */ 00063 float s[6]={0.583,0.829,6.251,13.533,1013.592,9.374}; 00064 float s5[3]={5.261,488.215,7.475}; 00065 float s6[3]={2.592,491.802,2.112}; 00066 /*Out of band ratio==within-band response/total response*/ 00067 float br[8]={0.9943,0.9949,0.9930,0.9934,0.9734,0.9856,0.9844,0.9417}; 00068 float x,ra,r5,r6,r8,r9,br5,br6,br8; 00069 if(id==1){ /*simple method */ 00070 ra=(wl[8]-wl[7])/(wl[7]-wl[6]); 00071 for(m=0; m<xsample; m++) { /*process one line*/ 00072 r5=r[4][m]; 00073 r6=r[5][m]; 00074 r8=r[7][m]; 00075 for(i=0; i<8; i++) r[i][m] *= br[i]; /*adjust 0-7 first */ 00076 r9=r[7][m]+ra*(r[7][m]-oxygen*r[6][m]); /*r[6] for wl=765nm */ 00077 x=r[7][m]*s[4]; 00078 br8=x/(r[0][m]*s[0]+r[3][m]*s[1]+r[4][m]*s[2] 00079 +oxygen*r[6][m]*s[3]+x+r9*s[5]); 00080 r[7][m] = r8* br8; 00081 x=r[5][m]*s6[1]; /* band 6*/ 00082 br6=x/(r[2][m]*s6[0]+x+r[7][m]*s6[2]); 00083 r[5][m] = r6*br6; 00084 x=r[4][m]*s5[1]; /* band 5*/ 00085 br5=x/(r[1][m]*s5[0]+x+r[5][m]*s5[2]); 00086 r[4][m] = r5*br5; 00087 } 00088 } 00089 return(0); 00090 } 00091 00092 #ifdef TEST_OOB 00093 void main() 00094 { 00095 int i,j; 00096 /* Typical SeaWiFS radiances TM 1 Table 1 or TM 22 Table 26. */ 00097 float rad[NBAND][NSAMPLE]={{9.10, 9.10,9.10},{8.41,8.41,8.41} 00098 ,{6.56,6.56,6.56},{5.64,5.64,5.64} 00099 ,{4.57,4.57,4.57},{2.46,2.46,2.46} 00100 ,{1.61,1.61,1.61},{1.0,1.0,1.09}}; 00101 float r[NBAND][NSAMPLE],oxygen=1.12; /*oxygen absorption correc. factor*/ 00102 float ra[NBAND]; 00103 00104 for(i=0; i<8; i++) printf("%7.5f ",rad[i][2]); 00105 printf("\n"); 00106 for(i=0;i<8;i++) for(j=0;j<3;j++) r[i][j]=rad[i][j]; 00107 out_band_corr(r,oxygen,3); 00108 for(i=0; i<8; i++) printf("%7.5f ",r[i][2]); 00109 printf("\n"); 00110 for(i=0; i<8; i++) ra[i]=r[i][2]/rad[i][2]; 00111 for(i=0; i<8; i++) printf("%7.5f ",ra[i]); 00112 printf("\n\n"); 00113 00114 exit(0); 00115 } 00116 #endif /* TEST_OOB */ 00117 00118 /* Test Result 00119 00120 From yeh@calval Tue Mar 19 16:09:54 1996 00121 Received: from calval.gsfc.nasa.gov by manua.gsfc.nasa.gov via ESMTP (950911.SGI.8.6.12.PATCH825/931108.SGI.AUTO.ANONFTP) 00122 for <frank@manua.gsfc.nasa.gov> id QAA24798; Tue, 19 Mar 1996 16:09:53 -0500 00123 Received: by calval.gsfc.nasa.gov (950911.SGI.8.6.12.PATCH825/931108.SGI.AUTO.ANONFTP) 00124 for frank@manua id QAA04098; Tue, 19 Mar 1996 16:09:52 -0500 00125 From: yeh@calval (Eueng-nan Yeh) 00126 Message-Id: <199603192109.QAA04098@calval.gsfc.nasa.gov> 00127 Subject: out-of-band result 00128 To: frank 00129 Date: Tue, 19 Mar 1996 16:09:47 -0500 (EST) 00130 Reply-To: yeh@calval (Eueng-nan Yeh) 00131 Organization: NASA/Goddard/Laboratory for Hydrospheric Processes/SeaWiFS 00132 X-Mailer: ELM [version 2.4 PL0] 00133 MIME-Version: 1.0 00134 Content-Type: text/plain; charset=US-ASCII 00135 Content-Length: 220 00136 Status: RO 00137 00138 9.10000 8.41000 6.56000 5.64000 4.57000 2.46000 1.61000 1.09000 00139 9.04813 8.36711 6.51408 5.60278 4.44292 2.42131 1.58488 1.02651 00140 0.99430 0.99490 0.99300 0.99340 0.97219 0.98427 0.98440 0.94175 00141 00142 */
1.7.6.1