Gaussian smoother

From: Correia, James <james.correia_at_nyahnyahspammersnyahnyah>
Date: Fri, 07 Nov 2008 14:46:46 -0800

All-
I wrote some code in NCL to do a gaussian smoother but it is very SLOW. It
does not handle missing yet.

Does anyone know if there is a faster way to implement it:

;Tcc(:,:,:,:) is the array on which the smoother is operating
;It has dimensions of 5,224,299,49

lam = 3. ; shape factor
fac = new((/6/),float)
do n=0,5
;compute the factors based on radius from central grid point
fac(n) = exp(-1.*(abs(int2flt(n))/lam)*(abs(int2flt(n))/lam))
end do
tmp = new((/5,49/),float)
tm1 = new((/5,49/),float)

do x=5,298-5
do y=5,223-5
  tmp(:,:) = 0.
  tm1(:,:) = 0.
 do xx=x-5,x+5
 do yy=y-5,y+5
  rad = sqrt((xx-x)*(xx-x) + (yy-y)*(yy-y))
  if(rad .lt. 6)then
   rada = floattointeger(rad)
   tmp(:,:) = tmp(:,:) + tcc(:,y,x,:)*fac(rada)
   tm1(:,:) = tm1(:,:) + fac(rada)
  end if
 end do
 end do
 tcc(:,y,x,:) = tmp(:,:)/tm1(:,:)
end do
end do

Thanks
jimmyc

James Correia Jr., PhD
Climate Physics Group
Post. Doc.
Pacific Northwest National Lab

"Wisdom. Strength. Courage. Generosity. Each of us are born with one of
these. It is up to us to find the other three inside of us."
-Into the West

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 07 2008 - 15:46:46 MST

This archive was generated by hypermail 2.2.0 : Sun Nov 09 2008 - 06:17:31 MST