source: issm/oecreview/Archive/12678-13393/ISSM-12855-12856.diff@ 13394

Last change on this file since 13394 was 13394, checked in by Mathieu Morlighem, 13 years ago

Added 12678-13393

File size: 1.6 KB
  • u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/addnote.py

     
    1 def addnote(md, string):
     1def 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        """
    211
    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):
    2018                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 TracBrowser for help on using the repository browser.