[13394] | 1 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/addnote.py
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/addnote.py (revision 12855)
|
---|
| 4 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/addnote.py (revision 12856)
|
---|
| 5 | @@ -1,29 +1,25 @@
|
---|
| 6 | -def addnote(md, string):
|
---|
| 7 | +def addnote(md,string):
|
---|
| 8 | + """
|
---|
| 9 | + ADDNOTE - add a note to the existing model notes field
|
---|
| 10 | +
|
---|
| 11 | + Usage:
|
---|
| 12 | + md=addnote(md,string);
|
---|
| 13 | +
|
---|
| 14 | + Example:
|
---|
| 15 | + md=addnote(md,'Pine Island, Geometry of 2007');
|
---|
| 16 | + """
|
---|
| 17 |
|
---|
| 18 | - # Local Variables: md, string, i, notes, miscellaneous, newnotes
|
---|
| 19 | - # Function calls: ischar, nargout, cell, nargin, length, addnote, error
|
---|
| 20 | - #ADDNOTE - add a note to the existing model notes field
|
---|
| 21 | - #
|
---|
| 22 | - # Usage:
|
---|
| 23 | - # md=addnote(md,string);
|
---|
| 24 | - #
|
---|
| 25 | - # Example:
|
---|
| 26 | - # md=addnote(md,'Pine Island, Geometry of 2007');
|
---|
| 27 | -
|
---|
| 28 | - if not isinstance(string,basetring):
|
---|
| 29 | - print 'addnote error message: second input argument should be a string'
|
---|
| 30 | - return []
|
---|
| 31 | -
|
---|
| 32 | - notes = md.miscellaneous.notes
|
---|
| 33 | -
|
---|
| 34 | - if isinstance(notes,basestring):
|
---|
| 35 | + if not isinstance(string,str):
|
---|
| 36 | + raise TypeError('addnote error message: second input argument should be a string')
|
---|
| 37 | +
|
---|
| 38 | + notes=md.miscellaneous.notes
|
---|
| 39 | +
|
---|
| 40 | + if isinstance(notes,str):
|
---|
| 41 | newnotes=[notes,string]
|
---|
| 42 | - else:
|
---|
| 43 | - newnotes=[];
|
---|
| 44 | - for i in range(len(notes)):
|
---|
| 45 | - newnotes=newnotes+notes[i]
|
---|
| 46 | -
|
---|
| 47 | - newnotes=newnotes+nodes;
|
---|
| 48 | -
|
---|
| 49 | - md.miscellaneous.notes = newnotes
|
---|
| 50 | - return md
|
---|
| 51 | + else:
|
---|
| 52 | + newnotes=notes.append(string)
|
---|
| 53 | +
|
---|
| 54 | + md.miscellaneous.notes=newnotes
|
---|
| 55 | +
|
---|
| 56 | + return md
|
---|
| 57 | +
|
---|