User’s Guide for Advanced Research WRF (ARW) Modeling System Version 2

 

Chapter 8: Post-Processing Utilities

Table of Contents

·        Introduction

·        NCL

·        RIP4

·        WRF2GrADS

·        WRF2VIS5D

·        read_wrf_nc utility

Introduction

 

There are a number of visualization tools available to display ARW (http://wrf-model.org/) model data.  Model data in netCDF format, can essentially be displayed using any tool capable of displaying this data format. Currently four post-processing utilities are supported, NCL, RIP4, WRF2GrADS and WRF2VIS5D. All these programs can only read ARW data in netCDF format.

 

Required software:

The only library that is always required is the netCDF package from Unidata (http://www.unidata.ucar.edu/  :  login > Downloads > NetCDF - registration login required). The ARW post-processing packages assume that the data from the ARW model is using the netCDF libraries.

 

netCDF stands for Network Common Data Form. This format is platform independent, i.e., data files can be read on both big_endian and little_endian computers, regardless of where the file was created. To use the netCDF libraries, ensure that the paths to these libraries are set correct in your login scripts as well as all Makefiles.

Additional libraries required by each of the four supported post-processing packages:

 

·        NCL (http://ngwww.ucar.edu/), requires the NCAR Command Language written by NCAR Scientific Computing Division

·        RIP (http://www.atmos.washington.edu/~stoeling/), requires NCAR Graphics

·        GrADS (http://grads.iges.org/home.html), requires the GrADS visualization software

·        Vis5D (http://www.ssec.wisc.edu/~billh/vis5d.html), requires the Vis5D visualization software


NCL

 

Ready-made NCL scripts are provided to create meta files for both real and ideal datasets. These scripts are relatively easy to read and change to generate different or more plots.

Necessary software

·        Obtain the WRF_NCL TAR file from the WRF Download page (http://www2.mmm.ucar.edu/wrf/users/download/get_source.html)

·        NCAR Command Language libraries (http://ngwww.ucar.edu/)

Hardware

The code has been ported to the following machines

·        DEC Alpha

·        Linux

·        SUN

·        IBM

Steps to compile and run

Untar WRF_NCL TAR file

Inside the TAR file, you will have the following files:

    

README_FIRST

README_NCL

gsn_code.ncl

skewt_func.ncl

wrf_plot.ncl

wrf_user_mass.ncl

 

Readme Files and

NCL function scripts

           

wrf_user_fortran_util_0.f

make_ncl_fortran

make_ncl_fortran.alpha

make_ncl_fortran.linux

make_ncl_fortran.sun   

FORTRAN utility file and

make files to compile the utility program

wrf_em_b_wave.ncl

wrf_em_hill2d.ncl

wrf_em_grav2d.ncl

wrf_em_squall_2d_x.ncl

wrf_em_squall_2d_y.ncl

 

wrf_em_real_input.ncl

wrf_em_real.ncl

wrf_em_qc.ncl

wrf_em_qss.ncl

wrf_em_qv.ncl

wrf_em_sfc.ncl

wrf_em_slp.ncl

wrf_em_the.ncl

NCL scripts for ideal and real data

 

 

Build the external function, wrf_user_fortran_util_0.so

·        NCL has the ability to link in FORTRAN shareable object files. This provides an easy way to compute diagnostic quantities and to performing interpolations.

·         Presently, only one FORTRAN object needs to be built - wrf_user_fortran_util_0.so

·        To build the FORTRAN object, running one of the make_ncl_fortran csh scripts that will build the shared-object library

e.g. make_ncl_fortran    wrf_user_fortran_util_0

·        If successful, you will see these files created in your directory:

                        so_locations

                        wrf_user_fortran_util_0.o

                  wrf_user_fortran_util_0.so

·        HINT:  The most common error when building the external function, is not finding the “wrapit77” function on your system. “wrapit77” is part of the NCAR Graphics routines. If you run into this problem, make sure your path to this function is setup correctly. (If all else fails, locate the file on your system and copy it to your WRF_NCL directory.)

Edit the script you want to run
 

·        Mostly it is only necessary to change the location and name of the file:

a = addfile("../../WRFV2/run/wrfout_d01_2000-01-24_00:00:00.nc","r")

·        Do not remove the ".nc" after the file name - the script needs it (Note the .nc is NOT part of the actual file name.)

Run the NCL script

·        To run the script, type:

ncl < NCL_script   (or “ncl  NCL_script”  for higher versions of NCL)

e.g.     ncl < wrf_em_real.ncl

·        This will create a meta file

e.g. wrf_mass_plots

·        The name of the meta file that is created, is controlled by the line:

   wks = wrf_open_ncgm("wrf_mass_plots")     inside the NCL script

View the meta file

·        To view the meta file, use the command "idt", e.g.

idt wrf_mass_plots

·        Examples of plots created for both idealized and real cases are available from:

http://www2.mmm.ucar.edu/wrf/users/graphics/WRF_NCL/NCL.htm 

 

Miscellaneous

To convert NCGM files to GIF images, a very handy tool is the ncgm2gif script (http://ngwww.ucar.edu/info/ncgm2gif)

To run the script, type:

   ncgm2gif    metafile

        e.g.     ncgm2gif -res 500x500 -nomerge test.cgm

This will convert all images in test.cgm to 500x500 pixel gif images, called testxxx.gif

A compete list of options are available inside the ncgm2gif script (http://ngwww.ucar.edu/info/ncgm2gif)

 

For print quality images, create pdf images directly via the ncl scripts.

 

RIP4

RIP4 was adapted from the RIP code, originally developed to display MM5 model data. (Primarily Mark Stoelinga, from both NCAR and the University of Washington developed RIP).

 

The code reads ARW (and MM5) output files and creates meta file plots.

Since version 4.1 RIP4 can read both real and idealized ARW datasets.

 

The RIP users' guide (http://www2.mmm.ucar.edu/wrf/users/docs/ripug.htm) is essential reading.

 Necessary software

·        Obtain the RIP4 TAR file from the WRF Download page (http://www2.mmm.ucar.edu/wrf/users/download/get_source.html)

·        NCAR Graphics software (http://ngwww.ucar.edu/)

Hardware

The code has been ported to the following machines

·        DEC Alpha

·        Linux

·        MAC (xlf and absoft compilers)

·        SUN

·        SGI

·        IBM

·        CRAY

·        Fujitsu

Steps to compile and run

Untar RIP4.TAR.gz file

Inside the TAR file you will see the following files:

CHANGES
Doc/

Makefile

README

color.tbl

psadilookup.dat

rip_sample.in

ripdp_sample.in

src/

stationlist

tabdiag_sample.in

tserstn.dat
bwave.in                      | new in version 4.1
custom_maps/             | new in version 4.1
grav2d_x.in                 | new in version 4.1
hill2d.in                       | new in version 4.1
qss.in                           | new in version 4.1
sqx.in                           | new in version 4.1
sqy.in                           | new in version 4.1

Compile the code

Typing "make" will produce the following list of compile options

 

make dec

make linux
make mac_xlf        
make mac  

make sun

make sun2

make sun90

make sgi

make sgi64

make ibm

make cray

make vpp300

make vpp5000

make clean

make clobber

To Run on DEC_ALPHA

To Run on LINUX

To Run on MAC_OS_X with Xlf Compiler                        To Run on MAC_OS_X with Absoft Compiler

To Run on SUN

To Run on SUN if make sun didn't work

To Run on SUN usingF90

To Run on SGI

To Run on 64-bit SGI

To Run on IBM SP2

To Run on NCAR's Cray

To Run on Fujitsu VPP 300

To Run on Fujitsu VPP 5000

to remove object files

to remove object files and executables

             

Pick the compiler option for the machine you are working on and type:
"make machine"

   e.g.    make dec   will compile the code for a DEC Alpha computer

 

 After a successful compilation, the following new files should be created.


rip

Post-processing program.
Before using this program, first convert the input data to the correct format expected by this program, using the program ripdp_wrf.

ripcomp

This program reads in two rip data files and compares their contents.

ripdp_mm5

RIP Data Preparation program for MM5 input data 

ripdp_wrf

RIP Data Preparation program for WRF input data 

ripinterp

This program reads in model output (in rip-format files) from a coarse domain and from a fine domain, and creates a new file which has the data from the coarse domain file interpolated (bi-linearly) to the fine domain.  The header and data dimensions of the new file will be that of the fine domain, and the case name used in the file name will be the same as that of the fine domain file that was read in.

ripshow

This program reads in a rip data file and prints out the contents of the header record. 

showtraj

Sometimes, you may want to examine the contents of a trajectory position file. Since it is a binary file, the trajectory position file cannot simply be printed out. showtraj, reads the trajectory position file and prints out its contents in a readable form.  When you run showtraj, it prompts you for the name of the trajectory position file to be printed out. 

tabdiag

If fields are specified in the plot specification table for a trajectory calculation run, then RIP produces a .diag file that contains values of those fields along the trajectories. This file is an unformatted Fortran file; so another program is required to view the diagnostics. tabdiag serves this purpose. 

upscale

This program reads in model output (in rip-format files) from a coarse domain and from a fine domain, and replaces the coarse data with fine data at overlapping points. Any refinement ratio is allowed, and the fine domain borders do not have to coincide with coarse domain grid points.

 

 Prepare the data

·        To prepare the data for the RIP program, one much first run RIPDP (RIP Data Preparation), for WRF

·        As this step will create a large number of extra file, creating a new directory to place these files in, will enable you to manage the files easier

                 mkdir DATA

·        Edit the namelist    ripdp_sample.in  (the use of this namelist is optional)
The most important information needed in the namelist, is the times you want to process

·        Run ripdp for WRF
      ripdp_wrf   [-n namelist_file]   casename   [basic|all]   data_file_1 data_file_2 data_file_3 ...
      e.g.    ripdp_wrf   -n ripdp_sample.in   DATA/real   basic   ../DATA/real/wrfout_d01_2000-01-24_12:00:00 >& ripdp_log

Create graphics - step 1

·        The first step in creating the graphics you are interested in, is to edit the User Input File (UIP)  rip_sample.in  (or create your own UIP)

·        The UIP file, consists of

-        2 namelists userin (which control the general input specifications) and trajcalc (which control the creation of trajectories); and

-        the Plot Specification Table (PST), used to control the generation of the graphics

·        namelist: userin

Namelist Variable

Variable Type

Description

idotitle

Integer

Control first part of title line.

titlecolor

Character

Control color of the title lines

ptimes

Integer

Times to process.
This can be a string of times or a series in the form of A,-B,C, which means "times from hour A, to hour B, every C hours"

ptimeunits

Character

Time units.
This can be either `h' (hours), `m' (minutes), or `s' (seconds)

tacc

Real

Time tolerance in seconds.
 Any time in the model output that is within tacc seconds of the time specified in ptimes will be processed.

timezone

Integer

Specifies the offset from Greenwich time.

iusdaylightrule

Integer

Flag to determine if US daylight saving is applied.

iinittime

Integer

Controls the plotting of the initial time on the plots.

ivalidtime

Integer

Controls the plotting of the plot valid time.

inearesth

Integer

Plot time as two digits rather than 4 digits.

flmin

Real

Left frame limit

flmax

Real

Right frame limit

fbmin

Real

Bottom frame limit

ftmax

Real

Top frame limit

ntextq

Integer

Quality of the text

ntextcd

Integer

Text font

fcoffset

Integer

Change initial time to something other than output initial time.

idotser

Integer

Generate time series output files (no plots) only ASCII file that can be used as input to a plotting program).

idescriptive

Integer

Use more descriptive plot titles.

icgmsplit

Integer

Split metacode into several files.

maxfld

Integer

Reserve memory for RIP.

ittrajcalc

Integer

Generate trajectory output files (use namelist trajcalc when this is set).

imakev5d

Integer

Generate output for Vis5D

 

·        Plot Specification Table

The second part of the RIP UIF consists of the Plot Specification Table. The PST provides all of the user control over particular aspects of individual frames and overlays. The basic structure of the PST is as follows:

-        The first line of the PST is a line of consecutive equal signs. This line as well as the next two lines is ignored by RIP, it is simply a banner that says this is the start of the PST section.

-        After that there are several groups of one or more lines separated by a full line of equal signs. Each group of lines is a frame specification group (FSG), and it describes what will be plotted in a single frame of metacode. Each FSG must end with a full line of equal signs, so that RIP can determine where individual frames starts and ends.

-        Each line within a FGS is referred to as a plot specification line (PSL). A FSG that consists of three PSL lines will result in a single metacode frame with three overlaid plots.

Example of a frame specification groups (FSG's):

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

   feld=tmc; ptyp=hc; vcor=p; levs=850,700,-300,100; >

         cint=2; cmth=fill; cosq=-32,light.violet,-24,violet,>

         -16,blue,-8,green,0,yellow,8,red,>   

         16,orange,24,brown,32,light.gray

   feld=ght; ptyp=hc; cint=30; linw=2

   feld=uuu,vvv; ptyp=hv; vcmx=-1; colr=white; intv=5

   feld=map; ptyp=hb

   feld=tic; ptyp=hb

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

This FSG will generate 5 overlaid plots:

 

-        Temperature in degrees C (feld=tmc). This will be plotted as a horizontal contour plot (ptyp=hc), on pressure levels (vcor=p). The pressure levels used will be 850 and 700 to 300 in steps of 100 mb (thus 5 plots will be generated, on 850, 700, 600, 500, 400, and 300 mb). The contour intervals are set to 2 (cint=2), and shaded plots (cmth=fill) will be generated with a color range from light violet to light gray.

-        Geopotential heights (feld=ght) will also be plotted as a horizontal contour plot. This time the contour intervals will be 30 (cint=30), and contour lines, with a line width of 2 (linw=2) will be used.

-        Wind vectors (feld=uuu,vvv), plotted as barbs (vcmax=-1).

-        A map background will be displayed (feld=map), and

-        Tic marks will be placed on the plot (feld=tic).

Create graphics - step 2

·        First set the environment variable:
           setenv RIP_ROOT your_rip4_directory

·        Run rip
      rip   [-f] model_case_name   rip_case_name
      e.g.    rip   -f DATA/real    rip_sample

·        If this is successful, the following files will be created
           rip_sample.cgm            gmeta file       
           rip_sample.out              log file - view this file if a problem occurred

View the meta file

·        To view the meta file, use the command "idt", e.g.
idt rip_sample.cgm
Examples of plots created for both idealized and real cases are available from:
http://www2.mmm.ucar.edu/wrf/users/graphics/RIP4/RIP4.htm 

 

Miscellaneous

To convert NCGM files to GIF images, a very handy tool is the ncgm2gif script (http://ngwww.ucar.edu/info/ncgm2gif)

To run the script, type:

   ncgm2gif    metafile

        e.g.     ncgm2gif -res 500x500 -nomerge test.cgm

This will convert all images in test.cgm to 500x500 pixel gif images, called testxxx.gif

A compete list of options are available inside the ncgm2gif script (http://ngwww.ucar.edu/info/ncgm2gif)

WRF2GrADS

 

The WRF2GrADS converter reads ARW netCDF files, and creates "ieee", GrADS data files, and corresponding grads_control (.ctl) files.

 

The converter can process all ARW input, output and static (real and idealized data) in netCDF format.

 

Necessary software

·        Obtain the WRF2GrADS TAR file from the WRF Download page (http://www2.mmm.ucar.edu/wrf/users/download/get_source.html)

·        GrADS software - You can download and install GrADS from   http://grads/iges.org/grads

Hardware

The code has been ported to the following machines

·        DEC Alpha

·        Linux (pgf and intel compilers)

·        MAC

·        SUN

·        SGI

·        IBM

Steps to compile and run

Untar WRF2GrADS TAR file

            Inside the TAR file you will have the following files:

Makefile
README

 

control_file
control_file_height
control_file_pressure

Sample control file

module_wrf_to_grads_netcdf.F
module_wrf_to_grads_util.F
wrf_to_grads.F

Source code

cbar.gs
rgbset.gs

Utility scripts

skew.gs
real_surf.gs
plevels.gs
rain.gs
cross_z.gs
zlevels.gs
input.gs
bwave.gs
grav2d.gs
hill2d.gs
qss.gs
sqx.gs
sqy.gs

Sample scripts to generate plots for real/idealized datasets

 Compile

·        To compile the code, EDIT the Makefile to select the compiler flags for your machine

·        Type:    make

·        This will create a   wrf_to_grads   executable

Edit the control_file file

-2
2000-01-24_12:00:00
2000-01-24_18:00:00
2000-01-25_00:00:00
end_of_time_list

Times to process

o  If the first line contains a negative number, ALL times in the WRF file are processed.

o  A positive number means process that number of times. In this case the times to process must be listed.

o  The number in the first line, do not need to match the number of times listed. For the case where a positive number is used, the first x number of times will be processed.

o  Do not remove or indent the line "end_of_time_list", the code depends on this line.

U                   ! U Compoment of wind
V                   ! V Component of wind
   UMET           ! U wind - rotated
   VMET           ! V wind - rotated 
W                  ! W Component of wind
THETA          ! Theta
TK                 ! Temperature in K
TC                 ! Temperature in C
TKE              ! TURBULENCE KINETIC ENERGY
P                    ! Pressure (HPa)
   Z                    ! Height (m)
QVAPOR      ! Vapor
QCLOUD      ! Cloud Water
TSLB             ! SOIL TEMPERATURE
   SMOIS          ! SOIL MOISTURE
end_of_3dvar_list

3D variables to process

o  List of all 3D variables you would like processed.

o  If you do not wish to process a specific field, you can skip it, but simply indenting the line in which the field it listed. In this example, UMET, VMET, Z, and SMOIS will not be processed.

o  If a variables is present in the WRF netCDF file, but not in this list, it can be processed by simply adding it to the list.

o  To add a diagnostic, requires code changes.

o  All 3D fields go here, including soil fields, which have a different number of levels.

o  The "!" and description behind each field name is required by the program. If you add variables, remember to add the description of the field as well.

o  Do not remove or indent the line "end_of_3dvar_list", the code depends on this line.

RAINC            ! TOTAL CUMULUS PRECIPITATION
RAINNC         ! TOTAL GRID SCALE PRECIPITATION
slvl                    ! sea level pressure
T2                    ! TEMP at 2 M
U10                  ! U at 10 M
   U10M              ! U at 10 M - rotated
V10                 ! V at 10 M
   V10M              ! V at 10 M - rotated
XLAT              ! LATITUDE
XLONG          ! LONGITUDE
XLAND          ! LAND MASK
end_of_2dvar_list

2D variables to process

o  List of all 2D variables you would like processed.

o  If you do not wish to process a specific field, you can skip it, but simply indenting the line in which the field it listed. In this case, U10M, and V10M will not be processed.

o  If a variables is present in the WRF netCDF file, but not in this list, it can be processed by simply adding it to the list.

o  To add a diagnostic, requires code changes.

o  The "!" and description behind each field name is required by the program. If you add variables, remember to add the description of the field as well.

o Do not remove or indent the line "end_of_2dvar_list", the code depends on this line.

   /DATA/real/wrfinput_d01
wrfout_d01_2000-01-24_12:00:00
wrfout_d01_2000-01-25_00:00:00
   /DATA/b_wave/wrfout_d01
   /DATA/hill2d_x/wrfout_d01
end_of_file_list

WRF netCDF files process

o  List of all the WRF netCDF files you would like processed.

o  Do not mix different types of WRF files.

o  If you do not wish to process a specific file, you can skip it, but simply indenting the line in which the field it listed. In this example, only the two real WRF output files will be processed.

o  Multiple input file allowed, as long as they are listed in the correct order.

o At LEAST one input file is required.

o  Do not remove or indent the line "end_of_file_list", the code it.

             ! what to do with the data
real       ! real / ideal / static
1          ! map background in grads
1          ! specify grads vertical grid
            ! 0=cartesian,
            ! -1=interp to z from lowest h
            ! 1 list levels (height/pressure)

This section describes what to do with the data

o  DO NOT ADD OR REMOVE LINES, the code needs this section exactly as is.

o  We will process real data

o  We would like a MAP background

o  We would like to interpolate the data to levels given below

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

Levels to interpolate to

o  This is only used if "1" is used for vertical interpolation above.

o  Can use pressure (as in this example) or height levels.

o  Levels must be from bottom to top.

o  Pressure levels are given in mb, and height levels in km.

o  Indenting will NOT remove a level from the list, it must be removed physically.


Run the code

·        wrf_to_grads    control_file    MyOutput    [-options]
This will create MyOutput.dat and MyOutput.ctl for use with GrADS

 

·        There are 3 debug levels (options) available:

 

Only basic information will be written to the screen

-v

Debug option low

-V

Debug option high (lots of output)

 

·        Now you are ready to use GrADS


Miscellaneous

To help users get started a number of GrADS scripts have been provided.

The scripts provided are only examples of the type of plots one can generate with GrADS data.

 

The user will need to modify these scripts 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 a skewT
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

Plot some surface data
Need input data on model levels

plevels.gs

Plot some pressure level fields
Need model output on pressure levels

rain.gs

Plot total rainfall
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 middle of the domain

zlevels.gs

Plot some height level fields
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

hill2d.gs

Need normal model level data

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

 

 

Examples of plots created for both idealized and real cases are available from:
http://www2.mmm.ucar.edu/wrf/users/graphics/WRF2GrADS/GrADS.htm 



Trouble Shooting

The code executes correctly, but you get "NaN" or "Undefined Grid" for all fields
when displaying the data.

Look in the .ctl file.

a) If the second line is:

options byteswapped

Remove this line from your .ctl file and try to display the data again.
If this SOLVES the problem, you need to remove the -Dbytesw option from the Makefile.

b) If the line below does NOT appear in your .ctl file:

options byteswapped

ADD this line as the second line in the .ctl file.
Try to display the data again.
If this SOLVES the problem, you need to ADD the -Dbytesw option for the Makefile.

The line "options byteswapped" is often needed on some computers (DEC alpha as an example). It is also often needed if you run the converter on one computer and use another to display the data.  


WRF2VIS5D

Generate VIS5D files from WRF netCDF files.

ONLY ARW output files in netCDF format can be converted.

Necessary software

 

·        Obtain the WRF2VIS5D TAR file from the WRF Download page (http://www2.mmm.ucar.edu/wrf/users/download/get_source.html)

·        VIS5D software (http://www.ssec.wisc.edu/~billh/vis5d.html)

Hardware

 

The code has been ported to the following machines

 

·        DEC Alpha

·        Linux

·        SUN

·        SGI

·        IBM 

Steps to compile and run

Untar WRF2VIS5D TAR file

Inside the TAR file, you will have the following files:

Makefile
README

 

wrf_v5d_input

Sample control file

module_map_utils.F
module_wrf_to_vis5d_netcdf.F
module_wrf_to_vis5d_util.F
wrf_to_vis5d.F

Source code

 

Compile

·        To compile the code, EDIT the Makefile to select the compiler flags for your machine

·        Type:    make

·        This will create a   wrf_to_vis5d   executable


 Edit the control_file file

-2
2000-01-24_12:00:00
2000-01-24_18:00:00

Times to process

o  If the first line contains a negative number, ALL times in the WRF file are processed.

o  A positive number means process that number of times. In this case the times to process must be listed.

o  The number in the first line MUST match the number of times listed, for BOTH negative and positive numbers.

U
V
W
THETA
   TK
TC
QVAPOR
QCLOUD
QRAIN
RAINC
TSK
end_of_variable_list

Variables to process

o   List of variables you would like process.

o   If you do not wish to process a specific field, you can skip it, but simply indenting the line in which the field it listed. In this example, TK will not be processed.

o   If a variables is present in the WRF netCDF file, but not in this list, it can be processed by simply adding it to the list.

o   To add a diagnostic, requires code changes.

o   Do not remove or indent the line "end_of_variable_list", the code depends on this line.

/real/wrfout_d01_2000-01-24_12:00:00
/real/wrfout_d01_2000-01-25_00:00:00
end_of_file_list

WRF netCDF files process

o   List of all the WRF netCDF files you would like processed.

o  List ONLY files you want to process. Indenting a file name will result in a run time error.

o  Multiple input file allowed, as long as they are listed in the correct order.

o   Do not remove or indent the line "end_of_file_list", the code depends on this line.

20      ! specify v5d vertical grid 0=cartesian, -
            1=interp to z from lowest h,
            >1 list levels (z) desired in vis5d file

This section describe what to do with the data

o  0 : cartesian vertical grid will be used

o  -1 : interpolation from lowest h level

o   >1 : for list of levels (height only, in km) to interpolate to (in this case 20 levels will be used)

1 1.
2 2.
3 3.
4 4.
5 5.
6 6.
7 7.
8 8.
9 9.
10 10.
11 11.
12 12.
13 13.
14 14.
15 15.
16 16.
17 17.
18 18.
19 19.
20 20.

Levels to interpolate to

o   Only height (must be in km).

o   In this case, 20 levels must be given to correspond to number set above.

o   Levels must be from bottom to top.

o   Levels must be presided by the level number.

o   Indenting will NOT remove a level from the list, it must be removed physically.

 

 Run the code

·        wrf_to_vis5d    wrf_v5d_input    MyOutput
This will create MyOutput for use with VIS5D

·        Now you are ready to use VIS5D

 

read_wrf_nc utility

This utility allows a user to look at a WRF netCDF file at a glance.

 

What is the difference between this utility and the netCDF utility ncdump?

  • This utility has a large number of options, to allow a user to look at the specific part of the netCDF file in question.
  • The utility is written in Fortran 90, which will allow users to add options.

 

    

Obtain the read_wrf_nc utility from the WRF Download page (http://www2.mmm.ucar.edu/wrf/users/download/get_source.html)

 

Compile

The code has been ported to Dec Alpha, Linux, Sun, SGI and IBM

 

The code should run on any machine with a netCDF library (If you port the code to a different machine, please forward the compile flags to wrfhelp@ucar.edu)

 

To compile the code, use the compile flags at the top of the utility.
            e.g., for a LINUX  machine you need to type:
             pgf90    read_wrf_nc.f    -L/usr/local/netcdf/lib    -lnetcdf    -lm  

                  -I/usr/local/netcdf/include    -Mfree    -o read_wrf_nc

 

This will create the executable: read_wrf_nc

 

Run

 

read_wrf_nc   wrf_data_file_name   [-options]

 

            options :           [-help] [-head] [-m] [-M z] [-s] [-S x y z] ! [-t] [-v VAL]

       [-V VAL] [-w VAL]
                      [-EditData]


Options:      (Note: none of the options can be used with any other option)

-help

Print help information.

-head

Print header information only.

-m

Print list of fields available for each time, plus the min and max values for each field.
Also print the header information.

-M z

Print list of fields available for each time, plus the min and max values for each field.
The min and max values of 3d fields will be for the z level of the field.
Also print the header information.

-s

Print list of fields available for each time, plus a sample value for each field.
Sample value is taken from the middle of model domain.
Also print the header information.
Default if no options are supplied.

-S x y z

Print list of fields available for each time, plus a sample value for each field.
Sample value is at point x y z in the model domain.
Also print the header information.

-t

Print only the times in the file.

-v VAR

Print basic information about field VAR.

-V VAR

Print basic information about field VAR, and dump the full field out to the screen.

-w VAR

Write the full field out to a file VAR.out


SPECIAL option : -EditData VAR

·        This option allows a user to read a WRF netCDF file, change a specific field and write it BACK into the WRF netCDF file.

·        This option will CHANGE your CURRENT WRF netCDF file so TAKE CARE when using this option.

·        ONLY one field at a time can be changed. So if you need 3 fields changed, you will need to run this program 3 times, each with a different "VAR"

·        IF you have multiple times in your WRF netCDF file - ALL times for variable "VAR" WILL be changed.

HOW TO USE THIS OPTION:

·        Make a COPY of your WRF netCDF file before using this option

 

·        EDIT the subroutine USER_CODE

ADD an IF-statement block for the variable you want to change. This is to prevent a variable getting overwritten by mistake.

For REAL data arrays, work with array "data_real" and for INTEGER data arrays, work with the array "data_int".


Example 1:
If you want to change all (all time periods too) values of U to a constant 10.0 m/s, you would add the following IF-statement:
   elseif ( var == 'U') then
     data_real = 10.0

Example 2:
If you want to change a section of the LANDMASK data to SEA points:
   elseif ( var == 'LANDMASK') then
     data_real(10:15,20:25,1) = 0

Example 3:
Change all ISLTYP category 3 values into category 7 values (NOTE this is an INTEGER field):
   elseif ( var == 'ISLTYP') then
     where (data_int == 3 )
       data_int = 7
     endwhere

 

·        Compile and run program
You will be prompted if this is really what you want to do.
ONLY the answer "yes" will allow the change to take effect