<div dir="ltr"><div><div>Creating a function that reads and evaluate  a f77 or (more complicated) f90 namelist would require significant effort. For example, there cane be multiple "groups"; f90 "derived types" (I think), etc<br><br></div>I took a crack at reading the provided namelist using keyword==>value approach. It is all about book-keeping! For example, the trailing "," must be addressed.<br><br></div><div>I have only checked it out with the provided namelist. You can modify to fit your needs. Use print to check your results.<br></div><div><br>---<br></div><div>%> ncl tst.read_namelist.ncl<br><br>=======<br><br>(0)    val_1=5<br>(0)    <br>(0)    val_2=True<br>(1)    val_2=True<br>(2)    val_2=True<br>(0)    <br>(0)    val_3=wrfout/wrfout_d<domain>_<date><br>(0)    <br>(0)    val_4=2015<br>(1)    val_4=2001<br>(2)    val_4=2001<br></div><div><br></div><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 20, 2017 at 9:45 AM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi,<br><br></div>I am unaware of an NCL function that directly reads the namelist.  However, you might look at this example:<br><br><a href="http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/EXPERIMENTAL/wrf_show_wps_som_namelist.htm" target="_blank">http://www2.mmm.ucar.edu/wrf/<wbr>OnLineTutorial/Graphics/NCL/<wbr>Examples/EXPERIMENTAL/wrf_<wbr>show_wps_som_namelist.htm</a><br><br></div>It uses system calls to "grep" through a namelist file to pull out fields that are of interest. <br><br></div>Hope that helps...<br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Sep 20, 2017 at 8:54 AM, Zhifeng Yang <span dir="ltr"><<a href="mailto:yangzf01@gmail.com" target="_blank">yangzf01@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div>Hi<br><br></div>Is there any methods to read a namelist file directly? Similar to FORTRAN. Here is an example of namelist file from WRF<br><br>&time_control<br> run_days                     <wbr>       = 5,<br> run_hours                    <wbr>       = 0,<br> run_minutes                  <wbr>       = 0,<br> run_seconds                  <wbr>       = 0,<br> start_year                   <wbr>       = 2015, 2001, 2001,<br> start_month                  <wbr>       = 06,   06,   06,<br> start_day                    <wbr>       = 19,   11,   11,<br> start_hour                   <wbr>       = 00,   12,   12,<br> start_minute                 <wbr>       = 00,   00,   00,<br> start_second                 <wbr>       = 00,   00,   00,<br> end_year                     <wbr>       = 2015, 2001, 2001,<br> end_month                    <wbr>       = 06,   06,   06,<br> end_day                      <wbr>       = 24,   12,   12,<br> end_hour                     <wbr>       = 00,   12,   12,<br> end_minute                   <wbr>       = 00,   00,   00,<br> end_second                   <wbr>       = 00,   00,   00,<br> interval_seconds             <wbr>       = 600<br> input_from_file              <wbr>       = .true.,.true.,.true.,<br> history_interval             <wbr>       = 10,   60,   60,<br> frames_per_outfile           <wbr>       = 1,    1,    1,<br> restart                      <wbr>       = .false.,<br> restart_interval             <wbr>       = 5000,<br> io_form_history              <wbr>       = 2<br> io_form_restart              <wbr>       = 2<br> io_form_input                <wbr>       = 2<br> io_form_boundary             <wbr>       = 2<br> auxinput1_inname             <wbr>       = "../../../WPS/wpsout_cus_4km/m<wbr>et_em.d<domain>.<date>"<br> history_outname              <wbr>       = "wrfout/wrfout_d<domain>_<date<wbr>>"<br> debug_level                  <wbr>       = 0<br><br></div>I want to read this file with variable names and values from NCL. Thank you<br><br></div>Best,<br></div>Zhifeng<br><br></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>