Using WRF with SCIPUFF

Douglas Henn, Sage Management

Sage Management has modified SWIM (SCIPUFF Weather Input Module) to read WRF (Weather Research and Forecasting) files directly in NetCDF binary format. This requires that SWIM link with suitable NetCDF and HDF5 libraries, which are typically distributed with SCIPUFF. A separate list file, referenced from the meteorological scenario file, is required. This consists basically of a list of one or more WRF files in chronological order, with some additional optional input.

The first record must consist of the string “WRF”. The next two optional records are defined by keywords with input to the right of an equals sign. They can be given in any order. The keyword “PATH” is used to define the path to the directory containing the WRF files. Note that the path specification should not be contained within quotes. The absence of the path record implies that the WRF files are located in the current user directory. If the user wants to use certain nested grid domains, the keyword “GRIDS” is used to denote this, with the selected grid numbers given as integers (space delimited). The order of the grid numbers is arbitrary although it is recommended that the order be given from largest to smallest domain since SWIM will usually treat the first grid as the “outer” or “parent” field in a series of nests. The grid domain specification is based on an assumed file name beginning with the string ‘wrfout_dgg’, where gg denotes the two-digit grid index. (The first digit for grid indices below 10 is 0.) The absence of the GRIDS record implies only one grid domain (with index gg) w will be used. Note that the indices given on the GRIDS record supersede gg. That is, the specific values of gg in the file list are irrelevant. It is also possible specify a list of files that do not follow this naming convention. In that case, the GRIDS record should be omitted and only one grid may be used.

[GRIDS=grid1 grid2 …]

An example of a WRF input file is given below. In this case, the WRF files are read from the relative directory .\wrf and grids 1 and 2 are specified. Twelve half-hourly output times are specified; but there is no practical limit to the number of files that can be included. Since this example specifies GRIDS, file names are constructed for grids 1 and 2. If a file with a constructed name does not exist, SWIM simply deletes that name from its internal list of WRF files. Thus, the fact that “wrfout_d01” files do not actually exist for output times on the half-hour does not cause any problem.


Only certain two- and three-dimensional fields on the WRF files are utilized by SWIM. These are listed in the table below. U, V, W, PH(B) and HGT are the only required fields. If ZNT is absent, surface roughness will be set based on LU_INDEX (if available). PBLH, HFX, QFX, TH2 and Q2 are only used if BL_TYPE is set to ‘OPER’ in the SCIPUFF meteorology scenario file.

WRF Field Name, Description
U, V – Horizontal velocity vector components (m s-1)
W – Vertical velocity component (m s-1)
T – Perturbation potential temperature (K)
P, PB – Pressure, base state & perturbation (Pa)
QVAPOR – Humidity mixing ratio (kg kg-1)
PH, PHB – Geopotential, base state & perturbation (m-2 s-2)
HGT – Terrain height (m)
HFX – Surface sensible heat flux (W m-2)
QFX – Surface moisture flux (kg m-2 s-1)
ZNT – Surface roughness (m)
LU_INDEX – Landuse category
ALBEDO – Surface albedo
UST – Surface friction velocity (m s-1)
PBLH – Boundary layer height (m above ground level)
TH2 – Potential temperature at 2 m (K)
Q2 – Humidity mixing ratio at 2 m (kg kg-1) 

It should be noted that while this example uses multiple WRF files each containing a single output time, SWIM has the capability to read files with multiple times. In fact, WRF files with overlapping time periods may be used. And it should also be noted that SWIM reads the time from the WRF file and ignores any time information encoded in the file name. SWIM looks specifically for the global attribute ‘SIMULATION_START_DATE’ (string with date and time encoded as YYYY-MM-DD_HH:MM:SS) and the variable ‘XTIME’ (minutes since the simulation start) to define time. Furthermore, it uses the length of the CHAR variable ‘Times’ to determine the number of times on a particular WRF file. Note that an error will occur if any of these are absent on the file.

SWIM uses a number of global attributes to define the horizontal grid, including map factors for converting model coordinates and distances to “true” values on the spherical earth. These are given in the following table. (SWIM also reads the first (southwest) values of the fields ‘XLAT’ and ‘XLON’.)

WRF Global Attribute, Description
MAP_PROJ – 1=Lambert Conformal; 2=Polar Stereographic; 3=Mercator
TRUELAT1 – Latitude where the projection is true
TRUELAT2 – Latitude where the projection is (also) true
MOAD_CEN_LAT – Latitude of model grid origin
STAND_LON – Longitude of model grid origin
DX – Model grid spacing (west-to-east) in meters
DY – Model grid spacing (south-to-north) in meters

Leave a Reply

Your email address will not be published. Required fields are marked *