Changeset 22843
- Timestamp:
- 06/15/18 07:10:11 (7 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/toolkits.py
r21049 r22843 80 80 81 81 #write header 82 fid.write("%s%s%s\n" % ('% Petsc options file: ',filename,' written from Matlabtoolkits array'))82 fid.write("%s%s%s\n" % ('%Toolkits options file: ',filename,' written from Python toolkits array')) 83 83 84 84 #start writing options … … 88 88 #first write analysis: 89 89 fid.write("\n+%s\n" % analysis) #append a + to recognize it's an analysis enum 90 91 90 #now, write options 92 91 for optionname,optionvalue in options.iteritems(): -
issm/trunk-jpl/src/m/io/loadvars.py
r21657 r22843 58 58 if whichdb(filename): 59 59 print "Loading variables from file '%s'." % filename 60 60 61 61 my_shelf = shelve.open(filename,'r') # 'r' for read-only 62 62 if nvdict: … … 167 167 elif vardim==2: 168 168 #dealling with dict 169 if varval.dtype==str: 170 Tree.__dict__[str(var)]=OrderedDict(zip(varval[:,0], varval[:,1])) 169 if varval.dtype==str: #that is for toolkits wich needs to be ordered 170 if any(varval[:,0]=='toolkit'): #toolkit definition have to be first 171 Tree.__dict__[str(var)]=OrderedDict([('toolkit', str(varval[np.where(varval[:,0]=='toolkit')[0][0],1]))]) 172 173 strings1=[str(arg[0]) for arg in varval if arg[0]!='toolkits'] 174 strings2=[str(arg[1]) for arg in varval if arg[0]!='toolkits'] 175 Tree.__dict__[str(var)].update(zip(strings1, strings2)) 171 176 else: 172 177 if type(Tree)==list:
Note:
See TracChangeset
for help on using the changeset viewer.