Index: /issm/trunk/src/m/utils/Exp/expremovestraightsegments.m
===================================================================
--- /issm/trunk/src/m/utils/Exp/expremovestraightsegments.m	(revision 8726)
+++ /issm/trunk/src/m/utils/Exp/expremovestraightsegments.m	(revision 8726)
@@ -0,0 +1,31 @@
+function expremovestraightsegments(newfilename,filename,cutoff)
+%EXPREMOVESTRAIGHTSEGMENTS:  remove straight segments connecting contours.
+%
+% Usage: expremovestraightsegments('argus.exp',100); 
+%
+%
+
+a=expread(filename,1);
+newcontours=a(1);
+
+for i=1:length(a),
+	contour=a(i);
+	
+	s=sqrt(contour.x.^2+contour.y.^2);
+	d=diff(s);
+	
+	pos=find(abs(d)>cutoff);
+	pos=[0;pos;length(contour.x)];
+
+	for j=1:length(pos)-1,
+
+		newcontour=contour;
+		newcontour.x=contour.x(pos(j)+1:pos(j+1));
+		newcontour.y=contour.y(pos(j)+1:pos(j+1));
+		newcontour.nods=length(newcontour.x);
+		newcontours(end+1)=newcontour;
+	end
+end
+newcontours=newcontours(2:end);
+
+expwrite(newcontours,newfilename);
Index: /issm/trunk/src/m/utils/Exp/expsplit.m
===================================================================
--- /issm/trunk/src/m/utils/Exp/expsplit.m	(revision 8726)
+++ /issm/trunk/src/m/utils/Exp/expsplit.m	(revision 8726)
@@ -0,0 +1,31 @@
+function expsplit(domainoutline)
+%EXPSPLIT - split exp file into sub-contours
+%
+%   This routine reads in a domain outline file (Argus format) and plots all the contours 
+%   This will create as many files there are contours in the domain, each file will be postfix with _i
+%   where i is the contour name. 
+%
+%   Usage:
+%      expsplit(domainoutline)
+%
+%   Example:
+%      expsplit('Domain.exp');
+%
+%   See also EXPMASTER, EXPDOC
+
+%check nargin
+if ~nargin | nargin>1
+	help expsplit
+	error('expsplit error message: bad usage');
+end
+
+[path,root,ext]=fileparts(domainoutline);
+
+%Read file: 
+domains=expread(domainoutline,1);
+
+%split and write contours: 
+for i=1:length(domains),
+	subdomain=domains(i);
+	expwrite(subdomain,[root '_' num2str(i)  ext]);
+end
Index: /issm/trunk/src/m/utils/Exp/readwrite/expread.m
===================================================================
--- /issm/trunk/src/m/utils/Exp/readwrite/expread.m	(revision 8725)
+++ /issm/trunk/src/m/utils/Exp/readwrite/expread.m	(revision 8726)
@@ -73,4 +73,6 @@
 	Struct(count).y=A(2,:)';
 
+	if(Struct(count).nods~=length(Struct(count).x))error(['Profile ' num2str(count) ' reports incorrect length']); end;
+
 	%skip last coordinate if whole=0,
    if whole==0, fscanf(fid,'%f %f',[1 2]); end
Index: /issm/trunk/src/m/utils/Interp/PatchToVec.m
===================================================================
--- /issm/trunk/src/m/utils/Interp/PatchToVec.m	(revision 8725)
+++ /issm/trunk/src/m/utils/Interp/PatchToVec.m	(revision 8726)
@@ -5,5 +5,5 @@
 %      vec=PatchToVec(Patch)
 
-%if the patch is P0, we need to transform the vector a little bit first
+%if the patch is P0: we have element values, return an element vector
 switch(Patch.interpolation(1)),
 	case P0Enum,
Index: /issm/trunk/src/m/utils/Model/loadmodel.m
===================================================================
--- /issm/trunk/src/m/utils/Model/loadmodel.m	(revision 8725)
+++ /issm/trunk/src/m/utils/Model/loadmodel.m	(revision 8726)
@@ -21,4 +21,5 @@
 	warning off MATLAB:unknownElementsNowStruc;
 	struc=load(path,'-mat');
+
 	warning on MATLAB:unknownElementsNowStruc;
 
@@ -31,5 +32,5 @@
 	
 	%now, transform md into a new model
-	if ~strcmpi(class(md),'model'),
+	if ~strcmpi(class(md),'model') & ~strcmpi(class(md),'planet'),
 		md2=structtomodel(model,md);
 		md=md2;
