@@ -71,22 +71,21 @@ double th_6 = 2.16248; /* Band 4/2 Ratio */
7171double th_7 = 1.0 ; /* Band 4/5 Ratio */ ;
7272double th_8 = 210. ; /* Band 5/6 Composite */
7373
74- extern int hist_n ;
75-
7674void acca_algorithm (Gfile * out , Gfile band [],
77- int single_pass , int with_shadow , int cloud_signature )
75+ int single_pass , int with_shadow , int cloud_signature , int hist_n )
7876{
79- int i , count [5 ], hist_cold [hist_n ], hist_warm [hist_n ];
80- double max , value [5 ], signa [5 ], idesert , review_warm , shift ;
77+ int i , count [5 ];
78+ double max , value [5 ], signa [5 ], idesert , shift ;
79+ int review_warm ;
80+ int * hist_cold , * hist_warm ;
81+ hist_cold = (int * )G_calloc (hist_n , sizeof (int ));
82+ hist_warm = (int * )G_calloc (hist_n , sizeof (int ));
8183
8284 /* Reset variables ... */
8385 for (i = 0 ; i < 5 ; i ++ ) {
8486 count [i ] = 0 ;
8587 value [i ] = 0. ;
8688 }
87- for (i = 0 ; i < hist_n ; i ++ ) {
88- hist_cold [i ] = hist_warm [i ] = 0 ;
89- }
9089
9190 /* FIRST FILTER ... */
9291 acca_first (out , band , with_shadow ,
@@ -207,7 +206,7 @@ void acca_algorithm(Gfile * out, Gfile band[],
207206 /* SECOND FILTER ... */
208207 /* By-pass two processing but it retains warm and cold clouds */
209208 if (single_pass == TRUE) {
210- review_warm = -1. ;
209+ review_warm = -1 ;
211210 value [KUPPER ] = 0. ;
212211 value [KLOWER ] = 0. ;
213212 }
0 commit comments