Changeset 4131
- Timestamp:
- 2013-10-25T11:21:52+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/TOOLS/OBSTOOLS/OOO/ooo/nml.py
r4129 r4131 24 24 >>> text = nml.update(namid, text, data) 25 25 >>> print text 26 <BLANKLINE>27 26 &namfoo 28 27 x = 1 2 3 29 28 / 29 <BLANKLINE> 30 30 31 31 In the above snippet :func:`tostring` has been used to sanitize the input … … 38 38 39 39 >>> print nml.new("namfoo", data={"x": range(3)}) 40 <BLANKLINE>41 40 &namfoo 42 41 x = 0 1 2 43 42 / 43 <BLANKLINE> 44 44 45 45 Parse existing namelist … … 133 133 >>> # new line join 134 134 >>> print "\\n".join([namoff, namcl4]) 135 <BLANKLINE>136 135 &namoff 137 136 / … … 139 138 &namcl4 140 139 / 140 <BLANKLINE> 141 141 142 142 >>> # Or addition 143 143 >>> print namoff + namcl4 144 <BLANKLINE>145 144 &namoff 146 145 / 147 146 &namcl4 148 147 / 148 <BLANKLINE> 149 149 150 150 Module functions … … 453 453 454 454 >>> new("namobs") 455 ' \\n&namobs\\n/'455 '&namobs\\n/\\n' 456 456 >>> print new("namobs") 457 <BLANKLINE>458 457 &namobs 459 458 / 459 <BLANKLINE> 460 460 461 461 :param namid: Name for the new namelist … … 468 468 :returns: string representation of a Fortran namelist 469 469 """ 470 text = " \n&{namid}\n/".format(namid=namid)470 text = "&{namid}\n/\n".format(namid=namid) 471 471 if data is not None: 472 472 text = update(namid, text, data, convert=convert)
Note: See TracChangeset
for help on using the changeset viewer.