Index: /issm/trunk-jpl/src/m/io/loadvars.py
===================================================================
--- /issm/trunk-jpl/src/m/io/loadvars.py	(revision 25477)
+++ /issm/trunk-jpl/src/m/io/loadvars.py	(revision 25478)
@@ -5,10 +5,8 @@
 except ImportError:
     from whichdb import whichdb # Python 2
-from re import findall
+from re import findall, split
 import shelve
-
 from netCDF4 import Dataset
 import numpy as np
-
 from model import *
 
@@ -95,6 +93,6 @@
                 curclass = NCFile.groups[classtree[mod][0]].groups[classtree[mod][1]]
                 if debug:
-                    print("now checking {} for list : {}".format(mod, classtype[mod][0] == 'list' or (classtype[mod][0] == 'results' and 'Time' in NCFile.dimensions)))
-                if classtype[mod][0] == 'list' or (classtype[mod][0] == 'results' and 'Time' in NCFile.dimensions):  #We have a list of variables
+                    print("===> {} is of class {}".format(mod, classtype[mod][0]))
+                if classtype[mod][0] == 'results' and 'Time' in NCFile.dimensions:  #Treating results
                     keylist = [key for key in curclass.groups]
                     # this is related to the old structure of NC files where every steps of results had its own group
@@ -123,10 +121,9 @@
                         #that is the current treatment
                         #here we have a more NC approach with time being a dimension
-                        keylist = [key for key in curclass.variables]
-                        dimlist = [curclass.variables[key].dimensions for key in keylist]
-                        indexlist = np.arange(0, len(NCFile.dimensions['Time']))
-                        AllHaveTime = np.all(['Time' in dimtuple for dimtuple in dimlist])
                         listtype = curclass.classtype
-                        if AllHaveTime:
+                        if len(NCFile.dimensions['Time']) == 1:
+                            nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = getattr(__import__(listtype), listtype)()
+                            Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]]
+                        else:
                             #Time dimension is in all the variables so we take that as stepnumber for the results
                             if onlylast:   #we load only the last result to save on time and memory
@@ -136,12 +133,14 @@
                                 nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = [getattr(__import__(listtype), listtype)() for i in range(max(1, len(NCFile.dimensions['Time'])))]
                                 Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]][:]
-                        elif len(NCFile.dimensions['Time']) == 1:
-                            nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = getattr(__import__(listtype), listtype)()
-                            Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]]
-                        else:
-
-                            print("ERROR: Time dimension is not in all results. That has been overlooked for now but your resulat are not saved.")
+
+                elif classtype[mod][0] == 'massfluxatgate':  #this is for output definitions
+                    defname = split('Output|[0-9]+', classtree[mod][1])[1] + 's'
+                    defindex = int(findall('[0-9]+', classtree[mod][1])[0])
+                    nvdict['md'].__dict__[classtree[mod][0]].__dict__[defname].append(getattr(classtype[mod][1], classtype[mod][0])())
+                    Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[defname][defindex - 1]
 
                 else:
+                    if debug:
+                        print("Using the default for md.{}.{}, is that right??".format(classtree[mod][0], classtree[mod][1]))
                     nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = getattr(classtype[mod][1], classtype[mod][0])()
                     Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]]
@@ -180,4 +179,11 @@
                                     print('table dimension greater than 3 not implemented yet')
                             else:
+                                incomplete = 'Time' not in varval.dimensions
+                                if incomplete:
+                                    chosendim = varval.dimensions[0]
+                                    indexlist = np.arange(0, len(NCFile.dimensions[chosendim]))
+                                    print('WARNING, {} is not present on every times, we chose {}({}) as the dimension to write it with'.format(var, chosendim, len(NCFile.dimensions[chosendim])))
+                                else:
+                                    indexlist = np.arange(0, len(NCFile.dimensions['Time']))
                                 for t in indexlist:
                                     if vardim == 0:
@@ -266,17 +272,22 @@
                 #==== And with atribute {{{
                 for attr in listclass.ncattrs():
+                    if debug:
+                        print("treating attribute {}".format(attr))
                     if attr != 'classtype':  #classtype is for treatment, don't get it back
+                        attribute = str(attr).swapcase()  #there is a reason for swapcase, no sure what it isanymore
+                        if attr == 'VARNAME':
+                            attribute = 'name'
                         if type(Tree) == list:
                             t = int(indexlist[i])
                             if listtype == 'dict':
-                                Tree[t][str(attr).swapcase()] = str(listclass.getncattr(attr))
-                            else:
-                                Tree[t].__dict__[str(attr).swapcase()] = str(listclass.getncattr(attr))
+                                Tree[t][attribute] = str(listclass.getncattr(attr))
+                            else:
+                                Tree[t].__dict__[attribute] = str(listclass.getncattr(attr))
                         else:
-                            Tree.__dict__[str(attr).swapcase()] = str(listclass.getncattr(attr))
+                            Tree.__dict__[attribute] = str(listclass.getncattr(attr))
                             if listclass.getncattr(attr) == 'True':
-                                Tree.__dict__[str(attr).swapcase()] = True
+                                Tree.__dict__[attribute] = True
                             elif listclass.getncattr(attr) == 'False':
-                                Tree.__dict__[str(attr).swapcase()] = False
+                                Tree.__dict__[attribute] = False
                 # }}}
             # }}}
