emwin for Debian
----------------------

Software to process digital weather data broadcast by the United
States National Weather Service or other public or private agencis.
(http://iwin.nws.noaa.gov/emwin/index.htm)

 -- A. Maitland Bottoms <bottoms@debian.org>, Mon, 26 Apr 1999 13:37:43 -0400

The WWW page says this is BETA software. Maybe it should say ALPHA.
I make it available more for people who can help me write better code
than for people who need to use it. Still, there has been an interest.

Of course, these days building is taken care of the Debian way on
Debian systems. But non-Debian builds can be made.

The Makefile is a lot like the Linux Makefile. First, it will make
a configuration file. Then it will update dependencies. Finally, with
those two files in place, it will make compilations work. Correct
environments are defined for gcc on SunOS and Linux. Edit the Makefile
for other systems if necessary.


Getting Data:
 1) Via ftp from NWS.
    ftp://iwin.nws.noaa.gov/data
    The files in the graphics subdirectory are in UTF format.

 2) Via radio.
	(Note: As of Spring 1999 the signal from Silver Spring is off
	the air while they figure out how to upgrade from 1200 to 9600 
	baud.)
    In Washington, DC, tune to 400.175 MHz for a narrowband FM
    broadcast of AFSK. You should hear the sound of 1200 baud
    Bell 202 modem tones (yes, this is the same modulation
    technique commonly used in Amateur packet radio). It is
    asynchrounous data, so using some device[1] to turn the tones
    into RS-232 levels, this data goes right into standard UART
    hardware. Say that hardware shows up under /dev/ttyS0 in Linux.
    Then, get data from the radio into a file by:
	$ stty raw < /dev/ttyS0
	$ cat /dev/ttyS0 > offair.log 

    (Update: September 2000)
    For radio or satellite receivers connected to a serial port:
        $ /usr/sbin/emwinser /dev/ttyS1 9600,N,8,1
    or, to source multicast IP network traffic:
        $ /usr/sbin/emwinmcs /dev/ttyS1 9600,N,8,1

 3) Multicast IP (Update: September 1999)
	Source : emwin.mcast.net, port 1024.
    This is a proof of concept test, since it uses QBT encoded packets. 
     The "real" version when deployed should probably send compressed
     data of some sort. 
    Antonio Querubin implemented the gateway from the NOAA satellite
    transmission to the MBone, as well as demonstration receiving applications
    for unix and WIN32 platforms.
        $ /usr/sbin/emwinmcr -m 3 -o /var/spool/emwin

Then test with something like[2]:
   zcat ../testdata/offair.log.gz | ./emwin | more
to see what is going on. This version will create a bunch of files.

If a UTF format file drops out (GPH*):
   ./utf GPHxxx*
to see what's in there. Note: now there is a utf2ps program which
allows viewing and printing of these plots as PostScript.

If a .CC1 format file drops out (SAT*.CC1):
   ./sattopgm SATxxxxx.CC1 | display &
to see what's in there[3].

If a .TXT format file drops out (*.TXT):
   more xxxxxxxx.TXT
to see what's in there.

With the multi-packet messages, emwin uses fseek() to write the right
section of the file. Does this really work? Maybe, but it now makes
separate files for every part (filename.part). That should help debug.
We can always cat those together once we are sure all the parts are there.

Part of the problem with the checksums not matching could really be
noise. I keep moving the antenna around, and it does have effect. The
laptop generates a lot of the noise.

The sample data files are now packaged under separate cover, since
they make up the bulk of the package size, while this source directory
makes up the bulk of the development changes.

Maitland Bottoms
aa4hs@amrad.org
11/25/96


Footnotes:
[1] A DEM part of a MODEM. One could get out a soldering iron and hack
up an old TNC to bypass the processor and hook the demodulator right
into the RS-232 line drivers. I thought an AEA PK-232 would do the job,
but at least with my firmware revision, it's ASCII mode was being too
smart. It didn't pass along NULL characters, and possibly others. But
I was reading interesting parts of text bulletins that way.

The MRJ and modified Baycomm demodulators are really good solutions.

For Linux users, a new kernel module turns a sound card into a modem.
It should be suitable for decoding EMWIN broadcasts as well. I will
be evaluating it Real Soon Now.

[2] I used to have a directory of sample data in the same tar file
as this code, and the data from the radio I kept in a gzip'd file.

The key thing to note is that emwin expects input on its stdin, so
	$ cat /dev/ttyS0 | emwin
would feed data directly from the serial port into the program.

[3] For this use, sattopgm produces a "Portable Gray Map" file,
which can be handled with the xv, pbmplus and netpbm packages, as well
as the ImageMagick package. The 'display' program is part of
ImageMagick.
