<p><b>dwj07@fsu.edu</b> 2013-02-07 10:03:30 -0700 (Thu, 07 Feb 2013)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding a python scripts tools directory.<br>
<br>
        This commit addes a namelist generation script that produces a default namelist file.<br>
</p><hr noshade><pre><font color="gray">Added: branches/tools/python_scripts/namelist_generation/README
===================================================================
--- branches/tools/python_scripts/namelist_generation/README         (rev 0)
+++ branches/tools/python_scripts/namelist_generation/README        2013-02-07 17:03:30 UTC (rev 2456)
@@ -0,0 +1,22 @@
+Author: Doug Jacobsen
+Date: 02/07/13
+
+About:
+        This script (generate_namelist.py) is intended to take as input a Registry
+        file within MPAS, and genereate a "default" namelist based on the options
+        defined in the Registry file. It does not require a specific core, or
+        Registry file.
+
+
+        It can be run by calling it with
+                ./generate_namelist.py -f path/to/Registry
+
+        On output, it generates namelist.input.generated.
+
+        In order for the namelist file to be valid for a simulation, the Registry
+        file needs to have properly defined namelist options.
+
+        This means all strings need to be delimited with single quotes within the
+        Registry file, and boolean values need to be delimited with periods as in
+        .true.
+
Added: branches/tools/python_scripts/namelist_generation/generate_namelist.py
===================================================================
--- branches/tools/python_scripts/namelist_generation/generate_namelist.py         (rev 0)
+++ branches/tools/python_scripts/namelist_generation/generate_namelist.py        2013-02-07 17:03:30 UTC (rev 2456)
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+from collections import defaultdict
+from optparse import OptionParser
+
+parser = OptionParser()
+parser.add_option("-f", "--file", dest="registry_path", help="Path to Registry file", metavar="FILE")
+
+options, args = parser.parse_args()
+
+if not options.registry_path:
+        parser.error("Registry file is required")
+
+registry_path = options.registry_path
+
+registry = open(registry_path, 'r')
+namelist = open('namelist.input.generated', 'w+')
+
+groups = list()
+params = defaultdict(list)
+values = defaultdict(list)
+last_group = ''
+
+for block in iter(lambda: registry.readline(), ""):
+        if block[0] != '%' and len(block) > 1:
+                block_arr = block.split()
+                if block_arr[0] == 'namelist':
+                        if block_arr[2] != last_group:
+                                last_group = block_arr[2]
+                                groups.append(block_arr[2])
+                        params[block_arr[2]].append(block_arr[3])
+                        values[block_arr[3]].append(block_arr[4])
+
+for group in groups:
+        namelist.write('&%s</font>
<font color="blue">'%group)
+        for param in params[group]:
+                value = values[param][0]
+                namelist.write('\t%s = %s</font>
<font color="blue">'%(param,value))
+        namelist.write('/</font>
<font color="blue">')
+
Property changes on: branches/tools/python_scripts/namelist_generation/generate_namelist.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
</font>
</pre>