Index: /issm/trunk/src/m/classes/public/geography2.m
===================================================================
--- /issm/trunk/src/m/classes/public/geography2.m	(revision 1266)
+++ /issm/trunk/src/m/classes/public/geography2.m	(revision 1267)
@@ -121,4 +121,21 @@
 end
 
+
+%some final checks: 
+%check that no grid thinks it's on an ice shelf or ice sheet, and lies actually in the middle of the water.
+gridsgrounded=find(~gridonwater);
+lengthconnectivity=size(md.nodeconnectivity,2);
+groundedcounters=md.nodeconnectivity(gridsgrounded,lengthconnectivity);
+groundedconnectivity=md.nodeconnectivity(gridsgrounded,1:lengthconnectivity-1);
+pos=find(groundedconnectivity);
+groundedconnectivity(pos)=elementonwater(groundedconnectivity(pos));
+groundedsum=sum(groundedconnectivity,2);
+errorflags=find(groundedsum==groundedcounters);
+errorgrids=gridsgrounded(errorflags);
+
+gridonwater(errorgrids)=1;
+gridonicesheet(errorgrids)=0;
+gridoniceshelf(errorgrids)=0;
+
 %Return: 
 md.gridoniceshelf=gridoniceshelf;
