Sorry for the delay getting this out. Attached are 4 files:
(1) xmrg2ascii.c - C source code to convert an 'XMRG' file into an ASCII file of point values
(2) sumxmrg.pl - a Perl script that will sum the hourly XMRG data into a user determined number of HOURS - that is, the point values will be summed across files
(3) xmrg0328200019z - an example XMRG (binary) file created on a BIG ENDIAN (non-Intel) computer, so you may need to do some byte swapping (modification of the code) on an Intel based Linux machine
(4) xmrg0328200019z.asc.gz - ASCII output from (3)
A few notes:
- to compile xmrg2ascii.c: gcc -o xmrg2ascii xmrg2ascii.c -lm (need the Math library)
- the data in the XMRG files are stored in hundreths of mm and the default is to convert to inches, so change the following line in the source as needed:
fprintf(stdout,"%9.4f %7.4f %.2f\n",-ll.x,ll.y,(double)zval / 2540.0);
- you'll need to either modify this C source or write a script to write the output to the GRASS site file format, which is pretty straightforward to do
For more information regarding 'XMRG' file format and the means by which the data is created go to http://www.weather.gov/oh/hrl/pps/pps.htm
Regards,
Tom
--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177
EMAIL: thomas.adams@noaa.gov
VOICE: 937-383-0528
FAX: 937-383-0033
(attachments)
xmrg2ascii.c (3.99 KB)
sumxmrg.722DEFANGED-pl (4.36 KB)
xmrg0328200019z (91.4 KB)
xmrg0328200019z.asc.gz (304 KB)