NCL

RIP4

ARWpost

 

WRF-to-GrADS

 

WG6 Home Page

 

 

 

WRF Model GRAPHIC TOOLS : NCL Scripts

Purpose

With the use of NCL Libraries, ARW WRF data can easily be displayed.

The information on these pages has been put together to help users generate NCL scripts to display their ARW WRF model data.

Some example scripts are provided, but in order to fully utilize the functionality of the NCL Libraries, users should adapt these for their own needs, or write their own scripts.

NCL can process ARW WRF static/input and output files, as well as WRF-Var output data. Both single and double precision data can be processed.
 

What is NEW?

Up to July 2007, one needed to install the NCL Libraries, AND the WRF_NCL package.

In July 2007, the WRF_NCL package has been incorporated into the NCL Libraries, thus only the NCL Libraries, are now needed. NCL version 4.3.1 or higher is required (NOTE: some of the built-in functions has been available since NCL version 4.3.0, but the complete ARW WRF package is only available since version 4.3.1). Version 4.3.1 is now available (August 10, 2007), and you can get downloading it from the NCL web site: http://www.ncl.ucar.edu/Download/

What has changed?

- The basic functions / procedures used in WRF_NCL has moved under the NCL libraries and are now located in "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/".

- All the FORTRAN subroutines used for diagnostics and interpolation (formally located in wrf_user_fortran_util_0.f) has been re-coded into NCL in-line functions. This means a user no longer need to compile these.

The old WRF_NCL package is still available to users, but it is recommended to obtain NCL version 4.3.1 and switch to using the new scripts.
 

What is NCL

The NCAR Command Language (NCL) is a free interpreted language designed specifically for scientific data processing and visualization. NCL has robust file input and output. It can read in netCDF, HDF4, HDF4-EOS, GRIB, binary and ASCII data. The graphics are world class and highly customizable.

It runs on many different operating systems including Solaris, AIX, IRIX, Linux, MacOSX, Dec Alpha, and Cygwin/X running on Windows. The NCL binaries are freely available at: http://www.ncl.ucar.edu/Download/
 

Necessary Software

- NCL libraries (version 4.3.1 or higher). Version 4.3.1 is now available (August 10, 2007), and you can get downloading it from the NCL web site: http://www.ncl.ucar.edu/Download/
 

Steps to Create images

Create a file called .hluresfile in your $HOME directory. This file controls the color / background / fonts and basic size of your plot. For more information regarding this file, see:
http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml

NOTE: This file must reside in your $HOME directory and not where you plan on running NCL.

Below is the .hluresfile used in the example scripts (note, if a different color table is used, the plots will look different). Copy this to your .hluresfile, or download it to your $HOME directory.

*wkColorMap : WhViBlGrYeOrReWh
*wkBackgroundColor : white
*wkForegroundColor : black
*FuncCode : ~
*TextFuncCode : ~
*Font : helvetica
*wkWidth : 900
*wkHeight : 900

NOTE: If you see an image similar to the one on the left, your .hluresfile has not been created correctly, or it is in the wrong location. You should see an image similar to the one on the right.


 

You are now ready to create scripts to generate images. (Or view some example scripts to get you started.)

Below is the outline of a basic plot. Or view a detailed example.

load external functions and procedures

begin

; Open input file(s)
; Open graphical output
 
; Read variables
 
; Set up plot resources & Create plots
; Output graphics

end


Run the script you just created.

ncl   wrf_Surface.ncl    [e.g., assuming your script is called wrf_Surface.ncl]

This will create plots in the format (type = x11 / ncgm / pdf / ps / eps) your selected in the script.

Example scripts.

Real Data Cases:

Cloud Plots
Precipitation

Surface Plots
     Basics
     Soil and Terrain Plots
     Basics with different wind barb density
Model Levels
Height Levels
Pressure Levels
     Basics
     Basics with different levels and wind barb density
Cross Sections
     Vertical coordinate - Height ; Plot along an angle through a given point
     Vertical coordinate - Height ; Plot from point A to B
     Vertical coordinate - Pressure ; Plot from point A to B

SkewT Plots
     Plot at a given Lon/Lat
     Plot at a given X/Y
Zoom
Overlay with Station data
OLR

Ideal Data Cases:

wrf_bwave.ncl
wrf_grav2d.ncl
wrf_hill2d.ncl
wrf_qss.ncl
wrf_squall_2d_x.ncl
wrf_squall_2d_y.ncl

 

Miscellaneous

For high quality images, create pdf / ps or eps images directly via the ncl scripts (type = pdf / ps / eps)

These file types can be easily converted to other formats with the ImageMagick tools, e.g.
     convert    filename.pdf    filename.png
     convert    filename.pdf    filename.gif

meta files (type= ncgm):

- To view type:     idt    filename.ncgm

- To convert NCGM files to other formats
     ctrans   -d  sun   filename.ncgm   >  filename.ras
     Then use ImageMagick or other tools to convert the filename.ras to the desirer format

     Other very handy tool is the ncgm2gif script.
     To convert all images in test.cgm to testxxx.gif
          ncgm2gif -res 500x500 -nomerge test.cgm

Functions / Procedures under
"$NCARG_ROOT/lib/ncarg/nclscripts/wrf/"

WRFUserARW.ncl

- These functions and procedures are describe fully on the NCL web site.
 
- Controls plotting options. If you want to change the defaults, change them in your script.
   e.g., if you do not want footers at the bottom of your plots, set "ARWres@Footer=False".

MainTitlePos

Options are top "Left", "Center", "Right"

InitTime

Add Initial Time to plot

ValidTime

Add Valid Time to Plot
Switch off for files which do not have a valid time

TimePos

Placement of Time Information. Options are top "Left" or "Right". If MainTitlePos and TimePos are on same side, Time Information will be plotted under the Main Title

Footer

Add some model information as a Footer to the plots


 

- Controls map plotting, creation of plots and overlays, via the following functions:
     wrf_contour
     wrf_vector
     wrf_map
     wrf_map_zoom
     wrf_map_overlay
     wrf_overlay

- Get variables from wrf files (wrf_user_getvar)

- Calculate diagnostics

All diagnostics are in-line functions within NCL. These functions can be used directly inside any NCL script without the use of the WRFUserARW.ncl script, but it is recommended to use the interface script, as this will make the use of these functions much easier.

- Interpolate data horizontally and vertically (wrf_user_intrp3d)

- Obtain x/y locations for given lat/long locations (wrf_user_latlon_to_ij)

- Extract times from wrf files (wrf_user_list_times)

 



 
 
Home -- Model System -- User Support -- Doc / Pub -- Links -- Download -- WRF Real-time Forecast