Skip Navigation Linkwww.nws.noaa.gov 
NOAA logo - Click to go to the NOAA homepage National Weather Service   NWS logo - Click to go to the NWS homepage
Distributed Model Intercomparison Project
 


The XMRG File Format and Sample Codes to Read XMRG Files

NEXRAD Multisensor grids provided on this page are stored in a binary file format called XMRG. A C program that will read an XMRG file is provided here. If you want to write your own program or want more details about the XMRG technical specifications, see http://www.nws.noaa.gov/oh/hrl/misc/xmrg.pdf. The sample code to read XMRG data is read_xmrg2.c. A new feature in read_xmrg2.c that was not included in the read_xmrg.c program available from the DMIP 1 site is that it can automatically read the XMRG binary files correctly on either a Little Endian (e.g. a PC with an Intel chip) or Big Endian (e.g. a UNIX workstation with a Motorola chip) machine. Byte reversing routines are included in read_xmrg2.c but only used if needed. See program comments for more explanation and example compilation syntax.

A slightly different version of this code that outputs the ‘gridascii’ format defined by ESRI is also available: <xmrgtoasc.c>. See comments in the source code and the information at http://www.nws.noaa.gov/oh/hrl/distmodel/hrap.htm for further description.

The coordinate system that defines the locations of XMRG data values is called the HRAP (Hydrologic Rainfall Analysis Project) grid. An explanation of how to locate the corner of an XMRG data set in HRAP coordinates and how to convert an HRAP cell box coordinate to latitude-longitude coordinates is provided in the header of the read_xmrg.c program. The explanation in this header refers to a FORTRAN subroutine called hrap_to_latlon. A link to hrap_to_latlon and latlon_to_hrap subroutines is provided here:
Lat/Lon_HRAP Conversion Code

Checking Your Results

If you wish to check your codes to see if you are getting the same results that we get when reading XMRG files, try reading the data for May 6, 1995 at 16:00 (Single binary file for this hour is provided here: xmrg0506199516z.gz). The mean of non-negative values in this file is 0.766547 mm. The maximum value is 19.1299 mm. A map of the values in this file should look as shown below. Units for the map legend are mm/hour.

Additional Information

The above programs contain all of the information you need to read and use XMRG files. If you really want more information, the following links are provided:

Link to technical specifications for HRAP and XMRG:
http://www.nws.noaa.gov/oh/hrl/pps/pps.htm

Tools for displaying HRAP/XMRG files in ArcView or Arc/Info
http://www.nws.noaa.gov/oh/hrl/distmodel/distmod.htm#tools

HRAP coordinate system documentation
http://www.nws.noaa.gov/oh/hrl/nwsrfs/users_manual/part2/_pdf/21hrapgrid.pdf

Some more recent images for checking your results are provided here.

     xmrg0703200406z.Z (above) (same legend applies to both)

     xmrg0703200407z.Z (above)

     Precip. in mm/hour.


ASCII files are also provided to help you check to see if you are reading the xmrg files correctly.

0703200407z.asc.gz: A gzipped GRID ascii version of xmrg0703200407z.Z

The first several lines of the ASCII files give spatial reference information such as:

    nrows = number of rows
    ncols = number of columns xllcorner, yllcorner = HRAP coordinates for the lower left corner of the lower left cell
                cellsize

Data following the header information are listed in row-major order with the top (northernmost) row on the first line.

BLUO2_601x288.pcp: An ASCII file containing a short time series of hourly precipitation values (mm) for HRAP pixel (601, 288).

ELDO2_634x347.pcp: An ASCII file containing a short time series of hourly precipitation values (mm) for HRAP pixel (634, 347).



Main Link Categories:
Home | HL | OHD

US Department of Commerce
National Oceanic and Atmospheric Administration
National Weather Service
Office of Hydrologic Development
1325 East West Highway
Silver Spring, MD 20910

Page Author: OHD webmaster
Page last modified: October 14, 2008
Disclaimer
Credits
Glossary
Privacy Policy
About Us
Career Opportunities