Index: /issm/trunk-jpl/src/m/coordsystems/ll2xy.m
===================================================================
--- /issm/trunk-jpl/src/m/coordsystems/ll2xy.m	(revision 22338)
+++ /issm/trunk-jpl/src/m/coordsystems/ll2xy.m	(revision 22339)
@@ -1,11 +1,14 @@
-function [x,y] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel)  
+function [x,y,scale_factor] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel)  
 %LL2XY - converts lat long to polar stereographic
 %
 %   Converts from geodetic latitude and longitude to Polar 
 %   Stereographic (X,Y) coordinates for the polar regions.
+%   Optional scale factor provides the scaling factor needed to correct projection error
+%   in areas and volumes
 %   Author: Michael P. Schodlok, December 2003 (map2ll)
 %
 %   Usage:
 %      [x,y] = ll2xy(lat,lon,sgn)
+%      [x,y,scale_factor] = ll2xy(lat,lon,sgn)
 %      [x,y] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel)
 %
@@ -29,4 +32,9 @@
 else
 	help ll2xy
+	error('bad usage');
+end
+
+if nargout~=3 & nargout~=2,
+	help xy2ll
 	error('bad usage');
 end
@@ -65,2 +73,7 @@
 	y(cnt1) = 0.0;
 end
+
+if nargout==3,
+	m=((1+sin(abs(slat)*pi/180))*ones(length(lat),1)./(1+sin(abs(lat)*pi/180)));
+	scale_factor=(1./m).^2;
+end
Index: /issm/trunk-jpl/src/m/coordsystems/xy2ll.m
===================================================================
--- /issm/trunk-jpl/src/m/coordsystems/xy2ll.m	(revision 22338)
+++ /issm/trunk-jpl/src/m/coordsystems/xy2ll.m	(revision 22339)
@@ -1,3 +1,3 @@
-function [lat,lon] = xy2ll(x,y,sgn,central_meridian,standard_parallel)
+function [lat,lon,scale_factor] = xy2ll(x,y,sgn,central_meridian,standard_parallel)
 %XY2LL - converts xy to lat long
 %
@@ -5,8 +5,11 @@
 %   latitude and longitude Stereographic (X,Y) coordinates for the polar
 %   regions.
+%   Optional scale factor provides the scaling factor needed to correct projection error
+%   in areas and volumes
 %   Author: Michael P. Schodlok, December 2003 (map2xy.m)
 %
 %   Usage:
 %      [lat,lon] = xy2ll(x,y,sgn);
+%      [lat,lon,scale_factor] = xy2ll(x,y,sgn);
 %      [lat,lon] = xy2ll(x,y,sgn,central_meridian,standard_parallel);
 %
@@ -29,4 +32,9 @@
 	end
 else
+	help xy2ll
+	error('bad usage');
+end
+
+if nargout~=3 & nargout~=2,
 	help xy2ll
 	error('bad usage');
@@ -71,2 +79,6 @@
 lat = lat * 180. / pi;
 lon = lon - delta; 
+if nargout==3,
+	m=((1+sin(abs(slat)*pi/180))*ones(length(lat),1)./(1+sin(abs(lat)*pi/180)));
+	scale_factor=(1./m).^2;
+end
