WRFDA Practical Sessions


Welcome to the WRF-Var Online Practical Session Guide

 

During this tutorial you will set up and run WRF-Var by following sessions:

Sessions

Estimate of time needed for each step

1.

Observation prepprocessing

12:35PM --- 01:30PM, Feb. 2 , 2009

2.

Running WRF-Var

04:05PM --- 05:30PM, Feb. 2 , 2009

3.

BE and single observation tests

10:05AM --- 11:30AM, Feb. 3 , 2009

4.

Radar data assimilation

01:20PM --- 02:30PM, Feb. 3 , 2009

5.

Hybrid data assimilation

03:50PM --- 05:00PM, Feb. 3 , 2009

6.

Optional practice

10:40AM --- 12:00AM, Feb. 4 , 2009

In order to run the model successfully, one normally needs to first compile the code and obtain data, before attempting to run the code.

Since compiling the code can take a considerable amount of time, we have supplied pre-compiled code for this practical.
Get the pre-compiled code now.

We have also supplied the data, so for most of these cases you only need to run WRFDA.

If you want to experiment with compiling the code, we do have a separate exercise to practice compiling, but for all other exercises please use the pre-compiled code as this will ensure that you get the most from the practical sessions.

Source code:
WRFDA_v3_0_1_1.tar.gz
WRFDA_v3_0_1_1_bugfix.tar.gz
WRFDA_v3_0_1_1_genbegix.tar

Pre-compiled code:
/wrfhelp/SOURCE_CODE/WRFDA
/wrfhelp/SOURCE_CODE/WRFDA_hybrid (NOTE: this code should be for tutorial hybrid practice only)

input files for con200 case: (Download)
/wrfhelp/DATA/VAR/Con200/ob/2007010200/ob.little_r
/wrfhelp/DATA/VAR/Con200/be/be.dat
/wrfhelp/DATA/VAR/Con200/rc/2007010200/wrfbdy_d01
/wrfhelp/DATA/VAR/Con200/rc/2007010200/wrfinput_d01

WRF forecasts on con200 domain for gen_be practice
/wrfhelp/DATA/VAR/Con200/fc/2007010100 ~ 2007013100

Input files for radar practice: (Download)
/wrfhelp/DATA/VAR/Radar

Input files for hybrid practice: (Download)
/wrfhelp/DATA/VAR/Hybrid

Input files for Katrina case: (Download)
/wrfhelp/DATA/VAR/Katrina

  1. Observation preprocessing Help
    • Source code

      /wrfhelp/SOURCE_CODE/WRFDA/var/obsproc/3dvar_obs.exe is the executable that will be used in this practice.

    • Locate, get or prepare observations in little_r format.

      For this tutorial, an observation file in little_r format is provided in /wrfhelp/DATA/VAR/Con200/ob/2007010200/ob.little_r. For your other applications, you will have to prepare your own observation files.

    • Link the external observation error file (provided in the WRFDA package) to your working directory.

      cd your_working_dir
      ln –sf /wrfhelp/SOURCE_CODE/WRFDA/var/obsproc/obserr.txt ./obserr.txt

    • Edit namelist.3dvar_obs

      For your reference, an example file named “namelist_3dvar_obs.wrfvar-tut” has already been created in the /wrfhelp/SOURCE_CODE/WRFDA/var/obsproc directory.
      cp /wrfhelp/SOURCE_CODE/WRFDA/var/obsproc/namelist.3dvar_obs.wrfvar-tut namelist.3dvar_obs
      Next, edit namelist.3dvar_obs to configure the domain, time window, etc.
      For the tutorial CON200 case, all you need is to change the full path and name of the little_r observation file.
      obs_gts_filename = '/wrfhelp/DATA/VAR/Con200/ob/2007010200/ob.little_r'

    • Run 3dvar_obs.exe

      /wrfhelp/SOURCE_CODE/WRFDA/var/obsproc/3dvar_obs.exe >&! 3dvar_obs.out

    • Check output

      obs_gts_2007-01-02_00:00:00.3DVAR
      Diagnostic files

    • Graphics
    • To have a graphical view about the content of this file, there is a “MAP_plot” utility to look at the data distribution for each type of observations. To use this utility, proceed as follows.

      cd MAP_plot

      Modify the script Map.csh to set the time window and full path of input observation file (obs_gts_2007-01-02_00:00:00.3DVAR). You will need to set the following strings in this script as follows:

      TIME_WINDOW_MIN = ‘2007010121’
      TIME_ANALYSIS = ‘2007010200’
      TIME_WINDOW_MAX = ‘2007010203’
      OBSDATA = ../obs_gts_2007-01-02_00:00:00.3DVAR

      Next, type

      Map.csh

      When the job has completed, you will have a gmeta file gmeta.{analysis_time} corresponding to analysis_time=2007010200. This contains plots of data distribution for each type of observations contained in the OBS data file: obs_gts_2007-01-02_00:00:00.3DVAR. To view this, type

      idt gmeta.2007010200

      It will display (panel by panel) geographical distribution of various types of data which are listed in the header of “obs_gts.3dvar”.

      You can also try another graphic tool : /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/obsloc.ncl

    • Advanced practice

      Set up for Katrina case
      Set up your own domain of interest
      Try changing other namelist.3dvar_obs setting

  2. Running WRF-Var Help

      • Source code

        WRFDA/var/da/da_wrfvar.exe  and WRDA/var/da/da_update_bc.exe are the executables that will be used in this practice.

      • Link or copy WRF-Var-ready observation as ob.ascii in your WRF-Var working directory.

        You should first go through the section “Observation Pre-processing” and have a WRF-Var-ready observation file (obs_gts_2007-01-02_00:00:00.3DVAR) generated in your obsproc working directory.
        Link of copy  obs_gts_2007-01-02_00:00:00.3DVAR to your WRF-Var working directory as ob.ascii.

      • Link or copy first guess as fg in your WRF-Var working directory.

        ln -sf /wrfhelp/DATA/VAR/Con200/rc/2007010200/wrfinput_d01  ./fg

      • Link or copy background error statistics file as be.dat in your WRF-Var working directory.

        ln -sf /wrfhelp/DATA/VAR/Con200/be/be.dat ./be.dat

      • Link or copy a constant table that is needed for roughness calculation in your WRF-Var working directory.

        ln -sf /wrfhelp/SOURCE_CODE/WRFDA/run/LANDUSE.TBL ./LANDUSE.TBL

      • Edit namelist.input

        a very basic namelist.input for running the tutorial con200 case is available at /wrfhelp/SOURCE_CODE/WRFDA/var/test/namelist.input.
        IMPORTANT NOTE: Time, domain and physics settings have to be consistent with those used in WPS/WRF for generating the first guess. Default settings are provided in WRFDA/Registry/Registry.wrfvar
        cp /wrfhelp/SOURCE_CODE/WRFDA/var/test/namelist.input namelist.input

      • Run da_wrfvar.exe

        /wrfhelp/SOURCE_CODE/WRFDA/var/da/da_wrfvar.exe

      • Update WRF lateral boundary conditions

        Make a copy of wrfbdy_d01 from WPS/real.exe as the wrf_bdy_file will be overwritten by da_update_bc.exe.

        cp /wrfhelp/DATA/VAR/Con200/rc/2007010200/wrfbdy_d01 ./wrfbdy_d01

      • Edit parame.in

        &control_param
         wrfvar_output_file = './wrfvar_output'
         wrf_bdy_file       = './wrfbdy_d01'
         wrf_input          = '/wrfhelp/DATA/VAR/Con200/rc/2007010200/wrfinput_d01'
         cycling = .false. (set to .true. if WRF-Var first guess comes from a previous WRF forecast.)
         debug   = .true.
         low_bdy_only = .false.           
         update_lsm = .false.
        /

      • Run da_update_bc.exe

        /wrfhelp/SOURCE_CODE/WRFDA/var/da/da_update_bc.exe

      • Check output

        wrfvar_output
        Diagnostic files

      • Graphics

        /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/WRF-Var_plot.ncl
        /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/WRF_contributed.ncl.test
        /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/plotobs.ncl
        /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/plot_cost_grad_fn.ncl

      • Advanced practice

        Set up for Katrina case, try changing other namelist.input settings.
        Some of the namelist.input options that you can try changing the settings:
        &wrfvar1
        print_detail_grad=.false.
        &wrfvar4
        use_synopobs=.true.
        use_satemobs=.true.
        &wrfvar6
        ntmax=100
        eps=0.01
        &wrfvar9
        trace_use=false,  (Note: if not specified, default trace_use=true is applied. A subdirectory trace has to be created in your working directory before running da_wrfvar.exe)
        &wrfvar11
        calculate_cg_cost_fn=.true.
        sfc_assi_options=1
        &wrfvar17
        analysis_type=”3D_VAR”
        &wrfvar18
        analysis_date="2007-01-02_00:00:00.0000",
        &time_control
        start_year=2007,
        start_month=01,
        start_day=02,
        start_hour=00,
        end_year=2007,
        end_month=01,
        end_day=02,
        end_hour=00,
        &domains
        e_we=45,
        e_sn=45,
        e_vert=28,
        dx=200000,
        dy=200000,
        &physics
        mp_physics=3,
        sf_sfclay_physics=1,
        sf_surface_physics=1,

        num_soil_layers=5,  (IMPORTANT: it’s essential to make sure the setting here is consistent with the number in your first guess file)

  1. BE and single observation tests Help

    Running gen_be

    • Source code

      /wrfhelp/SOURCE_CODE/WRFDA/var/scripts/gen_be/gen_be_wrapper.ksh is the main script that will be used in this practice.
      Gen_be consists of several stages. Quite a few executables and scripts are used for the whole process.
      /wrfhelp/SOURCE_CODE/WRFDA/var/scripts/gen_be/gen_be.ksh
      /wrfhelp/SOURCE_CODE/WRFDA/var/scripts/gen_be/gen_be_stage0_wrf.ksh
      /wrfhelp/SOURCE_CODE/WRFDA/var/scripts/gen_be/gen_be_stage4_regional.ksh
      /wrfhelp/SOURCE_CODE/WRFDA/var/scripts/gen_be/gen_be_cov2d.ksh
      /wrfhelp/SOURCE_CODE/WRFDA/var/scripts/gen_be/gen_be_cov3d.ksh
      /wrfhelp/SOURCE_CODE/WRFDA/var/da/gen_be_stage0_wrf.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/da/gen_be_stage1.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/ da/gen_be_stage2.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/ da/gen_be_stage2a.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/ da/gen_be_stage3.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/ da/gen_be_stage4_regional.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/ da/gen_be_diags_read.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/ da/gen_be_diags.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/ da/gen_be_cov2d.exe
      /wrfhelp/SOURCE_CODE/WRFDA/var/ da/gen_be_cov3d.exe

    • Edit gen_be_wrapper.ksh
    • Pay special attention to the following settings:
      export START_DATE=2007010300
      export END_DATE=2007011012
      export NUM_LEVELS=27
      export BIN_TYPE=5
      export FC_DIR=/wrfhelp/DATA/VAR/Con200/fc
      export RUN_DIR=/data1/class13/test/gen_be${BIN_TYPE}
      export DOMAIN=01
      export FCST_RANGE1=24
      export FCST_RANGE2=12
      export INTERVAL=12
      export STRIDE=1

    • Run gen_be_wrapper.ksh

      ./gen_be_wrapper.ksh

    • Check output

      be.dat
      Diagnostics files

    • Graphics

      /wrfhelp/SOURCE_CODE/WRFDA/var/scripts/gen_be/gen_be_plot_wrapper.ksh

    • Advanced practice

      Change the number of dates that are used and compare the results.

    Running single ob tests

    The procedure is the same as Running WRF-Var except for adding and changing the following namelist.input settings:

    • Edit namelist.input

      &wrfvar15
      num_pseudo = 1,
      pseudo_x = 23.0
      pseudo_y = 23.0
      pseudo_z = 14.0
      pseudo_err = 1.0
      pseudo_val = 1.0
      /
      &wrfvar19
      pseudo_var = ‘u’ (Note: pseudo_var can be u, v, t, p, q. If pseudo_var is q, then the reasonable values of pseudo_err and pseudo_val are 0.001)
      /

      Note: You may like to repeat this exercise for other observations like temperature (“t”), pressure “p”, specific humidity “q” etc.

    • Run da_wrfvar.exe

      /wrfhelp/SOURCE_CODE/WRFDA/var/da/da_wrfvar.exe

    • Check output

      Diagnostics files (especially statistics)

    • Graphics

      /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/WRF-Var_plot.ncl
      /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/WRF_contributed.ncl.test
      /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/psot_xy_auto.ncl
      /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/psot_xz_auto.ncl
      /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/psot_yz_auto.ncl

    • Other pracrtice

        • Response of BE length scaling parameter:

          Run single observation test with following additional parameters in record &wrfvar7 of namelist.input
          &wrfvar7
          len_scaling1 = 0.5, # reduce psi length scale by 50%
          len_scaling2 = 0.5, # reduce chi_u length scale by 50%
          len_scaling3 = 0.5, # reduce T length scale by 50%
          len_scaling4 = 0.5, # reduce q length scale by 50%
          len_scaling5 = 0.5, # reduce Ps length scale by 50%
          /

          Note: You may like to try the response of individual variable by setting one parameter at one time. See the spread of analysis increment.

        • Response of changing BE variance:

          Run single observation test with following additional parameters in record &wrfvar7 of namelist.input
          &wrfvar7
          var_scaling1 = 0.25,   # reduce psi variance by 75%
          var_scaling2 = 0.25,   # reduce chi_u variance by 75%
          var_scaling3 = 0.25,   # reduce T variance by 75%
          var_scaling4 = 0.25,   # reduce q variance by 75%
          var_scaling5 = 0.25,   # reduce Ps variance by 75%
          /

          Note: You may like to try the response of individual variable by setting one parameter at one time. See the magnitude of analysis increments.

  1. Radar data assimilation Help

    The procedure is the same as Running WRF-Var except for an extra radar input file and  adding and changing some namelist.input settings:

    • Source code

      WRFDA/var/da/da_wrfvar.exe  is the executables that will be used in this practice.

    • Link or copy preprocessed radar observation file as ob.radar in your WRF-Var working directory

      cp /wrfhelp/DATA/VAR/Radar/ob.radar  ./ob.radar

    • Link or copy WRF-Var-ready observation as ob.ascii in your WRF-Var working directory (optional).

      ln –sf /wrfhelp/DATA/VAR/Radar/ob.ascii ./ob.ascii

    • Link or copy first guess as fg in your WRF-Var working directory.

      ln -sf /wrfhelp/DATA/VAR/Radar/wrfinput_d01  ./fg

    • Link or copy background error statistics file as be.dat in your WRF-Var working directory.

      ln -sf /wrfhelp/DATA/VAR/Radar/be.dat ./be.dat

    • Link or copy a constant table that is needed for roughness calculation in your WRF-Var working directory.

      ln -sf /wrfhelp/SOURCE_CODE/WRFDA/run/LANDUSE.TBL ./LANDUSE.TBL

    • Edit namelist.input

      &wrfvar2
      calc_w_increment=.true. (to have w increments)

      &wrfvar4
      use_radarobs=.true.  (to read in and assimilate radar data)
      use_radar_rv=.true.  (to assimilate radial velocity)
      use_radar_rf=.true.  (to assimilate reflectivity)
      /

    • Run da_wrfvar.exe

      /wrfhelp/SOURCE_CODE/WRFDA/var/da/da_wrfvar.exe

    • Check output

      wrfvar_output
      Diagnostics files

    • Graphics

      /wrfhelp/SOURCE_CODE/WRFDA/var/graphics/ncl/WRF-Var_plot.ncl
      analysis increments fields

  2. Hybrid data assimilation Help

    Source code
    Executables that will be used in this practice are:
    /wrfhelp/SOURCE_CODE/WRFDA_hybrid/var/da/gen_be_ensmean.exe
    /wrfhelp/SOURCE_CODE/WRFDA_hybrid/var/da/gen_be_ep2.exe
    /wrfhelp/SOURCE_CODE/WRFDA_hybrid/var/da/da_wrfvar.exe

    Step 1: run gen_be_ensmean.exe to calculate ensemble mean.

    cd your_working_dir

    • Get template ensemble mean file and template ensemble variance file:

      2006102712/wrfout_d01_2006-10-28_00:00:00
      2006102712/wrfout_d01_2006-10-28_00:00:00.vari

      Copy them to your working directory. They will be overwritten.
      cp –r /wrfhelp/DATA/VAR/Hybrid/fc/2006102712 .

    • Get ensembles:

      A set of 10-member ensemble forecasts is provided for this practice.
      Copy or link them to your working directory.

      2006102712.e001/wrfout_d01_2006-10-28_00:00:00
      2006102712.e002/wrfout_d01_2006-10-28_00:00:00
      2006102712.e003/wrfout_d01_2006-10-28_00:00:00
      2006102712.e004/wrfout_d01_2006-10-28_00:00:00
      2006102712.e005/wrfout_d01_2006-10-28_00:00:00
      2006102712.e006/wrfout_d01_2006-10-28_00:00:00
      2006102712.e007/wrfout_d01_2006-10-28_00:00:00
      2006102712.e008/wrfout_d01_2006-10-28_00:00:00
      2006102712.e009/wrfout_d01_2006-10-28_00:00:00
      2006102712.e010/wrfout_d01_2006-10-28_00:00:00

      ln –sf /wrfhelp/DATA/VAR/Hybrid/fc/2006102712.e0*  .

    • Edit gen_be_ensmean_nl.nl

      gen_be_ensmean_nl.nl
      &gen_be_ensmean_nl
          directory = './2006102712'
          filename = 'wrfout_d01_2006-10-28_00:00:00'
          num_members = 10,
          nv = 7,
          cv = 'U', 'V', 'W', 'PH', 'T', 'MU', 'QVAPOR' /

    • Run gen_be_ensmean.exe

      /wrfhelp/SOURCE_CODE/WRFDA_hybrid/var/da/gen_be_ensmean.exe

    • Check to see output files:

      2006102712/ wrfout_d01_2006-10-28_00:00:00 (ensemble mean)
      2006102712/ wrfout_d01_2006-10-28_00:00:00.vari (ensemble variance)

    • Graphics: Display results, you may use graphics script provided:

      /wrfhelp/DATA/VAR/Hybrid/ncl/ens_mean_std_dev.ncl

    Step 2: Run gen_be_ep2.exe to calculate ensemble perturbations.

    • Create and change working directory

      mkdir –p 2006102800/ep
      cd 2006102800/ep

    • Run gen_be_ep2.exe

      gen_be_ep2.exe requires 4 command-line arguments as defined below:
      DATE,  NUM_MEMBER, DIRECTORY, FILENAME

      /wrfhelp/SOURCE_CODE/WRFDA_hybrid/var/da/gen_be_ep2.exe 2006102800 10  ../../2006102712 wrfout_d01_2006-10-28_00:00:00

    • Check output files generated by your run:

      A list of binary files will be created under 2006102800/ep directory.
      tmp.e* are temporary files that can be removed.
      ps.e001         q.e001          t.e001          tmp.e001        u.e003          v.e003
      ps.e002         q.e002          t.e002          tmp.e002        u.e004          v.e004
      ps.e003         q.e003          t.e003          tmp.e003        u.e005          v.e005
      ps.e004         q.e004          t.e004          tmp.e004        u.e006          v.e006
      ps.e005         q.e005          t.e005          tmp.e005        u.e007          v.e007
      ps.e006         q.e006          t.e006          tmp.e006        u.e008          v.e008
      ps.e007         q.e007          t.e007          tmp.e007        u.e009          v.e009
      ps.e008         q.e008          t.e008          tmp.e008        u.e010          v.e010
      ps.e009         q.e009          t.e009          tmp.e009        u.mean         v.mean
      ps.e010         q.e010          t.e010          tmp.e010        u.stdv           v.stdv
      ps.mean        q.mean         t.mean          u.e001           v.e001
      ps.stdv          q.stdv           t.stdv            u.e002           v.e002

    • Graphics: Display results, you may use graphics script provided:

      /wrfhelp/DATA/VAR/Hybrid/ncl/ens_perturbations.ncl

    Step 3: Run WRF-Var using ensembles mean from Step 1 and ensemble perturbations from Step 2 together with other standard WRF-Var settings.

    • Link necessary input files to your working directory:

      ob (ob.ascii) file and BE (be.dat) files are provided for this practice.
      ln -sf  2006102800/ep ./ep
      ln -sf  2006102712/wrfout_d01_2006-10-28_00:00:00 ./fg
      ln -sf  /wrfhelp/SOURCE_CODE/WRFDA_hybrid/run/LANDUSE.TBL .
      ln -sf  /wrfhelp/DATA/VAR/Hybrid/ob/2006102800/ob.ascii ./ob.ascii
      ln -sf  /wrfhelp/DATA/VAR/Hybrid/be/be.dat .

    • Edit namelist.input

      Pay special attention to the following settings.
      &wrfvar7
      je_factor=2.0
      /
      &wrfvar16
      ensdim_alpha=10
      alphacv_method=2
      alpha_corr_scale=1500.0
      /

    • Run da_wrfvar.exe as you’ve done in other exercises.

     

    • Check output files generated by your run:

      wrfvar_output
      WRFDA diagnostics and log files.

    • Graphics: Display results, you may use graphics script provided:

      /wrfhelp/DATA/VAR/Hybrid/ncl/hybrid_increments.ncl
      /wrfhelp/DATA/VAR/Hybrid/ncl/cost_fn.ncl

     

    Tailor your own tests:

    Having completed above listed tasks and would like to do some more tests; you may consider running hybrid system with different settings that can impact outcome:

    1. Ensemble covariance weighting factor (je):

    JE_FACTOR==10.0 (Note that jb=je_factor/(je_factor-1), and hence jb=1.11)
    JE_FACTOR==1.25 (jb=5)
    JE_FACTOR==1.1 (Jb=11)

    2. Hybrid covariance localization scale: ALPHA_CORR_SCALE

    The default value is 1500km, you may try following values and see how they impact the results:

    ALPHA_CORR_SCALE=500
    ALPHA_CORR_SCALE=250

  1. Optional practice

Compile the Var code:

cd your_code_directory
cp /wrfhelp/SOURCE_CODE/WRFDA_v3_0_1_1.tar.gz .
cp /wrfhelp/SOURCE_CODE/WRFDA_v3_0_1_1_bugfix.tar.gz .
cp /wrfhelp/SOURCE_CODE/WRFDA_v3_0_1_1_genbefix.tar .
tar zxvf WRFDA_v3_0_1_1.tar.gz
cd WRFDA
tar zxvf ../WRFDA_v3_0_1_1_bugfix.tar.gz (should untar under WRFDA directory)
tar zxvf ../WRFDA_v3_0_1_1_genbefix.tar (should untar under WRFDA directory)

setenv BLAS /usr/local/blas
setenv LAPACK /usr/local/lapack
setenv BUFR /usr/local/BUFRLIB

(in the WRFDA directory)
./configure wrfda (choose option 5)
./compile all_wrfvar

Check the executables under var/da

Compile the obsproc code:

cd var/obsproc
make