VERSION 2.0

Updated May, 2004

- A number of grads scripts have been included. THESE ARE ONLY 
  EXAMPLES. See below for more details.

- Add a couple of changes to the control_file: read comments
  on this file below.

- Add checks to see if we need to interpolate to 
  pressure or height and if all the fields to do this
  are in the input file. If not, switch back to no
  interpolation

- Add check to first see if a field is in the input file.
  If field is not in input file, it will be removed from
  plotting list.

- Fix plotting of INTEGER fields IVGTYP and ISLTYP

- .ctl file can now be made for intervals less
  than one hour

- Add map plotting for Mercator and PS

- Add rotational winds for LC and PS

- Fix to 2D data if using more than one input file 
  (no effect at all if input data is in one file)

- Change to allow for 1D simulations (ie simulations
  with 2 unstaggered points in both x and y direction)

- Height plotting no longer only linear

- This README file updated

___________________________________________________________________

Updated 22 September 2003

This version of converter is for WRF mass-coordinate model data.

wrf_to_grads is a tool to convert wrf netcdf output to grads
files.  The program is written in fortran90.  

To build the code, first edit the makefile to specify the
approriate paths for the netcdf libraries.
Then, type "make" to build the converter.

Compiler options are only provided for Alpha, Linux, Sun and SGI.
If you are compiling this program on another computer, you need
to modify the compiler options in Makefile.

To run the code, first edit the ascii input file "control_file"
specifying:

To run the converter -> wrf_to_grads control_file grads_output_file
  This will create a "grads_output_file.ctl" and a "grads_output_file.dat"

______________________COMMENTS ON CONTROL FILE______________________


   1.   times from your output that should be processed; 
          In the control file, the times can be specified as the   
          time strings contained in the netcdf file (that can be 
          viewed using the netcdf utility "ncdump"). If you would like
          to view ONLY 3 times rather than all the output time, specify 
          the number of times as 3, and list the times you are interested
          in, eg:
          3
          2003-03-08_12:00:00
          2003-03-09_00:00:00
          2003-03-09_12:00:00
          end_of_time_list

          Alternatively:
          Setting times to get to 2 and listing 3 times are also 
          allowed. In this case, only the first two times will be
          considered. 
          2
          2003-03-08_12:00:00
          2003-03-09_00:00:00
          2003-03-09_12:00:00
          end_of_time_list

          If you are interested in ALL the times in your output file, add
          a "-" before the number of times, and the list of times will 
          be ignored. Again, the number in the first row do not need
          to correspond to the number of times listed below it.
          -3
          2003-03-08_12:00:00
          2003-03-09_00:00:00
          2003-03-09_12:00:00
          end_of_time_list
          

          DO NOT REMOVE OR INDENT "end_of_time_list" 


 2&3.   3D variables (including soil variables) and 2D variables;

          Variables are specified using the variable names in the 
          netcdf files. Again, the names in the netcdf files can be 
          viewed using the netcdf utility "ncdump", or the 
          "read_wrf_nc.f" utility.  

          A long list of names are included in the sample control file.
          A variable in the list will be INCLUDED in the grads output
          file, if it starts in the first column of the control file.
          All variables that have been indented (single white space
          in from of variable) will be ignored by the converter.

  	  Any 3D/2D variable that is in your wrfout file, but not in 
          these lists, can simply be added to these lists, and they 
          will be written to the grads output files.
          SOIL fields or other 3D fields can be added to the 3D
          field list.

          If you ADD a diagnostic variable to the list, you need to
          ADD CODE changes in the following places:
            - SUBROUTINE check_all_variables
            - SUBROUTINE check_special_variable (for 3D fields)
            - SUBROUTINE g_output_3d (for 3D fields)
            - SUBROUTINE g_output_2d (for 2D fields)

          ALL variables in list needs a description. These will
          be used in the .ctl file

          DO NOT REMOVE OR INDENT "end_of_3dvar_list" or
          "end_of_2dvar_list"


   4.   wrf output files to use;
   
         This can be a list of files for the converter to examine 
         to find the output times for which it is looking.  If you 
         want all the times in all the files, make sure that the file 
         list is ordered from earliest to latest times.  

         Full and relative paths are OK

         If you do NOT want to include a file, you can indent it,
         and the converter will ignore the file

        DO NOT REMOVE OR INDENT "end_of_file_list"


   After the "end_of_file_list" line, the converter will expect
   to get information in preset places. So DO NOT ADD/DELETE/INDENT
   lines.


   5.   if this is a "real" / "ideal" or static input file.


   6.   if you would like a map background or not (for ideal use 0),


   7.   the vertical grid 

          Specifying 0 means output the model grid unchanged 
          (i.e., sigma surfaces are flat in grads).  
          In this case NO extra information is needed, and the remainder 
          of the control file will be ignored.

          Specifying -1 causes the variables to be interpolated to 
          a grid defined by the heights in the column at the lowest 
          terrain point in the domain.  
          In this case NO extra information is needed, and the remainder 
          of the control file will be ignored.

          Specifying  1 will result in interpolation to either 
          "z" or "p". (The code will expect 3 blank lines between
          the "1", and the first level to be interpolated to - do no
          remove any of these lines).
          To interpolate data to height/pressure levels, simply list
          the levels you are interested in from ground to top. 
          Pressure level data should be in mb and height level data 
          in km. Depending on the values, the code will figure our
          if it needs to interpolate to height/pressure levels.

          Example to interpolate to pressure level data:
          1                   ! specify grads vertical grid
                              !  0=cartesian,
                              ! -1=interp to z from lowest h
                              !  1 list levels (either height in km, or pressure in mb)
          1000.0
          950.0
          900.0
          850.0
          800.0
          750.0
          700.0
          650.0
          600.0
          550.0
          500.0
          450.0
          400.0
          350.0
          300.0
          250.0
          200.0
          150.0
          100.0

          Example to interpolate to height level data:
          1                   ! specify grads vertical grid
                              !  0=cartesian,
                              ! -1=interp to z from lowest h
                              !  1 list levels (either height in km, or pressure in mb)
          .25   
          .50
          .75
          1.0
          2.0
          4.0
          6.0
          8.0
          10.0
          12.0
          14.0
          16.0
          18.0
          20.0

          NOTE: Indenting will have NO effect here. To remove a
                level, you need to detele the full line.

    Some examples are included in this directory:
         control_file
         control_file_height
         control_file_pressure

_________________END :  COMMENTS ON CONTROL FILE______________________


________________________COMMENTS ON GRADS SCRIPTS_____________________

The scripts provided are only examples of the type of plots one
can generate with GrADS data. The user will need to modify these
script to suit their data (Example, if you did not specify 0.25 km 
and 2 km as levels to interpolate to when you run the "bwave" data
through the converter, the "bwave.gs" script will not display any
plots, since it will specifically look for these to levels).

GENERAL SCRIPTS
cbar.gs        : Plot color bar on shaded plots (from GrADS home page)
rgbset.gs      : Some extra colors (Users can add/change colors from
                 color number 20 to 99)
skew.gs        : Program to plot skewT (modified version of function
                 as found on http://www.ems.psu.edu/~bryan/mm5/grads/)
                 TO RUN TYPE: run skew.gs (needs pressure level 
                                           TC,TD,U,V as input)
                 User will be prompted if a hardcopy of the plot must
                 be create - 1 for yes and 0 for no. If 1 is entered a
                 GIF image will be created.
                 Need to enter lon/lat of point you are interested in
                 Need to enter time you are interested in
                 Can overlay 2 different times 

SCRIPTS FOR REAL DATA
real_surf.gs  : Need input data on model levels
plevels.gs    : Need model output on pressure levels
rain.gs       : Need a model output data set (any vertical coordinate), 
                that contain fields "RAINC" and "RAINNC"
cross_z.gs    : Need z level data as input
                Will plot a NS and EW cross section of RH and T (C)
                Plots will run through middel of the domain
zlevels.gs    : Need input data on height levels
                Will plot data on 2, 5, 10 and 16km levels
input.gs      : Need WRF INPUT data on height levels

SCRIPTS FOR IDEALIZED DATA
bwave.gs      : Need height level data as input
                Will look for 0.25 and 2 km data to plot
grav2d.gs     : Need normal model level data as input
hill2d.gs     : Need normal model level data as input
qss.gs        : Need height level data as input. Will look for heights
                0.75, 1.5, 4 and 8 km to plot
sqx.gs        : Need normal model level data a input
sqy.gs        : Need normal model level data a input


All above scripts will prompt user is a hardcopy (GIF) image should
be created as well.


_________________END :  COMMENTS ON GRADS SCRIPTS_____________________


======================================================================


NOTE:
	Comments/suggestions are very welcome
	If you have code for additional diagnostic variables, please
	send it to wrfhelp@ucar.edu.