Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/utils/consistency/checkfield.m
===================================================================
--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/utils/consistency/checkfield.m	(revision 12959)
+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/utils/consistency/checkfield.m	(revision 12960)
@@ -135,7 +135,7 @@
 	field2=reshape(field,prod(size(field)),1);
 	if any(field2<lowerbound),
 		md = checkmessage(md,getfieldvalue(options,'message',...
-			['field ''' fieldname ''' should have values above ' num2str(lowerbound)]));
+			['field ''' fieldname ''' should have values above ' num2str(lowerbound(1,1))]));
 	end
 end
 if exist(options,'>')
@@ -143,7 +143,7 @@
 	field2=reshape(field,prod(size(field)),1);
 	if any(field2<=lowerbound),
 		md = checkmessage(md,getfieldvalue(options,'message',...
-			['field ''' fieldname ''' should have values above ' num2str(lowerbound)]));
+			['field ''' fieldname ''' should have values above ' num2str(lowerbound(1,1))]));
 	end
 end
 
@@ -153,7 +153,7 @@
 	field2=reshape(field,prod(size(field)),1);
 	if any(field2>upperbound),
 		md = checkmessage(md,getfieldvalue(options,'message',...
-			['field ''' fieldname ''' should have values below ' num2str(upperbound)]));
+			['field ''' fieldname ''' should have values below ' num2str(upperbound(1,1))]));
 	end
 end
 if exist(options,'<')
@@ -161,7 +161,7 @@
 	field2=reshape(field,prod(size(field)),1);
 	if any(field2>=upperbound),
 		md = checkmessage(md,getfieldvalue(options,'message',...
-			['field ''' fieldname ''' should have values below ' num2str(upperbound)]));
+			['field ''' fieldname ''' should have values below ' num2str(upperbound(1,1))]));
 	end
 end
 
Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/classes/mesh.m
===================================================================
--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/classes/mesh.m	(revision 12959)
+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/classes/mesh.m	(revision 12960)
@@ -86,6 +86,10 @@
 			md = checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
 			md = checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
 			md = checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+			if (md.mesh.dimension==3),
+				md = checkfield(md,'mesh.z','>=',md.geometry.bed,'message','''mesh.z'' should be above the bed');
+				md = checkfield(md,'mesh.z','<=',md.geometry.surface,'message','''mesh.z'' should be below the ice surface');
+			end
 			if (md.mesh.dimension==2),
 				md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
 			else
