Index: /issm/trunk-jpl/src/m/psl/ocelm.m
===================================================================
--- /issm/trunk-jpl/src/m/psl/ocelm.m	(revision 19309)
+++ /issm/trunk-jpl/src/m/psl/ocelm.m	(revision 19310)
@@ -1,23 +1,25 @@
-function oce_lm = ocelm(lMax,nPix,ocean,sh) 
+function oce_lm = ocelm(sh,lMax,ocean,areaEle) 
 
-%---------------------------------------------------------------------
-% ocelm :: a function to compute SH coefficients of "ocean function" 
-%---------------------------------------------------------------------
-% This code is written as a part of the ISSM-PSL project
-% (c) S. Adhikari 
-%     Jet Propulsion Laboratory, Caltech 
-%     November 3, 2014
-%---------------------------------------------------------------------
+%OCElm :: a function to compute SH coefficients of ocean function 
+% 
+%USAGE: oce_lm = ocelm(sh,lMax,ocean,areaEle); 
+%
+%sh (spherical harmonics) 
+%lMax (maximum SH degree to be considered) 
+%ocean (ocean function) 
+%areaEle (area of elements) 
+%
+
 p1 = 0; 
 
 oce_lm = zeros(1,(lMax+1)^2); 
 
+% weighted area integration 
 for l=0:lMax
    for m=-l:l
-      oce_lm(1+p1) = sum(sh(:,1+p1).*ocean');
+      oce_lm(1+p1) = sum((sh(:,1+p1).*ocean').*areaEle');
       p1 = p1+1;
    end
 end
+oce_lm = oce_lm/sum(areaEle);
 
-oce_lm = oce_lm*4*pi/nPix;
-
