Index: issm/trunk-jpl/src/m/classes/sealevelmodel.py
===================================================================
--- issm/trunk-jpl/src/m/classes/sealevelmodel.py	(revision 25455)
+++ issm/trunk-jpl/src/m/classes/sealevelmodel.py	(revision 25477)
@@ -1,6 +1,6 @@
 import warnings
-
 import numpy as np
-
+from fielddisplay import fielddisplay
+from fieldnames import fieldnames
 from generic import generic
 from issmsettings import issmsettings
@@ -12,5 +12,8 @@
 from private import private
 from TwoDToThreeD import TwoDToThreeD
-
+from plotmodel import plotmodel
+from plot3 import plot3
+from loneedges import loneedges
+from planetradius import planetradius
 
 class sealevelmodel(object):
@@ -30,16 +33,16 @@
     """
 
-    def __init__(self, *args): #{{{
-        self.icecaps        = [] # list of land/ice models; name should be changed later
-        self.earth          = 0 # model for the whole earth
-        self.basins         = [] # list of basins, matching icecaps, where shapefile info is held
-        self.cluster        = 0
-        self.miscellaneous  = 0
-        self.settings       = 0
-        self.private        = 0
-        self.mergedcaps     = 0
-        self.transitions    = []
-        self.eltransitions  = []
-        self.planet         = ''
+    def __init__(self, *args):  #{{{
+        self.icecaps = []  # list of land/ice models; name should be changed later
+        self.earth = 0  # model for the whole earth
+        self.basins = []  # list of basins, matching icecaps, where shapefile info is held
+        self.cluster = 0
+        self.miscellaneous = 0
+        self.settings = 0
+        self.private = 0
+        self.mergedcaps = 0
+        self.transitions = []
+        self.eltransitions = []
+        self.planet = ''
 
         # Create a default object
@@ -60,5 +63,5 @@
     #}}}
 
-    def __repr__(self): # {{{
+    def __repr__(self):  # {{{
         s = '{}\n'.format(fielddisplay(self, 'icecaps', 'ice caps'))
         s += '{}\n'.format(fielddisplay(self, 'earth', 'earth'))
@@ -68,18 +71,18 @@
     #}}}
 
-    def setdefaultparameters(self): # {{{
-        self.icecaps        = []
-        self.earth          = []
-        self.cluster        = generic()
-        self.miscellaneous  = miscellaneous()
-        self.settings       = issmsettings()
-        self.private        = private()
-        self.transitions    = []
-        self.eltransitions  = []
-        self.planet         = 'earth'
+    def setdefaultparameters(self):  # {{{
+        self.icecaps = []
+        self.earth = []
+        self.cluster = generic()
+        self.miscellaneous = miscellaneous()
+        self.settings = issmsettings()
+        self.private = private()
+        self.transitions = []
+        self.eltransitions = []
+        self.planet = 'earth'
     #}}}
 
     @staticmethod
-    def checkconsistency(slm, solutiontype): # {{{
+    def checkconsistency(slm, solutiontype):  # {{{
         # Is the coupler turned on?
         for i in range(len(slm.icecaps)):
@@ -107,6 +110,6 @@
     #}}}
 
-    def mergeresults(self): # {{{
-        champs = fieldnames(self.icecaps[i].results.TransientSolution)
+    def mergeresults(self):  # {{{
+        champs = fieldnames(self.icecaps[0].results.TransientSolution)
         for i in range(len(self.mergedcaps / 2)):
             md = self.mergedcaps[2 * i]
@@ -135,11 +138,11 @@
             self.mergedcaps[2 * i] = md
     #}}}
-    
-    def listcaps(self): # {{{
+
+    def listcaps(self):  # {{{
         for i in range(len(self.icecaps)):
             print('{}: {}'.format(i, self.icecaps[i].miscellaneous.name))
     #}}}
 
-    def continents(self): # {{{
+    def continents(self):  # {{{
         list = []
         for i in range(len(self.basins)):
@@ -148,5 +151,5 @@
     #}}}
 
-    def basinsfromcontinent(self, continent): # {{{
+    def basinsfromcontinent(self, continent):  # {{{
         list = []
         for i in range(len(self.icecaps)):
@@ -156,5 +159,5 @@
     #}}}
 
-    def addbasin(self, bas): # {{{
+    def addbasin(self, bas):  # {{{
         if bas.__class__.__name__ != 'basin':
             raise RuntimeError('addbasin method only takes a \'basin\' class object as input')
@@ -162,5 +165,5 @@
     #}}}
 
-    def intersections(self, *args): #{{{
+    def intersections(self, *args):  #{{{
         options = pairoptions(*args)
         force = options.getfieldvalue('force', 0)
@@ -181,5 +184,5 @@
 
             # For elements
-            zei = mdi.mesh.x[mdi.mesh.elements] * onesmatrix / 3
+            xei = mdi.mesh.x[mdi.mesh.elements] * onesmatrix / 3
             yei = mdi.mesh.y[mdi.mesh.elements] * onesmatrix / 3
             zei = mdi.mesh.z[mdi.mesh.elements] * onesmatrix / 3
@@ -191,5 +194,5 @@
     #}}}
 
-    def checkintersections(self): #{{{
+    def checkintersections(self):  #{{{
         flags = np.zeros(self.earth.mesh.numberofvertices, 1)
         for i in range(len(self.basins)):
@@ -198,10 +201,10 @@
     #}}}
 
-    def checkbasinconsistency(self): #{{{
+    def checkbasinconsistency(self):  #{{{
         for i in range(len(self.basins)):
             self.basins[i].checkconsistency()
     #}}}
 
-    def basinindx(self, *args): #{{{
+    def basinindx(self, *args):  #{{{
         options = pairoptions(*args)
         continent = options.getfieldvalue('continent', 'all')
@@ -218,7 +221,7 @@
                     continent = np.unique(continent)
                 else:
-                    pass # Nothing to do: assume we have a list of continents
+                    pass  # Nothing to do: assume we have a list of continents
             else:
-                pass # Nothing to do: assume we have a list of continents
+                pass  # Nothing to do: assume we have a list of continents
         else:
             if continent == 'all':
@@ -229,5 +232,5 @@
                 continent = np.unique(continent)
             else:
-                pass # Nothing to do: assume we have a list of continents
+                pass  # Nothing to do: assume we have a list of continents
         #}}}
 
@@ -278,6 +281,6 @@
     #}}}
 
-    def addicecap(self, md): #{{{
-        if not type(md) ==  model:
+    def addicecap(self, md):  #{{{
+        if not type(md) == model:
             raise Exception("addicecap method only takes a 'model' class object as input")
 
@@ -285,10 +288,10 @@
     #}}}
 
-    def basinsplot3d(self, *args): #{{{
+    def basinsplot3d(self, *args):  #{{{
         for i in range(len(self.basins)):
             self.basins[i].plot3d(*args)
     #}}}
 
-    def caticecaps(self, *args): #{{{
+    def caticecaps(self, *args):  #{{{
         # Recover options
         options = pairoptions(*args)
@@ -313,5 +316,5 @@
             for i in range(len(edges)):
                 ind1 = edges(i, 1)
-                ind1 = edges(i, 2)
+                ind2 = edges(i, 2)
                 plot3([md.mesh.x[ind1], md.mesh.x[ind2]], [md.mesh.y[ind1], md.mesh.y[ind2]], [md.mesh.z[ind1], md.mesh.z[ind2]], 'g*-')
 
@@ -323,5 +326,5 @@
     #}}}
 
-    def viscousiterations(self): #{{{
+    def viscousiterations(self):  #{{{
         for i in range(len(self.icecaps)):
             ic = self.icecaps[i]
@@ -332,5 +335,5 @@
     #}}}
 
-    def maxtimestep(self): #{{{
+    def maxtimestep(self):  #{{{
         for i in range(len(self.icecaps)):
             ic = self.icecaps[i]
@@ -343,8 +346,8 @@
         print("Earth: {}/{}", mvi, timei)
     #}}}
-    
-    def transfer(self, string): #{{{
+
+    def transfer(self, string):  #{{{
         # Recover field size in one icecap
-        n = np.size(getattr(self.icecaps[i], string), 0)
+        n = np.size(getattr(self.icecaps[0], string), 0)
 
         if n == self.icecaps[0].mesh.numberofvertices:
@@ -367,5 +370,5 @@
             # Initialize #{{{
             field = np.zeros((self.earth.mesh.numberofvertices + 1, nsteps))
-            field[-1, :] = times # Transfer the times only, not the values
+            field[-1, :] = times  # Transfer the times only, not the values
             #}}}
             # Transfer all the time fields #{{{
@@ -373,6 +376,6 @@
                 capfieldi = getattr(self.icecaps[i], string)
                 for j in range(nsteps):
-                    field[self.transitions[i], j] = capfieldi[0:-2, j] # Transfer only the values, not the time
-            setattr(self.earth, string, field) # Do not forget to plug the field variable into its final location
+                    field[self.transitions[i], j] = capfieldi[0:-2, j]  # Transfer only the values, not the time
+            setattr(self.earth, string, field)  # Do not forget to plug the field variable into its final location
             #}}}
         elif n == (self.icecaps[0].mesh.numberofelements):
@@ -384,10 +387,10 @@
     #}}}
 
-    def homogenize(self, noearth=0): #{{{
+    def homogenize(self, noearth=0):  #{{{
         mintimestep = np.inf
 
         for i in range(len(self.icecaps)):
             ic = self.icecaps[i]
-            mintimestep = np.min(mintimestep, len (ic.results.TransientSolution))
+            mintimestep = np.min(mintimestep, len(ic.results.TransientSolution))
 
         if not noearth:
@@ -409,5 +412,5 @@
     #}}}
 
-    def initializemodels(self): #{{{
+    def initializemodels(self):  #{{{
         for i in range(len(self.basins)):
             md = model()
