<p><b>dwj07@fsu.edu</b> 2013-04-15 12:02:18 -0600 (Mon, 15 Apr 2013)</p><p>        <br>
        -- BRANCH COMMIT --<br>
<br>
        Fixing parsing issues with var_arrays<br>
        Fixing an issue with version string.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/tools/python_scripts/namelist_generation/parse_xml_registry.py
===================================================================
--- branches/tools/python_scripts/namelist_generation/parse_xml_registry.py        2013-04-15 17:43:49 UTC (rev 2750)
+++ branches/tools/python_scripts/namelist_generation/parse_xml_registry.py        2013-04-15 18:02:18 UTC (rev 2751)
@@ -50,7 +50,7 @@
 try:
         version_string = registry.attrib['version']
 except:
-        version_string = latex_missing_string
+        version_string = '{\\bf MISSING}'
 latex.write('\</font>
<font color="black">ewcommand{\\version}{%s}</font>
<font color="gray">'%version_string)
 latex.close()
 
@@ -286,9 +286,40 @@
         latex.write('        %s \\\\</font>
<font color="black">'%variable_table_header)
         latex.write('        \hline</font>
<font color="red">')
 
-        # Extract variables from variable arrays
-        for var_arr in var_struct.iter(&quot;var_array&quot;):
-                for var in var_arr.iter(&quot;var&quot;):
+        for node in var_struct.getchildren():
+                if node.tag == 'var_array':
+                        for var in node.iter(&quot;var&quot;):
+                                var_name = var.attrib['name']
+                                var_description = var.attrib['description']
+
+                                if var_description == &quot;&quot;:
+                                        var_description = latex_missing_string.replace('_','\_')
+                                else:
+                                        equations = var_description.find('$')
+                                        if equations != -1:
+                                                var_desc_split = var_description.split(&quot;$&quot;)
+
+                                                if var_description.replace('_','')[0] == &quot;$&quot;:
+                                                        replace = False
+                                                        var_description = &quot;$&quot;
+                                                else:
+                                                        replace = True
+                                                        var_description = &quot;&quot;
+
+                                                for part in var_desc_split:
+                                                        if replace:
+                                                                var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                                replace = False
+                                                        else:
+                                                                var_description = &quot;%s $%s$&quot;%(var_description, part)
+                                                                replace = True
+                                        else:
+                                                var_description = &quot;%s&quot;%var_description.replace('_','\_')
+
+                                latex.write('        \hyperref[subsec:var_sec_%s_%s]{%s} &amp; %s \\\\</font>
<font color="blue">'%(struct_name, var_name, var_name.replace('_','\_'), var_description))
+                                latex.write('        \hline</font>
<font color="gray">')
+                elif node.tag == 'var':
+                        var = node
                         var_name = var.attrib['name']
                         var_description = var.attrib['description']
 
@@ -319,39 +350,6 @@
                         latex.write('        \hyperref[subsec:var_sec_%s_%s]{%s} &amp; %s \\\\</font>
<font color="black">'%(struct_name, var_name, var_name.replace('_','\_'), var_description))
                         latex.write('        \hline</font>
<font color="red">')
 
-
-        # Parse normal variables
-        for var in var_struct.iter(&quot;var&quot;):
-                var_name = var.attrib['name']
-                var_description = var.attrib['description']
-
-                if var_description == &quot;&quot;:
-                        var_description = latex_missing_string.replace('_','\_')
-                else:
-                        equations = var_description.find('$')
-                        if equations != -1:
-                                var_desc_split = var_description.split(&quot;$&quot;)
-
-                                if var_description.replace('_','')[0] == &quot;$&quot;:
-                                        replace = False
-                                        var_description = &quot;$&quot;
-                                else:
-                                        replace = True
-                                        var_description = &quot;&quot;
-
-                                for part in var_desc_split:
-                                        if replace:
-                                                var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
-                                                replace = False
-                                        else:
-                                                var_description = &quot;%s $%s$&quot;%(var_description, part)
-                                                replace = True
-                        else:
-                                var_description = &quot;%s&quot;%var_description.replace('_','\_')
-
-                latex.write('        \hyperref[subsec:var_sec_%s_%s]{%s} &amp; %s \\\\</font>
<font color="red">'%(struct_name, var_name, var_name.replace('_','\_'), var_description))
-                latex.write('        \hline</font>
<font color="red">')
-
         latex.write('\end{longtable}</font>
<font color="black">')
         latex.write('\end{center}</font>
<font color="black">')
         latex.write('}</font>
<font color="gray">')
@@ -367,194 +365,382 @@
         struct_time_levs = var_struct.attrib['time_levs']
         latex.write('\section[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="black">'%(struct_name.replace('_','\_'),struct_name, struct_name.replace('_','\_')))
         latex.write('\label{sec:var_sec_%s}</font>
<font color="red">'%struct_name)
+        
+        for node in var_struct.getchildren():
+                if node.tag == 'var_array':
+                        var_arr = node
+                        for var in var_arr.iter(&quot;var&quot;):
+                                var_arr_name = var_arr.attrib['name']
+                                var_arr_type = var_arr.attrib['type']
+                                var_arr_dims = var_arr.attrib['dimensions']
 
-        # Extract variables from variable arrays
-        for var_arr in var_struct.iter(&quot;var_array&quot;):
-                for var in var_arr.iter(&quot;var&quot;):
-                        var_arr_name = var_arr.attrib['name']
-                        var_arr_type = var_arr.attrib['type']
-                        var_arr_dims = var_arr.attrib['dimensions']
+                                var_name = var.attrib['name']
+                                var_arr_group = var.attrib['array_group']
 
-                        var_name = var.attrib['name']
-                        var_arr_group = var.attrib['array_group']
+                                try:
+                                        var_persistence = var_arr.attrib['persistence']
+                                except:
+                                        var_persistence = 'persistent'
 
-                        try:
-                                var_persistence = var_arr.attrib['persistence']
-                        except:
-                                var_persistence = 'persistent'
+                                try:
+                                        var_name_in_code = var.attrib['name_in_code']
+                                except:
+                                        var_name_in_code = var_name
 
-                        try:
-                                var_name_in_code = var.attrib['name_in_code']
-                        except:
-                                var_name_in_code = var_name
-
-                        try:
-                                var_units = var.attrib['units']
-                                if var_units == &quot;&quot;:
+                                try:
+                                        var_units = var.attrib['units']
+                                        if var_units == &quot;&quot;:
+                                                var_units = latex_missing_string
+                                        else:
+                                                var_units = &quot;$%s$&quot;%var_units.replace(' ', '$ $')
+                                except:
                                         var_units = latex_missing_string
-                                else:
-                                        var_units = &quot;$%s$&quot;%var_units.replace(' ', '$ $')
-                        except:
-                                var_units = latex_missing_string
 
-                        try:
-                                var_description = var.attrib['description']
-                        except:
-                                var_description = latex_missing_string.replace('_','\_')
+                                try:
+                                        var_description = var.attrib['description']
+                                except:
+                                        var_description = latex_missing_string.replace('_','\_')
 
-                        try:
-                                var_streams = var.attrib['streams'].replace('s','Sfc ').replace('i','Input ').replace('r', 'Restart ').replace('o','Output ')
-                        except:
-                                var_streams = &quot;None&quot;
+                                try:
+                                        var_streams = var.attrib['streams'].replace('s','Sfc ').replace('i','Input ').replace('r', 'Restart ').replace('o','Output ')
+                                except:
+                                        var_streams = &quot;None&quot;
 
-                        if int(struct_time_levs) &gt; 1:
-                                var_index = &quot;domain %% blocklist %% %s %% index_%s&quot;%(struct_name, var_name_in_code)
-                                var_path = &quot;domain %% blocklist %% %s %% time_levs(:) %% %s %% %s&quot;%(struct_name, struct_name, var_arr_name)
-                        else:
-                                var_index = &quot;domain %% blocklist %% %s %% index_%s&quot;%(struct_name, var_name_in_code)
-                                var_path = &quot;domain %% blocklist %% %s %% %s&quot;%(struct_name, var_arr_name)
+                                if int(struct_time_levs) &gt; 1:
+                                        var_index = &quot;domain %% blocklist %% %s %% index_%s&quot;%(struct_name, var_name_in_code)
+                                        var_path = &quot;domain %% blocklist %% %s %% time_levs(:) %% %s %% %s&quot;%(struct_name, struct_name, var_arr_name)
+                                else:
+                                        var_index = &quot;domain %% blocklist %% %s %% index_%s&quot;%(struct_name, var_name_in_code)
+                                        var_path = &quot;domain %% blocklist %% %s %% %s&quot;%(struct_name, var_arr_name)
 
-                        if var_description == &quot;&quot;:
-                                var_description = latex_missing_string.replace('_','\_')
-                        else:
-                                equations = var_description.find('$')
-                                if equations != -1:
-                                        var_desc_split = var_description.split(&quot;$&quot;)
+                                if var_description == &quot;&quot;:
+                                        var_description = latex_missing_string.replace('_','\_')
+                                else:
+                                        equations = var_description.find('$')
+                                        if equations != -1:
+                                                var_desc_split = var_description.split(&quot;$&quot;)
 
-                                        if var_description.replace('_','')[0] == &quot;$&quot;:
-                                                replace = False
-                                                var_description = &quot;$&quot;
-                                        else:
-                                                replace = True
-                                                var_description = &quot;&quot;
-
-                                        for part in var_desc_split:
-                                                if replace:
-                                                        var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                if var_description.replace('_','')[0] == &quot;$&quot;:
                                                         replace = False
+                                                        var_description = &quot;$&quot;
                                                 else:
-                                                        var_description = &quot;%s $%s$&quot;%(var_description, part)
                                                         replace = True
-                                else:
-                                        var_description = &quot;%s&quot;%var_description.replace('_','\_')
+                                                        var_description = &quot;&quot;
 
-                        
-                        latex.write('\subsection[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="red">'%(var_name.replace('_','\_'),struct_name, var_name.replace('_','\_')))
-                        latex.write('\label{subsec:var_sec_%s_%s}</font>
<font color="red">'%(struct_name,var_name))
-                        # Tabular Format:
-                        latex.write('\\begin{center}</font>
<font color="red">')
-                        latex.write('\\begin{longtable}{| p{2.0in} | p{4.0in} |}</font>
<font color="red">')
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('        Type: &amp; %s \\\\</font>
<font color="red">'%var_arr_type)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('        Units: &amp; %s \\\\</font>
<font color="red">'%var_units)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('        Dimension: &amp; %s \\\\</font>
<font color="red">'%var_arr_dims)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('        Persistence: &amp; %s \\\\</font>
<font color="red">'%var_persistence)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('                 Default Streams: &amp; %s \\\\</font>
<font color="red">'%var_streams)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('                 Index in %s Array: &amp; %s \\\\</font>
<font color="red">'%(var_arr_name.replace('_','\_'), var_index.replace('_','\_').replace('%','\%')))
-                        latex.write('                 \hline </font>
<font color="red">')
-                        latex.write('                 Location in code: &amp; %s \\\\</font>
<font color="red">'%var_path.replace('_','\_').replace('%','\%'))
-                        latex.write('                 \hline </font>
<font color="red">')
-                        latex.write('                 Array Group: &amp; %s \\\\</font>
<font color="red">'%var_arr_group)
-                        latex.write('                 \hline </font>
<font color="red">')
-                        latex.write('    \caption{%s: %s}</font>
<font color="red">'%(var_name.replace('_','\_'),var_description))
-                        latex.write('\end{longtable}</font>
<font color="red">')
-                        latex.write('\end{center}</font>
<font color="red">')
+                                                for part in var_desc_split:
+                                                        if replace:
+                                                                var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                                replace = False
+                                                        else:
+                                                                var_description = &quot;%s $%s$&quot;%(var_description, part)
+                                                                replace = True
+                                        else:
+                                                var_description = &quot;%s&quot;%var_description.replace('_','\_')
 
-        # Parse variables not in variable arrays
-        for var in var_struct.iter(&quot;var&quot;):
-                try:
-                        # Skip super array variables. They have different tables.
-                        var_arr_group = var.attrib['array_group']
-                except:
-                        var_name = var.attrib['name']
-                        var_type = var.attrib['type']
-                        var_dims = var.attrib['dimensions']
-
+                                
+                                latex.write('\subsection[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="blue">'%(var_name.replace('_','\_'),struct_name, var_name.replace('_','\_')))
+                                latex.write('\label{subsec:var_sec_%s_%s}</font>
<font color="blue">'%(struct_name,var_name))
+                                # Tabular Format:
+                                latex.write('\\begin{center}</font>
<font color="blue">')
+                                latex.write('\\begin{longtable}{| p{2.0in} | p{4.0in} |}</font>
<font color="blue">')
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('        Type: &amp; %s \\\\</font>
<font color="blue">'%var_arr_type)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('        Units: &amp; %s \\\\</font>
<font color="blue">'%var_units)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('        Dimension: &amp; %s \\\\</font>
<font color="blue">'%var_arr_dims)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('        Persistence: &amp; %s \\\\</font>
<font color="blue">'%var_persistence)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('                 Default Streams: &amp; %s \\\\</font>
<font color="blue">'%var_streams)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('                 Index in %s Array: &amp; %s \\\\</font>
<font color="blue">'%(var_arr_name.replace('_','\_'), var_index.replace('_','\_').replace('%','\%')))
+                                latex.write('                 \hline </font>
<font color="blue">')
+                                latex.write('                 Location in code: &amp; %s \\\\</font>
<font color="blue">'%var_path.replace('_','\_').replace('%','\%'))
+                                latex.write('                 \hline </font>
<font color="blue">')
+                                latex.write('                 Array Group: &amp; %s \\\\</font>
<font color="blue">'%var_arr_group)
+                                latex.write('                 \hline </font>
<font color="blue">')
+                                latex.write('    \caption{%s: %s}</font>
<font color="blue">'%(var_name.replace('_','\_'),var_description))
+                                latex.write('\end{longtable}</font>
<font color="blue">')
+                                latex.write('\end{center}</font>
<font color="red">')
+                elif node.tag == 'var':
+                        var = node
                         try:
-                                var_persistence = var_arr.attrib['persistence']
+                                # Skip super array variables. They have different tables.
+                                var_arr_group = var.attrib['array_group']
                         except:
-                                var_persistence = 'persistent'
+                                var_name = var.attrib['name']
+                                var_type = var.attrib['type']
+                                var_dims = var.attrib['dimensions']
 
-                        try:
-                                var_name_in_code = var.attrib['name_in_code']
-                        except:
-                                var_name_in_code = var_name
+                                try:
+                                        var_persistence = var_arr.attrib['persistence']
+                                except:
+                                        var_persistence = 'persistent'
 
-                        try:
-                                var_units = var.attrib['units']
-                                if var_units == &quot;&quot;:
+                                try:
+                                        var_name_in_code = var.attrib['name_in_code']
+                                except:
+                                        var_name_in_code = var_name
+
+                                try:
+                                        var_units = var.attrib['units']
+                                        if var_units == &quot;&quot;:
+                                                var_units = latex_missing_string
+                                        else:
+                                                var_units = &quot;$%s$&quot;%var_units.replace(' ', '$ $')
+                                except:
                                         var_units = latex_missing_string
-                                else:
-                                        var_units = &quot;$%s$&quot;%var_units.replace(' ', '$ $')
-                        except:
-                                var_units = latex_missing_string
 
-                        try:
-                                var_description = var.attrib['description']
-                        except:
-                                var_description = latex_missing_string.replace('_','\_')
+                                try:
+                                        var_description = var.attrib['description']
+                                except:
+                                        var_description = latex_missing_string.replace('_','\_')
 
-                        try:
-                                var_streams = var.attrib['streams'].replace('s','Sfc ').replace('i','Input ').replace('r', 'Restart ').replace('o','Output ')
-                        except:
-                                var_streams = &quot;None&quot;
+                                try:
+                                        var_streams = var.attrib['streams'].replace('s','Sfc ').replace('i','Input ').replace('r', 'Restart ').replace('o','Output ')
+                                except:
+                                        var_streams = &quot;None&quot;
 
-                        if int(struct_time_levs) &gt; 1:
-                                var_path = &quot;domain %% blocklist %% %s %% time_levs(:) %% %s %% %s&quot;%(struct_name, struct_name, var_name_in_code)
-                        else:
-                                var_path = &quot;domain %% blocklist %% %s %% %s&quot;%(struct_name, var_name_in_code)
+                                if int(struct_time_levs) &gt; 1:
+                                        var_path = &quot;domain %% blocklist %% %s %% time_levs(:) %% %s %% %s&quot;%(struct_name, struct_name, var_name_in_code)
+                                else:
+                                        var_path = &quot;domain %% blocklist %% %s %% %s&quot;%(struct_name, var_name_in_code)
 
-                        if var_description == &quot;&quot;:
-                                var_description = latex_missing_string.replace('_','\_')
-                        else:
-                                equations = var_description.find('$')
-                                if equations != -1:
-                                        var_desc_split = var_description.split(&quot;$&quot;)
+                                if var_description == &quot;&quot;:
+                                        var_description = latex_missing_string.replace('_','\_')
+                                else:
+                                        equations = var_description.find('$')
+                                        if equations != -1:
+                                                var_desc_split = var_description.split(&quot;$&quot;)
 
-                                        if var_description.replace('_','')[0] == &quot;$&quot;:
-                                                replace = False
-                                                var_description = &quot;$&quot;
-                                        else:
-                                                replace = True
-                                                var_description = &quot;&quot;
-
-                                        for part in var_desc_split:
-                                                if replace:
-                                                        var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                if var_description.replace('_','')[0] == &quot;$&quot;:
                                                         replace = False
+                                                        var_description = &quot;$&quot;
                                                 else:
-                                                        var_description = &quot;%s $%s$&quot;%(var_description, part)
                                                         replace = True
-                                else:
-                                        var_description = &quot;%s&quot;%var_description.replace('_','\_')
+                                                        var_description = &quot;&quot;
 
-                        
-                        latex.write('\subsection[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="red">'%(var_name.replace('_','\_'),struct_name, var_name.replace('_','\_')))
-                        latex.write('\label{subsec:var_sec_%s_%s}</font>
<font color="red">'%(struct_name,var_name))
-                        # Tabular Format:
-                        latex.write('\\begin{center}</font>
<font color="red">')
-                        latex.write('\\begin{longtable}{| p{2.0in} | p{4.0in} |}</font>
<font color="red">')
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('        Type: &amp; %s \\\\</font>
<font color="red">'%var_type)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('        Units: &amp; %s \\\\</font>
<font color="red">'%var_units)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('        Dimension: &amp; %s \\\\</font>
<font color="red">'%var_dims)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('        Persistence: &amp; %s \\\\</font>
<font color="red">'%var_persistence)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('                 Default Streams: &amp; %s \\\\</font>
<font color="red">'%var_streams)
-                        latex.write('        \hline </font>
<font color="red">')
-                        latex.write('                 Location in code: &amp; %s \\\\</font>
<font color="red">'%var_path.replace('_','\_').replace('%','\%'))
-                        latex.write('                 \hline </font>
<font color="red">')
-                        latex.write('    \caption{%s: %s}</font>
<font color="red">'%(var_name.replace('_','\_'),var_description))
-                        latex.write('\end{longtable}</font>
<font color="red">')
-                        latex.write('\end{center}</font>
<font color="blue">')
+                                                for part in var_desc_split:
+                                                        if replace:
+                                                                var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                                replace = False
+                                                        else:
+                                                                var_description = &quot;%s $%s$&quot;%(var_description, part)
+                                                                replace = True
+                                        else:
+                                                var_description = &quot;%s&quot;%var_description.replace('_','\_')
+
+                                
+                                latex.write('\subsection[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="blue">'%(var_name.replace('_','\_'),struct_name, var_name.replace('_','\_')))
+                                latex.write('\label{subsec:var_sec_%s_%s}</font>
<font color="blue">'%(struct_name,var_name))
+                                # Tabular Format:
+                                latex.write('\\begin{center}</font>
<font color="blue">')
+                                latex.write('\\begin{longtable}{| p{2.0in} | p{4.0in} |}</font>
<font color="blue">')
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('        Type: &amp; %s \\\\</font>
<font color="blue">'%var_type)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('        Units: &amp; %s \\\\</font>
<font color="blue">'%var_units)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('        Dimension: &amp; %s \\\\</font>
<font color="blue">'%var_dims)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('        Persistence: &amp; %s \\\\</font>
<font color="blue">'%var_persistence)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('                 Default Streams: &amp; %s \\\\</font>
<font color="blue">'%var_streams)
+                                latex.write('        \hline </font>
<font color="blue">')
+                                latex.write('                 Location in code: &amp; %s \\\\</font>
<font color="blue">'%var_path.replace('_','\_').replace('%','\%'))
+                                latex.write('                 \hline </font>
<font color="blue">')
+                                latex.write('    \caption{%s: %s}</font>
<font color="blue">'%(var_name.replace('_','\_'),var_description))
+                                latex.write('\end{longtable}</font>
<font color="blue">')
+                                latex.write('\end{center}</font>
<font color="blue">')
+
+#        # Extract variables from variable arrays
+#        for var_arr in var_struct.iter(&quot;var_array&quot;):
+#                for var in var_arr.iter(&quot;var&quot;):
+#                        var_arr_name = var_arr.attrib['name']
+#                        var_arr_type = var_arr.attrib['type']
+#                        var_arr_dims = var_arr.attrib['dimensions']
+#
+#                        var_name = var.attrib['name']
+#                        var_arr_group = var.attrib['array_group']
+#
+#                        try:
+#                                var_persistence = var_arr.attrib['persistence']
+#                        except:
+#                                var_persistence = 'persistent'
+#
+#                        try:
+#                                var_name_in_code = var.attrib['name_in_code']
+#                        except:
+#                                var_name_in_code = var_name
+#
+#                        try:
+#                                var_units = var.attrib['units']
+#                                if var_units == &quot;&quot;:
+#                                        var_units = latex_missing_string
+#                                else:
+#                                        var_units = &quot;$%s$&quot;%var_units.replace(' ', '$ $')
+#                        except:
+#                                var_units = latex_missing_string
+#
+#                        try:
+#                                var_description = var.attrib['description']
+#                        except:
+#                                var_description = latex_missing_string.replace('_','\_')
+#
+#                        try:
+#                                var_streams = var.attrib['streams'].replace('s','Sfc ').replace('i','Input ').replace('r', 'Restart ').replace('o','Output ')
+#                        except:
+#                                var_streams = &quot;None&quot;
+#
+#                        if int(struct_time_levs) &gt; 1:
+#                                var_index = &quot;domain %% blocklist %% %s %% index_%s&quot;%(struct_name, var_name_in_code)
+#                                var_path = &quot;domain %% blocklist %% %s %% time_levs(:) %% %s %% %s&quot;%(struct_name, struct_name, var_arr_name)
+#                        else:
+#                                var_index = &quot;domain %% blocklist %% %s %% index_%s&quot;%(struct_name, var_name_in_code)
+#                                var_path = &quot;domain %% blocklist %% %s %% %s&quot;%(struct_name, var_arr_name)
+#
+#                        if var_description == &quot;&quot;:
+#                                var_description = latex_missing_string.replace('_','\_')
+#                        else:
+#                                equations = var_description.find('$')
+#                                if equations != -1:
+#                                        var_desc_split = var_description.split(&quot;$&quot;)
+#
+#                                        if var_description.replace('_','')[0] == &quot;$&quot;:
+#                                                replace = False
+#                                                var_description = &quot;$&quot;
+#                                        else:
+#                                                replace = True
+#                                                var_description = &quot;&quot;
+#
+#                                        for part in var_desc_split:
+#                                                if replace:
+#                                                        var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+#                                                        replace = False
+#                                                else:
+#                                                        var_description = &quot;%s $%s$&quot;%(var_description, part)
+#                                                        replace = True
+#                                else:
+#                                        var_description = &quot;%s&quot;%var_description.replace('_','\_')
+#
+#                        
+#                        latex.write('\subsection[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="blue">'%(var_name.replace('_','\_'),struct_name, var_name.replace('_','\_')))
+#                        latex.write('\label{subsec:var_sec_%s_%s}</font>
<font color="blue">'%(struct_name,var_name))
+#                        # Tabular Format:
+#                        latex.write('\\begin{center}</font>
<font color="blue">')
+#                        latex.write('\\begin{longtable}{| p{2.0in} | p{4.0in} |}</font>
<font color="blue">')
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('        Type: &amp; %s \\\\</font>
<font color="blue">'%var_arr_type)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('        Units: &amp; %s \\\\</font>
<font color="blue">'%var_units)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('        Dimension: &amp; %s \\\\</font>
<font color="blue">'%var_arr_dims)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('        Persistence: &amp; %s \\\\</font>
<font color="blue">'%var_persistence)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('                 Default Streams: &amp; %s \\\\</font>
<font color="blue">'%var_streams)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('                 Index in %s Array: &amp; %s \\\\</font>
<font color="blue">'%(var_arr_name.replace('_','\_'), var_index.replace('_','\_').replace('%','\%')))
+#                        latex.write('                 \hline </font>
<font color="blue">')
+#                        latex.write('                 Location in code: &amp; %s \\\\</font>
<font color="blue">'%var_path.replace('_','\_').replace('%','\%'))
+#                        latex.write('                 \hline </font>
<font color="blue">')
+#                        latex.write('                 Array Group: &amp; %s \\\\</font>
<font color="blue">'%var_arr_group)
+#                        latex.write('                 \hline </font>
<font color="blue">')
+#                        latex.write('    \caption{%s: %s}</font>
<font color="blue">'%(var_name.replace('_','\_'),var_description))
+#                        latex.write('\end{longtable}</font>
<font color="blue">')
+#                        latex.write('\end{center}</font>
<font color="blue">')
+#
+#        # Parse variables not in variable arrays
+#        for var in var_struct.iter(&quot;var&quot;):
+#                try:
+#                        # Skip super array variables. They have different tables.
+#                        var_arr_group = var.attrib['array_group']
+#                except:
+#                        var_name = var.attrib['name']
+#                        var_type = var.attrib['type']
+#                        var_dims = var.attrib['dimensions']
+#
+#                        try:
+#                                var_persistence = var_arr.attrib['persistence']
+#                        except:
+#                                var_persistence = 'persistent'
+#
+#                        try:
+#                                var_name_in_code = var.attrib['name_in_code']
+#                        except:
+#                                var_name_in_code = var_name
+#
+#                        try:
+#                                var_units = var.attrib['units']
+#                                if var_units == &quot;&quot;:
+#                                        var_units = latex_missing_string
+#                                else:
+#                                        var_units = &quot;$%s$&quot;%var_units.replace(' ', '$ $')
+#                        except:
+#                                var_units = latex_missing_string
+#
+#                        try:
+#                                var_description = var.attrib['description']
+#                        except:
+#                                var_description = latex_missing_string.replace('_','\_')
+#
+#                        try:
+#                                var_streams = var.attrib['streams'].replace('s','Sfc ').replace('i','Input ').replace('r', 'Restart ').replace('o','Output ')
+#                        except:
+#                                var_streams = &quot;None&quot;
+#
+#                        if int(struct_time_levs) &gt; 1:
+#                                var_path = &quot;domain %% blocklist %% %s %% time_levs(:) %% %s %% %s&quot;%(struct_name, struct_name, var_name_in_code)
+#                        else:
+#                                var_path = &quot;domain %% blocklist %% %s %% %s&quot;%(struct_name, var_name_in_code)
+#
+#                        if var_description == &quot;&quot;:
+#                                var_description = latex_missing_string.replace('_','\_')
+#                        else:
+#                                equations = var_description.find('$')
+#                                if equations != -1:
+#                                        var_desc_split = var_description.split(&quot;$&quot;)
+#
+#                                        if var_description.replace('_','')[0] == &quot;$&quot;:
+#                                                replace = False
+#                                                var_description = &quot;$&quot;
+#                                        else:
+#                                                replace = True
+#                                                var_description = &quot;&quot;
+#
+#                                        for part in var_desc_split:
+#                                                if replace:
+#                                                        var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+#                                                        replace = False
+#                                                else:
+#                                                        var_description = &quot;%s $%s$&quot;%(var_description, part)
+#                                                        replace = True
+#                                else:
+#                                        var_description = &quot;%s&quot;%var_description.replace('_','\_')
+#
+#                        
+#                        latex.write('\subsection[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="blue">'%(var_name.replace('_','\_'),struct_name, var_name.replace('_','\_')))
+#                        latex.write('\label{subsec:var_sec_%s_%s}</font>
<font color="blue">'%(struct_name,var_name))
+#                        # Tabular Format:
+#                        latex.write('\\begin{center}</font>
<font color="blue">')
+#                        latex.write('\\begin{longtable}{| p{2.0in} | p{4.0in} |}</font>
<font color="blue">')
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('        Type: &amp; %s \\\\</font>
<font color="blue">'%var_type)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('        Units: &amp; %s \\\\</font>
<font color="blue">'%var_units)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('        Dimension: &amp; %s \\\\</font>
<font color="blue">'%var_dims)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('        Persistence: &amp; %s \\\\</font>
<font color="blue">'%var_persistence)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('                 Default Streams: &amp; %s \\\\</font>
<font color="blue">'%var_streams)
+#                        latex.write('        \hline </font>
<font color="blue">')
+#                        latex.write('                 Location in code: &amp; %s \\\\</font>
<font color="blue">'%var_path.replace('_','\_').replace('%','\%'))
+#                        latex.write('                 \hline </font>
<font color="blue">')
+#                        latex.write('    \caption{%s: %s}</font>
<font color="blue">'%(var_name.replace('_','\_'),var_description))
+#                        latex.write('\end{longtable}</font>
<font color="blue">')
+#                        latex.write('\end{center}</font>
<font color="black">')
 latex.close()
 
 

</font>
</pre>