Changeset 12856
- Timestamp:
- 08/01/12 15:40:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/model/addnote.py
r12113 r12856 1 def addnote(md, string): 1 def addnote(md,string): 2 """ 3 ADDNOTE - add a note to the existing model notes field 4 5 Usage: 6 md=addnote(md,string); 7 8 Example: 9 md=addnote(md,'Pine Island, Geometry of 2007'); 10 """ 2 11 3 # Local Variables: md, string, i, notes, miscellaneous, newnotes 4 # Function calls: ischar, nargout, cell, nargin, length, addnote, error 5 #ADDNOTE - add a note to the existing model notes field 6 # 7 # Usage: 8 # md=addnote(md,string); 9 # 10 # Example: 11 # md=addnote(md,'Pine Island, Geometry of 2007'); 12 13 if not isinstance(string,basetring): 14 print 'addnote error message: second input argument should be a string' 15 return [] 16 17 notes = md.miscellaneous.notes 18 19 if isinstance(notes,basestring): 12 if not isinstance(string,str): 13 raise TypeError('addnote error message: second input argument should be a string') 14 15 notes=md.miscellaneous.notes 16 17 if isinstance(notes,str): 20 18 newnotes=[notes,string] 21 else: 22 newnotes=[]; 23 for i in range(len(notes)): 24 newnotes=newnotes+notes[i] 25 26 newnotes=newnotes+nodes; 27 28 md.miscellaneous.notes = newnotes 29 return md 19 else: 20 newnotes=notes.append(string) 21 22 md.miscellaneous.notes=newnotes 23 24 return md 25
Note:
See TracChangeset
for help on using the changeset viewer.