Dear All,<br><br>Just want to let you know of my simple ruby library to manipulate namelists<br>for WRF or any fortran namelists at<br><br>   <a href="https://github.com/sajinh/fortran-namelist">https://github.com/sajinh/fortran-namelist</a><br>
<br>Questions/bugs to <a href="mailto:saji@u-aizu.ac.jp">saji@u-aizu.ac.jp</a><br><br>saji<br>---<br>How to use: Commented explanations can be found<br>   in the above website<br><br> <span style="font-family:courier new,monospace">require &#39;./lib/nml&#39;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">nml_file = &quot;./namelists/namelist.wps.all_options&quot;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"># Read in and manipulate a fortran namelist<br>
nml = NML_Reader.read(nml_file)</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">share=nml[:share].keep :wrf_core,</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">           :max_dom,</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">           :start_date,</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">           :end_date,</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">           :interval_seconds,</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">           :io_form_geogrid</span><br style="font-family:courier new,monospace"><br>share[:start_date] = &#39;2012-01-01-00-00&#39;<br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">geogrid=nml[:geogrid]</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">geogrid.del :s_we, :s_sn, :ref_x, :ref_y</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">ungrib=nml[:ungrib]</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">metgrid=nml[:metgrid].del :process_only_bdy,<br>
                          :constants_name,</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">                           :opt_output_from_metgrid_path</span><br style="font-family:courier new,monospace">
<br>#  Create namelist groups<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">nshare = NML_Group.create(:share)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">nshare &lt;&lt; share &lt;&lt; {:a =&gt; 1}</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">ngrid = NML_Group.create(:geogrid)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">ngrid &lt;&lt; geogrid</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">ungrb = NML_Group.create(:ungrib)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">ungrb &lt;&lt; nml[:ungrib]</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">nmet = NML_Group.create(:metgrid)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">nmet &lt;&lt; metgrid</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">outfil = File.new(&quot;<a href="http://namelist.wps.asia">namelist.wps.asia</a>&quot;,&quot;w&quot;)</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"><br># Concat namelist groups to create a new namelist<br>NML_Writer &lt;&lt; nshare &lt;&lt; ngrid &lt;&lt; ungrb &lt;&lt; nmet<br><br># Flush out namelist to outfil<br style="font-family:courier new,monospace">
</span><span style="font-family:courier new,monospace">NML_Writer &gt;&gt; outfil</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">outfil.close</span><br><br>Enjoy!<br><br>
Copyright Saji Hameed (2012)  <a href="mailto:saji.uaizu@gmail.com">saji.uaizu@gmail.com</a><br>-- <br><br>Saji N Hameed,<br>ARC-ENV, Center for Advanced Information Science and Technology,<br>University of Aizu, Tsuruga, Ikki-machi,<br>
Aizuwakamatsu-shi, Fukushima 965-8580,<br>Japan<br>       <br>Tel: +81242 37-2736<br>Fax:+81242 37-2760<br> email: <a href="mailto:saji@u-aizu.ac.jp">saji@u-aizu.ac.jp</a><br> url: <a href="http://www.u-aizu.ac.jp">http://www.u-aizu.ac.jp</a><br>
 bib: <a href="http://www.researcherid.com/rid/B-9188-2009">http://www.researcherid.com/rid/B-9188-2009</a><br><br>