Index: sm/trunk-jpl/src/m/shp/Shp2Exp.m
===================================================================
--- /issm/trunk-jpl/src/m/shp/Shp2Exp.m	(revision 17541)
+++ 	(revision )
@@ -1,48 +1,0 @@
-function Shp2Exp(expfilename,shapefilename)
-%SHP2EXP- transform shape file to Argus .exp file
-%
-%   Usage:
-%      Shp2Exp(expfilename,shapefilename);
-%
-%   Example:
-%      Shp2Exp('Domain.exp','Domain.shp');
-%
-%   See also EXPMASTER, EXPDOC
-
-	if ~exist(shapefilename,'file'),
-		error(['Shapefile ' shapefilename ' does not exist']);
-	end
-	shp=shaperead(shapefilename);
-
-	expstruct=struct([]);
-	for i=1:length(shp),
-		if strcmpi(shp(i).Geometry,'Polygon'),
-			x=shp(i).X; y=shp(i).Y;
-			ids=find(isnan(x));
-			x(ids)=[]; y(ids)=[];
-			expstruct(end+1).x=x;
-			expstruct(end).y=y;
-			expstruct(end).nods=length(x);
-			expstruct(end).density=1;
-			expstruct(end).closed=1;
-			expstruct(end).name=num2str(shp(i).id);
-		elseif strcmpi(shp(i).Geometry,'Point'),
-			x=shp(i).X; y=shp(i).Y;
-			expstruct(end+1).x=x;
-			expstruct(end).y=y;
-			expstruct(end).nods=length(x);
-			expstruct(end).density=1;
-			expstruct(end).closed=1;
-			%exp(end).name=num2str(shp(i).id);
-		elseif strcmpi(shp(i).Geometry,'Line'),
-			x=shp(i).X; y=shp(i).Y;
-			x(end)=x(1); y(end)=y(1);
-			expstruct(end+1).x=x;
-			expstruct(end).y=y;
-			expstruct(end).nods=length(x);
-			expstruct(end).density=1;
-			expstruct(end).closed=1;
-		end
-	end
-
-	expwrite(expstruct,expfilename);
Index: /issm/trunk-jpl/src/m/shp/shp2exp.m
===================================================================
--- /issm/trunk-jpl/src/m/shp/shp2exp.m	(revision 17542)
+++ /issm/trunk-jpl/src/m/shp/shp2exp.m	(revision 17542)
@@ -0,0 +1,48 @@
+function Shp2Exp(expfilename,shapefilename)
+%SHP2EXP- transform shape file to Argus .exp file
+%
+%   Usage:
+%      Shp2Exp(expfilename,shapefilename);
+%
+%   Example:
+%      Shp2Exp('Domain.exp','Domain.shp');
+%
+%   See also EXPMASTER, EXPDOC
+
+	if ~exist(shapefilename,'file'),
+		error(['Shapefile ' shapefilename ' does not exist']);
+	end
+	shp=shaperead(shapefilename);
+
+	expstruct=struct([]);
+	for i=1:length(shp),
+		if strcmpi(shp(i).Geometry,'Polygon'),
+			x=shp(i).X; y=shp(i).Y;
+			ids=find(isnan(x));
+			x(ids)=[]; y(ids)=[];
+			expstruct(end+1).x=x;
+			expstruct(end).y=y;
+			expstruct(end).nods=length(x);
+			expstruct(end).density=1;
+			expstruct(end).closed=1;
+			expstruct(end).name=num2str(shp(i).id);
+		elseif strcmpi(shp(i).Geometry,'Point'),
+			x=shp(i).X; y=shp(i).Y;
+			expstruct(end+1).x=x;
+			expstruct(end).y=y;
+			expstruct(end).nods=length(x);
+			expstruct(end).density=1;
+			expstruct(end).closed=1;
+			%exp(end).name=num2str(shp(i).id);
+		elseif strcmpi(shp(i).Geometry,'Line'),
+			x=shp(i).X; y=shp(i).Y;
+			x(end)=x(1); y(end)=y(1);
+			expstruct(end+1).x=x;
+			expstruct(end).y=y;
+			expstruct(end).nods=length(x);
+			expstruct(end).density=1;
+			expstruct(end).closed=1;
+		end
+	end
+
+	expwrite(expstruct,expfilename);
Index: /issm/trunk-jpl/src/m/shp/shp2exp.py
===================================================================
--- /issm/trunk-jpl/src/m/shp/shp2exp.py	(revision 17542)
+++ /issm/trunk-jpl/src/m/shp/shp2exp.py	(revision 17542)
@@ -0,0 +1,54 @@
+import shapefile
+import os
+from expwrite import expwrite
+
+def shp2exp(shapefilename,*expfilename):
+	'''
+	Convert a shapefile to an .exp file.  Optionally, expfilename can be
+	specified to give a name for the .exp file to be created, otherwise the
+	.exp file will have the same prefix as the .shp file.
+
+	Usage:
+		shp2exp(shapefilename)
+		shp2exp(shapefilename,expfilename)
+
+	Examples:
+		shp2exp('Domain.shp') % creates Domain.exp
+		shp2exp('Domain.shp','DomainForISSM.exp')
+	'''
+	
+	if not os.path.exists(shapefilename):
+		raise IOError("shp2exp error message: file '%s' not found!" % parametername)
+	if not len(expfilename):
+		expfile=os.path.splitext(shapefilename)[0]+'.exp'
+	else:
+		expfile=expfilename[0]
+
+	shp=shapefile.Reader(shapefilename)
+	expdict=dict(closed=1,density=1)
+
+
+	for i in range(len(shp.shapes())):
+		geom=shp.shapes()[i].shapeType
+		if geom==5: # polygon
+			x=[p[0] for p in shp.shapes()[i].points]
+			y=[q[1] for q in shp.shapes()[i].points]
+			expdict['x']=x
+			expdict['y']=y
+			expdict['nods']=len(x)
+		elif geom==3: # line
+			x=[p[0] for p in shp.shapes()[i].points]
+			y=[q[1] for q in shp.shapes()[i].points]
+			x.append(x[0])
+			y.append(y[0])
+			expdict['x']=x
+			expdict['y']=y
+			expdict['nods']=len(x)
+		elif geom==1: # point
+			x=[p[0] for p in shp.shapes()[i].points]
+			y=[q[1] for q in shp.shapes()[i].points]
+			expdict['x']=x
+			expdict['y']=y
+			expdict['nods']=len(x)
+
+	expwrite([expdict],expfile)
