WRF-NMM Users Page

WRF Utility Programs

read_wrf_nc.f

Purpose

This utility was created to allow a used to look at a WRF netCDF file at a glance. It can be used for both WRF-ARW and WRF-NMM cores, and for geogrid, metgrid and wrf input/output files. Only 3 basic diagnostics are available, pressure/height/tk, these can be activated with the -diag option (these are only available for wrfout files).

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
  • Necessary Software

    Obtain the utility from the WRF Download page

    NetCDF libraries

    Hardware

    The code has been ported to the following machines, but the code should run on any machine with a netCDF library:

    • DEC Alpha
    • Linux
    • Sun
    • SGI
    • IBM
    • MAC (running xlf compiler)

    Steps to Run Utility

    To compile the code, use the compile flags at the top of the utility.

    • Example, for a Linux machine with PGI compilers 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

    The executable is run with the follow command line options:

    read_wrf_nc wrf_data_file_name [-options]

    where (the options can not be used with any other option, unless otherwise noted):

    -options: [- h / help ] [- att ] [- m ] [- M z] [- s ] [- S x y z] [- times ] [- t t1 [t2]] [- v VAR] [- V VAR] [- w VAR] [- ts xy X Y VAR VAR .....] [- ts ll lat lon VAR VAR .....]

    • -h: Print help information
    • -help: Print help information
    • -att: Print header information only. Works with other options
    • -m: Print list of fields available for each time, plus the min and max values for each field.
    • -M z: Print list of fields available for each time, plus the min and max values for each field. The min max values for 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 at point x y z in domain.
    • -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 domain.
    • -t t1 [t2]: Print information only from time t1 to t2 t2 is optional. Works with other options
    • -times: Print only the times in the file
    • -ts: Generate time series output. Output for full vertical column is default, if only one level is required, use -lev xy X Y VAR VAR ... will create time series output at X Y ll lat lon VAR VAR ... will create time series output at a point closest to lat/lon. No interpolation takes place.
    • -lev z: Works only with -ts. Specify which level you want time series output for
    • -rot: Rotate winds to earth coordinates only works with -ts
    • -diag: Add diagnostics for pressure/height/tk, e.g.,
      -s -diag
      -v pressure -diag
      -ts xy 50 50 U V pressure -diag
    • -v VAR: Print basic information about field VAR .
    • -w 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

    Default if no options are specified is: [-att -s]