<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><!-- InstanceBegin template="/Templates/temp2.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>WRFDA Practice</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<SCRIPT language=JavaScript src="../assets/menu_array_class.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="../assets/mmenu.js" type=text/javascript></SCRIPT>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="../assets/wrfdastyle.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
a:active {
	text-decoration: none;
}
-->
</style></head>

<body id="top" bgcolor="#FFFFFF">
<table width="100%" border="2" cellpadding="0" cellspacing="0" bgcolor="cbffcd">
  <tr> 
    <td width="1485" colspan="3" bgcolor="#EEFFDD"><div align="center">
      <a href="../index.html"><img src="../images/header.png" alt="page header" height="125" border="0" align="left"></a>
    </div></td>
  </tr>
  <tr bgcolor="cbffcd" class="body"> 
    <td height="33" colspan="4" bgcolor="#99BB66">&nbsp;</td>
  </tr>
  <tr> 
    <td colspan="4" bgcolor="#EEFFDD"> <table width="90%" border="0" align="center" cellpadding="20" cellspacing="20">
        <tr> 
          <td valign="middle" bgcolor="#FFFFFF"><!-- InstanceBeginEditable name="maincontent" -->
            <span class="pagetitle">Running WRFDA-3DVAR - real data case</span>
            <blockquote>
              <p>The goal of this session is to generate an updated WRF analysis and boundary conditions using WRFDA 3DVAR data assimilation.</p>
              <p><span class="body">Reference: <a href="../docs/WRFDA_Setup_Run_Diagnostics.pdf">Download the tutorial presentation</a></span></p>
              <p><span class="bodyh1">Source code</span> </p>
              <blockquote>
                <p>Get the <a href="wrfda_code.html">pre-compiled code</a>, if you have not yet done so. </p>
                <p><span class="stylecode">WRFDA/var/build/da_wrfvar.exe</span> and <span class="stylecode">WRFDA/var/build/da_update_bc.exe</em> are the executables that will be used in this session.</p>
              </blockquote>
              <span class="bodyh1">Create your working directory</span>
              <blockquote>
                <p>You should create <span class="stylecode">/kumquat/users/${USER}/DA/3dvar</span> and use this as your working directory for this lesson.</p>
                <blockquote>
                  <p class="stylecode">mkdir /kumquat/users/${USER}/DA/3dvar<br>
                                       cd /kumquat/users/${USER}/DA/3dvar</p>
                </blockquote>
              </blockquote>
              <p><span class="bodyh1">Input data</span>
              </p>
              <blockquote>
                <table border="0" cellpadding="0" cellspacing="0">
                  <tr style="vertical-align: top;">
                    <td>
                      <p>This case utilizes a continental USA domain, 90x60 gridpoints, 41 vertical levels, and 60km resolution (it can be found at /kumquat/wrfhelp/DATA/WRFDA/CONUS60). The exact area of the domain is shown at right. All of today's exercises (OBSPROC, 3DVAR real and PSOT, GENBE) will use this case.</a>
                      <p>It features a storm system which produced a <a href="https://en.wikipedia.org/wiki/2008_Super_Tuesday_tornado_outbreak">deadly tornado outbreak</a> across the Central/Southern USA on February 5, 2008.</p> 
                      <p>A very basic namelist file for running the tutorial case is available at <span class="stylecode">WRFDA/var/test/tutorial/namelist.input</span></p>
                      <blockquote>
                        <p class="stylecode">cp /kumquat/users/${USER}/DA/WRFDA/var/test/tutorial/namelist.input .</p>
                      </blockquote>
                      <p>A land-use table is needed as well (provided in the WRFDA package)</p>
                      <blockquote>
                        <p class="stylecode">ln -fs /kumquat/users/${USER}/DA/WRFDA/run/LANDUSE.TBL ./LANDUSE.TBL</p>
                      </blockquote>
                    </td>
                    <td class="bodytext"><a href="images/CONUS60.png"><img src="images/CONUS60.png" alt="Domain of this test case" height="300"></a></td>
                  </tr>
                </table>
                 <p>Besides namelist.input and LANDUSE.TBL, the other three major input files to WRFDA-3DVAR are observations (ob.ascii), background error statistics (be.dat), and first guess (fg).</p>
              </blockquote>
              <ul>
                <li><strong>ob.ascii</strong> is in plain-text format and is the output from OBSPROC that you created in the previous lesson.
                <blockquote>
                  <p class="stylecode">ln -fs /kumquat/users/${USER}/DA/obsproc/obs_gts_2008-02-05_12:00:00.3DVAR ./ob.ascii</p>
                </blockquote>
                </li>
                <li><strong>be.dat</strong> is in binary format and is the output from gen_be utility. For this lesson, just use the supplied pre-generated be.dat
                <blockquote>
                  <p class="stylecode">ln -fs /kumquat/wrfhelp/DATA/WRFDA/CONUS60/be/be.dat ./be.dat</p>
                </blockquote>
                </li>
                <li><strong>fg</strong> is the first guess (background) in netCDF format and can be either a "wrfinput" file from WPS/real.exe or a "wrfout" file from a WRF forecast.
                <blockquote>
                  <p class="stylecode">cp -p /kumquat/wrfhelp/DATA/WRFDA/CONUS60/rc/2008020512/wrfinput_d01 ./fg</p>
                </blockquote>
                </li>
              </ul>
              <p><span class="bodyh1">Edit namelist.input</span></p>
              <blockquote>
                <p>You should edit <em>namelist.input</em> to ensure the following namelist variables are consistent with the time and domain of your analysis target. For the tutorial case, you shouldn't have to change any values, but it is always good practice to make sure.</p>
                <p><span class="stylecode">&gt; vi namelist.input<br><br>
                  &amp;wrfvar18<br>
                  analysis_date=&quot;2008-02-05_12:00:00&quot;,<br>
                  /<br>
                  &amp;wrfvar21<br>
                  time_window_min=&quot;2008-02-05_11:00:00&quot;,<br>
                  /<br>
                  &amp;wrfvar22</span><br>
                  <span class="stylecode">time_window_max=&quot;2008-02-05_13:00:00&quot;,<br>
                /<br>
                &amp;domains<br>
                e_we=90,<br>
                e_sn=60,<br>
                e_vert=41,<br>
                dx=60000,<br>
                dy=60000,<br>
                /<br>
                </span> </p>
              </blockquote>
              <p><span class="bodyh1">Run WRFDA-3DVAR (da_wrfvar.exe)</span></p>
              <blockquote>
                <p>For convenience, link the executable to your current working directory. Then run the executable</p>
                <blockquote>
                  <p class="stylecode">ln -sf /kumquat/users/${USER}/DA/WRFDA/var/build/da_wrfvar.exe ./da_wrfvar.exe</p>
                  <p class="stylecode">mpirun -np 6 ./da_wrfvar.exe</p>
                </blockquote>
                <p>Running this case should take less than a minute on the classroom computers.</p>
              </blockquote>
              <span class="bodyh1">Check output</span>
              <blockquote>
                <p>When WRFDA is completed, you should see a number of files in your working directory, the most important of which is <span class="stylecode">wrfvar_output</span>: this is the analysis file generated by WRFDA. It is in WRF netCDF format. You can view it with the <span class="stylecode">ncview</span> command.</p>
                <p>Since you ran in parallel with mpirun, you should have a number of files that begin with "rsl.out" and "rsl.error". These are the log files for regular output and error messages, respectively, and there should be one of each for the number of processors you ran WRFDA on. For example, rsl.out.0000 is the output from the first processor, rsl.out.0001 is the output from the second processor, etc. If your run was successful, your rsl.out.0000 (log file) should end with <span class="stylecode">*** WRF-Var completed successfully ***</span>. <a href="rsl.out.0000.txt">You can see an example rsl.out.0000 file here</a>.</p>
                <p><span class="stylecode"><span class="stylecode">statistics</span> is another diagnostic file that should be checked after each WRFDA run to make sure that the task was done correctly and successfully. It contains information about OI (the observation minus background, OMB) and AO (the observation minus analysis, OMA) for each observation type, in addition to statistics on the increment for each of the modified state variables (u, v, T, P, and q).</p>
                <p><span class="stylecode">gts_omb_oma_01</span> contains information about observations and <em>innovation</em>, <span class="stylecode">qcstat_conv_01</span> (contains information about quality control), and <span class="stylecode">rej_obs_conv_01.####</span> (lists all conventional observations that were rejected by each processor) are other useful diagnostic files.</p>
                <p>There are several tools available for viewing the analysis increments. A netCDF file containing the analysis increment fields can be created with either <strong>ncdiff</strong> or <strong>ncbo</strong>.</p>
                <blockquote>
                  <p class="stylecode">ncdiff fg wrfvar_output increment.nc</p>
                  <p> &nbsp; <em>or</em></p>
                  <p class="stylecode">ncbo -y sbt fg wrfvar_output increment.nc</p>
                </blockquote>
                <p>The resulting increment file can be quickly viewed using <strong>ncview</strong>:</p> 
                <blockquote>
                  <p class="stylecode">ncview increment.nc</p>
                </blockquote>
                <p>You should see differences in the fields P, QVAPOR, T, U, and V.</p>
                <table border="0" cellpadding="0" cellspacing="0">
                  <tr style="vertical-align: top;">
                    <td>
                      <p>To create plots rather than a raw difference file, <span class="stylecode">/kumquat/wrfhelp/DATA/WRFDA/TOOLS/graphics/ncl/WRF-Var_plot.ncl</span> and <span class="stylecode">/kumquat/wrfhelp/DATA/WRFDA/TOOLS/graphics/ncl/WRF_contributed.ncl.test</span> can be used:<br>
                      <blockquote>
                        <p class="stylecode">cp /kumquat/wrfhelp/DATA/WRFDA/TOOLS/graphics/ncl/WRF-Var_plot.ncl .<br>
                        cp /kumquat/wrfhelp/DATA/WRFDA/TOOLS/graphics/ncl/WRF_contributed.ncl.test .</p>
                      </blockquote>
                      <p>Edit <span class="stylecode">WRF-Var_plot.ncl</span> to provide the filenames, level index, field name, and what plot_data to plot for your case.</p>
                      <blockquote>
                        <p class="stylecode">vi WRF-Var_plot.ncl</p>
                        <p class="stylecode">......<br>
                        first_guess = addfile(&quot;fg&quot;+&quot;.nc&quot;, &quot;r&quot;)<br>
                        analysis = addfile(&quot;wrfvar_output&quot;+&quot;.nc&quot;, &quot;r&quot;)                <br>
                        ......<br>
                        kl = 18<br>
                        var = "U"<br>
                        fg = first_guess-&gt;U<br>
                        an = analysis-&gt;U<br>
                        plot_data = an - fg<br>
                        ; plot_data = an     <br></p>
                      </blockquote>
                      <p>Then run the ncl script</p>
                      <blockquote>
                        <p class="stylecode">ncl WRF-Var_plot.ncl<br>
                        display WRF-VAR_U_level_18.pdf</p>
                      </blockquote>
                      <p>You should see a plot similar to the one on the right.</p>
                    </td>
                    <td class="bodytext"><a href="images/WRF-VAR_U_level_18.png"><img src="images/WRF-VAR_U_level_18.png" height="300"></a></td>
                  </tr>
                </table>
                <p><br><span class="stylecode">/kumquat/wrfhelp/DATA/WRFDA/TOOLS/graphics/ncl/plot_gts_omb_oma_simple.ncl</span> can be used to plot the contents of <span class="stylecode">gts_omb_oma_01.</span> </p>
                <table border="0" cellpadding="0" cellspacing="0">
                  <tr style="vertical-align: top;">
                    <td>
                      <blockquote><p class="stylecode">cp /kumquat/wrfhelp/DATA/WRFDA/TOOLS/graphics/ncl/plot_gts_omb_oma_simple.ncl .</p></blockquote>
                      <p>Edit plot_gts_omb_oma_simple.ncl to provide the date, filenames and options of your case.</p>
                      <blockquote>
                        <p class="stylecode">......<br>
                        plotdir = &quot;ncl_plot/&quot; ;where plot files will be created<br>
                        expt = "my_plots" ; for output naming purposes, spaces are not allowed<br>
                        datdir = "/kumquat/users/$USER/DA/3dvar/" ; the path of the working directory<br>
                        ......              <br>
                        fgname = "fg"  ; for retrieving mapping info<br>
                        ......              </p>
                      </blockquote>
                      <p>Run the NCL script</p>
                        <blockquote><p class="stylecode">ncl plot_gts_omb_oma_simple.ncl</p></blockquote>
                      <p>This script may take a few minutes to complete; it will generate many plots depending on your settings. View the plots using <span class="stylecode">display</span>. An example of one of these plots, showing the OMA and OMB of sounding observations around 500 hPa, can be seen at right. Use spacebar and backspace to scroll through the different plots, showing OMB, OMA, and bias statistics for the observations at different pressure levels. There will be one output file per observation type; if you have time you can try plotting different observation types by editing the "proc_*" variables further down in the script.</p>
                    </td>
                    <td class="bodytext"><a href="images/my_plots_sound_2008020512-22.png"><img src="images/my_plots_sound_2008020512-22.png" height="300"></a></td>
                  </tr>
                </table>
                  <blockquote><p class="stylecode">display ncl_plot/my_plots_sound_2008020512.pdf</p></blockquote>
                <p>There will be one output file per observation type; if you have time you can try plotting different observation types. You can also edit the "plevs" variable to change the way observations are arranged by pressure level.</p>
                <p><span class="stylecode">/kumquat/wrfhelp/DATA/WRFDA/TOOLS/graphics/ncl/plot_cost_grad_fn.ncl</span> can be used to plot cost function evolution.</p>
                  <blockquote><p class="stylecode">cp /kumquat/wrfhelp/DATA/WRFDA/TOOLS/graphics/ncl/plot_cost_grad_fn.ncl .</p></blockquote>
                <p>Edit plot_cost_grad_fn.ncl to provide the current working directory. You can also edit "domain_name" to change the plot captions.</p>
                <blockquote>
                  <p class="stylecode">......<br>
                  dir = "/kumquat/users/$USER/DA/3dvar/"<br>
                  domain_name = &quot;my test case&quot;<br>
                  ......              </p>
                </blockquote>
                <p><br>Run the NCL script</p>
                  <blockquote><p class="stylecode">ncl plot_cost_grad_fn.ncl</p></blockquote>
                <p>You will notice that by default, WRFDA only prints information about the first and last iterations to cost_fn and grad_fn, so <a href="images/cost_grad.png">the plots will just be straight lines</a>. If you wish to see <a href="images/cost_grad_detail.png">more detailed plots</a>, run the test case again, but with the option "<span class="stylecode">calculate_cg_cost_fn = .true.</span>" under the &amp;wrfvar11 namelist section.</p>
                <p>Other <a href="http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Class/graphics.htm">WRF graphic tools</a> can be used as well.</p>
                <p>The full list of namelist options, including those not specified by the user (and so were assigned default values), can be found in the <span class="stylecode">namelist.output.da</span> file. Most of these options will not be useful for most purposes (e.g. the large list of "AUXINPUT" variables), so a more condensed list of WRFDA-related namelist options can be found <a href="http://www2.mmm.ucar.edu/wrf/users/wrfda/Docs/user_guide_V3.7/users_guide_chap6.htm#_Description_of_Namelist_2">at the end of the Users' Guide</a>.</p>
              </blockquote>
              <p><span class="bodyh1">Update WRF lateral boundary conditions</span></p>
              <blockquote>
                <p>After creating an analysis, we have changed the initial conditions for the model. Therefore, if we want to use the analysis to create a forecast, the tendencies in the "wrfbdy" file should be adjusted based on these new initial conditions. This is done with da_update_bc.exe</p>
                <p><strong>Important:</strong> Make a copy of wrfbdy_d01 from this folder, do not simply link it. The wrf_bdy_file will be overwritten by da_update_bc.exe.</p>
                <blockquote>
                  <p class="stylecode">cp /kumquat/wrfhelp/DATA/WRFDA/CONUS60/rc/2008020512/wrfbdy_d01 ./wrfbdy_d01</p>
                </blockquote>
                <p>Also, copy the sample da_update_bc namelist (parame.in) and make sure all the variables are set correctly for this experiment:</p>
                <blockquote>
                  <p class="stylecode">cp /kumquat/users/${USER}/DA/WRFDA/var/test/update_bc/parame.in .<br>
                  vi parame.in <br><br>
                  &amp;control_param<br>
                  da_file            = './wrfvar_output'<br>
                  wrf_bdy_file       = './wrfbdy_d01' <br>
                  wrf_input          = '/kumquat/wrfhelp/DATA/WRFDA/CONUS60/rc/2008020512/wrfinput_d01' <br>
                  domain_id          = 1 <br>
                  cycling            = .false. <br>
                  debug   = .true. <br>
                  low_bdy_only = .false. <br>
                  update_lsm = .false. <br>
                  var4d_lbc =  .false. <br>
                  /</p>
                </blockquote>
                <p>Run da_update_bc.exe</p>
                <blockquote>
                  <p class="stylecode">/kumquat/users/${USER}/DA/WRFDA/var/build/da_update_bc.exe</p>
                </blockquote>
                <p>Finally, check the output. Use <em><strong><a href="http://www2.mmm.ucar.edu/wrf/users/utilities/diffwrf.htm">diffwrf</a></strong></em> (available in compiled WRFV3 code at WRFV3/external/io_netcdf/diffwrf), <strong><em>ncdiff</em></strong>, <em><strong>ncview</strong></em><strong></strong>, or other <a href="http://www.mmm.ucar.edu/wrf/OnLineTutorial/Class/graphics.htm">WRF NCL graphic tools</a> to check what fields have been updated.</p>
                <p>The <span class="stylecode"><strong>wrfvar_output</strong></span> and <span class="stylecode"><strong>wrfbdy_d01</strong></span> are the data-assimilated initial condition and tendency-updated boundary condition for your subsequent WRF model run. You will learn more about this in the cycling exercises later this week.</p>
                <p class="body">You are now finished with the basic exercise for WRFDA-3DVAR with real data. You can now <a href="wrfda_sessions.html#session_1">continue to the next practice case</a>.</p>
                <p>You can come back here later for additional practice running WRFDA-3DVAR with real data below:<br>
                </p>
              </blockquote>
              <p class="bodyh2"><a name="advanced">Additional exercises</a></p>
              <ul>
                <li>
                  <p>Try modifying some of the namelist variables listed above (for example, setting a different analysis_date, setting a different e_we) and see what log messages you will get.  
                  </p>
                </li>
              
                
                <li>
                  <p>Try changing the time_window_min to be &quot;2008-02-05_11:30:00&quot; and compare the results with previous runs (Remember to check log and diagnostic files first).
                  </p>
                </li>
              
                <li>Try running WRFDA using NCEP PREPBUFR data (<span class="stylecode">/kumquat/wrfhelp/DATA/WRFDA/CONUS60/ob/2008020512/gdas1.t12z.prepbufr.nr</span>) as the observation input
                  <blockquote>
                    <p class="stylecode">ln -fs  /kumquat/wrfhelp/DATA/WRFDA/CONUS60/ob/2008020512/gdas1.t12z.prepbufr.nr ob.bufr</p>
                    <p class="stylecode">vi namelist.input</p>
                    <p class="stylecode">&amp;wrfvar3<br>
                      ob_format=1<br>
                      /                    </p>
                  </blockquote>
                </li>
              
                
                <li>Try running WRFDA with a different BE option (cv_options=3) using a pre-supplied be.dat available in the WRFDA package <em>WRFDA/var/run/be.dat.cv3</em>. Compare the results with previous cv_options=5 runs.
                  <blockquote>
                    <p class="stylecode">ln -fs /kumquat/users/${USER}/DA/WRFDA/var/run/be.dat.cv3 ./be.dat</p>
                    <p class="stylecode">vi namelist.input</p>
                    <p class="stylecode">&amp;wrfvar7<br>
                      cv_options = 3<br>
                      /
                    </p>
                  </blockquote>
                </li>
                <li>Try adding the following namelist settings and compare the results with previous runs (Remember to check log and diagnostic files first) .
                  <blockquote>
                    <p class="stylecode">vi namelist.input</p>
                    <p class="stylecode">&amp;wrfvar5<br>
                      max_error_t = 3.0<br>
                      max_error_uv = 3.0<br>
                      max_error_q = 3.0<br>
                      max_error_p = 3.0
                      <br>
                      /</p>
                  </blockquote>
                </li>
              </ul>
            </blockquote>
            <!-- InstanceEndEditable --><br>
            
          </td>
        </tr>
        <tr><td><a href="#top">back to top</a></td></tr>
    </table></td>
  </tr>
  <tr> 
    <td colspan="4" bgcolor="#99b86e">&nbsp;</td>
  </tr>
</table>

<map name="Map">
  <area shape="rect" coords="-189,-6,548,73" href="../../../index.html" alt="practice_page_header">
</map>
</body>
<!-- InstanceEnd --></html>