@@ -977,7 +977,13 @@ def kernel_bessel(self, lat, wave_length, order=1):
977977        kernel_  =  empty ((half_x_pt  *  2  *  order  +  1 , half_y_pt  *  2  *  order  +  1 ))
978978        kernel_ [half_x_pt  *  order :] =  kernel 
979979        kernel_ [:half_x_pt  *  order ] =  kernel [:0 :- 1 ]
980-         return  kernel_ 
980+         # remove unused row/column 
981+         k_valid  =  kernel_  !=  0 
982+         x_valid  =  where (k_valid .sum (axis = 1 ))[0 ]
983+         x_slice  =  slice (x_valid [0 ], x_valid [- 1 ] +  1 )
984+         y_valid  =  where (k_valid .sum (axis = 0 ))[0 ]
985+         y_slice  =  slice (y_valid [0 ], y_valid [- 1 ] +  1 )
986+         return  kernel_ [x_slice , y_slice ]
981987
982988    def  _low_filter (self , grid_name , x_cut , y_cut ):
983989        """low filtering 
@@ -995,7 +1001,8 @@ def _low_filter(self, grid_name, x_cut, y_cut):
9951001            mode = 'wrap'  if  self .is_circular () else  'reflect' )
9961002
9971003    def  convolve_filter_with_dynamic_kernel (self , grid , kernel_func , lat_max = 85 , extend = False , ** kwargs_func ):
998-         logging .warning ('No filtering above %f degrees of latitude' , lat_max )
1004+         if  (abs (self .y_c ) >  lat_max ).any ():
1005+             logging .warning ('No filtering above %f degrees of latitude' , lat_max )
9991006        if  isinstance (grid , str ):
10001007            data  =  self .grid (grid ).copy ()
10011008        else :
0 commit comments