Release Notes:  Earthworm Version "v6.0"


NEW MODULES:
***********

db_cleanup: New database related module which allows the users to 
  clean up the events in the DB. It takes four important parameters:
  First two specify how many days ago cleanup should start and 
  how many days to clean up. For example, specifying 7 and 2 means 
  that two days worth of events will be cleaned up starting with 
  the events 7 days ago. Next two options specify the type of 
  cleanup. The user can delete all or just the trace data of an 
  event, and the user can save the trace in SAC format.  This program
  is intended to run out of cron so that it can automatically clean
  up the old stuff out of the database, keeping its tables
  manageable. LV 10/25/2000

db_cleanup2: Just like db_cleanup only more options.  You can now archive/delete
by time/lat&lon/magnitude.  You can also delete unassociated data.

reaper:  Just like db_cleanup2, except that it has only one option.  You give it
a DayOfReckoning, and it deletes everything in the DB older than that date/time.
It saves nothing.

pidpau: This is a command-line program with which one can request the termination
of a single Earthworm program.  It works by setting the transport flag in all
transport regions listed in startstop's config file to the value given on 
the command-line.  The value given is the processid that you want to shut
down.    Usage: pidpau  
Most earthworm modules have been modified to shut down when the trasnport
flag is set to TERMINATE or their own processid.
LDD 5/11/2001

makeTTTable:
This is the Ray Buland travel time calculator. It's Solaris-specific Fortran 
code. The main program was modified by Alex to accept command-line input 
specifying the resolution and range of the table. The output is an ascii file, 
suitable for reading with Carl's kom routines. The phases listed in the file are 
as per Harley's requirements for getting global snippets containing the time 
interval of interest. Such tables are currently used by archiving/usnsn_loc2trig 
and oracle/apps/src/arc2trigII.
	There's a rumor that someone has ported Ray's code to C. It would be good 
to replace this with that.
Alex June 5 2001.



MODIFICATIONS/BUG FIXES TO EXISTING MODULES:
*******************************************

scream2ew.c

Added a new optional parameter SleepInterval to control the number of milliseconds scream2ew sleeps after each message processing loop, as requested by Murray McGowan. John Patton 8/6/2001

ora_trace_save.c
Added initialization of the menu list .head and .tail =NULL as per Carol Bryant's
discovery. Alex 9/29/2000 

Replaced queue_max_size.o with mem_circ_queue.o in
the following makefiles:
  data_exchange/vdl/SCRIPTS/makefile.sol_ew
  display/sgram/makefile.sol
  seismic_processing/eqbuf/makefile.sol
  seismic_processing/eqbuf/makefile.nt
DavidK 2001/04/12

makefile.sol for many modules:
Removed compilation flags -D_SPARC and -D_SOLARIS from CFLAGS= lines.  
These flags should be set in a user's earthworm environment setup file,
ew_sol_sparc.cmd or ew_sol_intel.cmd.  The existence of these flags in the
makefile was causing trouble for anyone who wanted to compile for an
Intel Solaris platform. In carlstatrig, these flags caused 4-byte integer
trace data to be misinterpreted as float data, resulting in NaN for most
triggering variables. Makefile.sol was changed for the following modules:
 carlstatrig 
 eqfilter
 import_generic 
 q2ew
 sac2hypo
 sm_file2ring 
 sm_reftek2ew
 template 
 trig2disk 
 waveman2disk
LDD 1/31/2001

oracle/.../libsrc/util/get_db_event_info.c
Added new GetDBEventInfo_Super() function.  (Sorry about the name.)
GetDBEventInfo_Super() is the same as GetDBEventInfo() except that it
allows the caller to select what types of information they want
retrieved for an event.  They types are defined in 
EW_VERSION/include/db_event_info.h, and are bitwise OR'd together
to form an integer flags value.  Now one program can use the call to
get everything for an event, and another can still use the call to
just get summary and arrival info, without taking the performance
hit of retrieving all event data. 
Also added a function Set_GetDBEventInfo_Debug() that turns debugging
on/off for GetDBEventInfo_Super(). DK 12/20/00

oracle/.../eqparam2html
Changed the links that appear at the bottom of the eqparams web page,
(used to view record sections[waveforms]) from being hard coded to
being config file configurable.  See eqparam2html.d in the
eqparam2html source directory for more info. DK 12/20/00

oracle/.../getlist and getimage
Changed getimage to work on NT.  Previously getimage did not work on 
NT, due to a Pipe problem with Apache on NT.  Apache bug was fixed
as of v1.3 (fix verified on v1.3.14).  Changed getlist to use getimage
on NT.  These changes SHOULD not affect the operation of either program
on Solaris.  DK 01/03/01

oracle/.../ora2rsec_gif
Fixed a bug where non 8-byte aligned TRACEBUF packets within a 
DB Snippet buffer, would cause the program to crash.  (Tested
with 179 sample - 780 byte TRACEBUF packets from SRU BHZ UU).
Added code to remove (primitively) the DC Offset from the
record section displays.  DK 02/20/01

stalist_hinv2ora: Fixed a bug in reading elevation from the file. Had 
been reading 1 char too many, causing elevations to be an order of
magnitude too large.  Also added checks on the north-south latitude
flag and east-west longitude flag, so that the sign of the coordinates
is correct.  In a California-centric manner, we assume that if these
flags are left blank, the coordinates are N and W (this is the
hypoinverse default). 
  Also changed code in ewdb_api_CreateOrAlterExternalStation.c
so that station coordinates are inserted into the DBMS with 6 decimal 
places (had been truncated to 2 decimal places). LDD 3/19/2001 

shakemapfeed: added the option to write XML files for shakemap2; previously
only shakemap1 file format was supported. Added the option to read a
"MappingFile" which serves as a lookup table for station long names,
instrument types and agency names. These descriptive phases are added to the
XML to improve human readability; they are not required to make shakemaps. 
Changed to use the standard macros for RingName length and the other earthworm
logo lookup strings.  PNL 3/22/2001

k2ew: Changes to logging only.  Several messages that logged at debug level 0
were moved to debug level 1.  These source files were effected:
k2ewmain.c  k2pktio.c  outptthrd.c  k2misc.c  k2c_tcp.c
WMK  5/7/01

k2ew: Minor logging changes made to function k2p_recv_packet.  WMK 5/14/01

k2ew: Program now optionally writes the entire K2 header to a disk file.
Name of file is specified by a new optional config parameter named
"HeaderFile".  WMK 5/22/01

statmgr: Statmgr can now read nested descriptor files.  To do so, put a line
like "@common.desc" in the descriptor file.  WMK 5/10/01

include/transport.h: Changed SHM_HEAD.flag from short to int so that we can
use it to store processids.  This is in preparation for a graceful restart
mechanism, whereby if tport_getflag returns either TERMINATE or MyProcessId,
the module will exit gracefully.  Also changed tport_putflag's flag value
argument from short to int.
libsrc/solaris/transport.c
libsrc/winnt/transport.c: Changed tport_putflag's flag value argument from 
a short to an int.  LDD 5/4/2001

startstop_nt: Finally found/fixed the bug that was causing startstop to crash
when it failed to create one of its child processes (bug was in a logit call
where it tried to print an integer with %s instead of %d).  Now it logs the
failure along with troubleshooting tips, then shuts down, terminating
any child processes that it had succeeded in starting (no more headless
worms on NT). LDD 6/8/2001

startstop_nt/startstop.c
startstop_solaris/startstop.c: Changed RestartChild() to give the child
process a chance to shut down gracefully before killing it forcefully.
Startstop sets all transport flags (tport_putflag)
to the processid that should restart.  If the child hasn't shut down
after KillDelay seconds, startstop will kill the child and restart it.
LDD 5/7/2001

Graceful shutdowns - many modules:
Modules preceded by 'x' in the list below have been upgraded to shut down
gracefully if the transport flag is set to TERMINATE or its own processid.
Previously, modules only shut down on a TERMINATE flag. Combined with the
change to startstop's restart procedure, this means that only modules
that are truly hung will be forcefully killed by startstop.
All modules that are functioning properly will have a chance to clean 
up, possibly even saving state, before shutting down and being restarted.

Standard Earthworm Modules
--------------------------
archiving:
x menlo_report
  tankplayer
x trig2disk
x usnsn_loc2trig
x wave_serverV
  waveman2disk

data_exchange:
x coaxtoring
x export
x export_actv
x import_generic
  import_ida
x import_pasv
  liss
x rcv
  rcv-debug
x ringdup
x ringtocoax
x vdl

data_sources:
x adsend
  adsend_mitch
x k2ew
x naqs2ew
x q2ew
  reboot_mss
x reboot_mss_ew
x reftek2ew
x scream2ew
  usnsn_loc2ew

diagnostic_tools:
  file2ring
x gaplist
  getmenu
  putterNSN
  sniffring
  sniffwave
x template

display:
x ew2seisvole
x heli_ewII
x sgram
  wave_viewer

grab_bag:
x arc2trig
  comment2html
  getter
x pick_recorder
  putter
  sac2hypo

reporting:
  copystatus
x diskmgr
x statmgr

seismic_processing:
x binder_ew
x carlstatrig
x carlsubtrig
x compress_UA
x decimate
x decompress_UA
  eqbuf
  eqcoda
x eqfilter
x eqprelim
x eqproc
  eqverify
x evansassoc
x evanstrig
x ew2rsam
x ew2ssam
x fir
  glass
x gmew
  hyp2000
  hyp2000_mgr
x localmag
x pick_ew

strong_motion:
x sm_file2ew
  sm_file2ewI
  sm_file2ring
  sm_reftek2ew
  test_sm

system_control:
  pau
  restart
  startstop_nt
  startstop_solaris
  status

Oracle Earthworm Modules
------------------------
oracle/apps/src:
  alarms
x arc2trigII
  archive
  db_cleanup
  dewey
  eqparam2html
  frankel
  get_transfunc
  getimage
  getlist
  hypo2ora
  mag2ora
  nsn_pz2ora
  ora2rsec_gif
  ora2sac
  ora2sactarfile
  ora2snippet_gif
x ora_trace_fetch
x ora_trace_req
x ora_trace_save
x orareport
  review
  scn2pz
x shakemapfeed
  shakemapfeedI
x sm_ew2ora
  smdbtest
  stainfo
  stalist_hinv2ora
  stalist_shkmap2ora
  stalist_usnsn2ora
x usnsn_loc2ora
  wvdbtest


Menlo Modules
-------------
Contrib/Menlo/src:
  bdsn2trace
  cleandir
x condenselogo
  cta
  cta2cusp
x cuspfeeder
  cvarc
  dumpevent
  eqwaves
  getdst
  getdst2
  getevent
  getfile
x getqdds
  heli1
  heli2go
  heli4
x import_ms
  k2pipe
  ls_cta
  makehbfile
x msubl
  qa2tracebuf
  read_cta
  remux_tbuf
  send_cta
x sendarc
  sendfile
  sendfile_terra
  sgram
  shake_feeder
x sniff_trace
x write_cta
x wsv_test

Contrib/Menlo/src/pager:
  sendhb
  sendmsg
x telafeeder
  telalert
  telapage

End of graceful shutdown list. LDD 5/11/2001


ewdb_api_GetidChansFromSCNLT()   - sm_ew2ora
Fixed a memory leak in ewdb_api_GetidChansFromSCNLT().  This applies to all
programs and modules that utilize this call, including ones that call other
ewdb_api_XXX() functions that utilize this call.  sm_ew2ora is the only
program noticably affected by this change.  It was leaking 57kb per message
due to the bug, and could quickly swell to 30MB+ after one event.
DavidK 05/25/2001

ewdb_api_PutSMMessage() - sm_ew2ora
Changed the code so that messages that come from channels whose SCNL does
not correlate to a pre-existing DB channel(idchan) with a Lat/Lon, are
no longer stuffed into the DB.  The message is instead logged, with a
warning about that it was not inserted.  The function now returns 
EWDB_RETURN_WARNING when this happens.  Note:  this has the implication
that station lists for strong motion instruments must be completely loaded
into the DB before attempting to insert messages.  The DB will no longer
handle strong motion instruments that it has never heard of before.
Davidk 2001/07/26


libsrc/util/rw_mag.c, include/rw_mag.h
Changed ML_INFO struct to MAG_CHAN_INFO struct to make it more generic.
This structure and rw_mag should now be able to handle channel info for
most types fo magnitudes; moment magnitude is one obvious exception.
Removed "M0" (there is no such thing) and added "Mwp" (scalar moment
magnitude) to the table of known mag types.
PNL, 5/26/2001

localmag: slight changes to handle the revised rw_mag routines.
PNL 5/26/2001

/libsrc/util/geo_to_km.c: fixed minor error in value of PI. Alex 6/6/1

vdl: Reinstated feed_vdl_ew.c file from v4.1 (in v5.0,v5.1,v5.2, we had mistakenly
been using feed_vdl_ew.c from v3.9P).  Also made changes in feed_vdl_ew.c to
use MyPid in heartbeats, to terminate if tport_getflag returns MyPid or TERMINATE,
to use configuration file name in call to logit_init().  LDD 6/6/01

arc2trigII: Fixed value of PI. PNL 6/7/01

localmag: changed single transport ring to and input and an output ring.
Added ability to read multiple getEventsFrom commands; fixed handling of
wave_servers in traceSource command. Fixed memory leak in endEvent(). Added
test for SAC files to ensure they contain trace data for the desired time.
New config file requred; see below. PNL 6/10/01

gmew: changed single transport ring to and input and an output ring.
Added ability to read multiple getEventsFrom commands; fixed handling of
wave_servers in traceSource command. Fixed memory leak in endEvent(). 
New config file requred; see below. PNL 6/10/01

naqs2ew: changed to always produce one-second TYPE_TRACEBUF messages
when possible.  Shorter messages will be produced if the sample rate
exceeds the MaxSamplePerMsg parameter, or if a change in sample rate,
a data gap or overlap is detected. If a packet from NaqsServer ends 
with a fractional second's worth of data, naqs2ew will buffer that
data until the next packet for that channel is received. LDD 6/18/2001
  Reorganized code to allow sharing of source files between different
NaqsServer clients.  Created naqschassis.c which handles the connection
to the server, heartbeats, etc, and kept all waveform-specific code
in naqs2ew.c.  LDD 7/19/2001

wave_serverV:  Moved logging 
statement(_writeTankSummary: Warning: no data in tank) inside
a DEBUG conditional, so that it would not cause HUGE log files to be
generated under normal(HEAVY) operations where multiple tanks were
not being fed data.  This fix was performed due to problems with a
wave_server in Golden that was generating 4GB logfiles in a single day.
DavidK 06/18/2001

startstop.c (startstop_nt)
Modified the code so that statmgr will always be started first (if present), and
will wait a user defined number of seconds before starting any other modules 
(defaults to 1 second)  This was to repair an intermittent error where a module
could be started, and die before statmgr was alive.  This prevented statmgr
from sending a restart request, since the first heartbeat was lost.
John Patton 6/28/2001

localmag and gmew:
Fixed the loop controls after a failed wave_server connection. PNL, 7/7/01

startstop.c (startstop_solaris)
Modified the code so that statmgr will always be started first (if present), and
will wait a user defined number of seconds before starting any other modules 
(defaults to 1 second)  This was to repair an intermittent error where a module
could be started, and die before statmgr was alive.  This prevented statmgr
from sending a restart request, since the first heartbeat was lost.  Also 
modified code so that when startstop failed to start a module, it printed
out helpful error messages, and exited cleanly.
John Patton 7/16/2001

gmew:
Fixed bug that prevented XML files from being written. Pointers to EVENT and
GMPARAMS structures were being passed into getGMFromTrace(); the GMPARAMS
struct got corrupted as soon as getGMFromTrace() was entered - I don't know
why. To fix it, I changed XMLDir, TempDir, and MappingFile from string arrays
to string pointers on GMPARAMS. Then gm_config.c and gm_util.c were changed to
support these string pointers. PNL, 7/18/01

wave_viewer: Added logic to improve drawing, so that there are not so
many artificial gaps.  Fixed bug in indexing logic that was causing
datapoints to be shifted right and gaps to be added for data with
sloppy timestamps.  New version is v1.24.
DavidK 08/08/2001

K2ew:   Station name remapping:  added new directive to the .d
        file to allow the station name to be specified there. An
        example directive is:  StationID LAX
        The purpose is to rename the station if the K2's STNID needs
        to be something different (for legacy data purposes).
2001-03-22  Paul Friberg <p.friberg@isti.com>

k2ew  Version 2.20:  Improved handling of resend
         requests (more focus on oldest waiting packet); added commands
         "MaxBlkResends", "MaxReqPending", "ResumeReqVal",  "WaitResendVal",
         "RestartComm"; improved debug log output messages; added logging of
         K2 channel names; changed "# of packets lost" value so that it is
         only the total after a restart (to be consistent with the "# of
         packets received OK" total); added "Program start time", "# of
         packet retries", "Packet error rating" and "Time of last output
         seq err" to the summary listings; added logging of "in-process"
         summary listing at each status output interval.
2001-07-22  Eric Thomas <e.thomas@isti.com>

k2ew Version 2.22:  Changed default value for 'MaxReqPending' command
         from 10 to 6 (as per recommendation of Dennis Pumphrey).
2001-07-23  Eric Thomas <e.thomas@isti.com>

k2ew Version 2.23:  Added "ChannelNames" and "InvPolFlags" parameters.
2001-08-07  Eric Thomas <e.thomas@isti.com>

localmag, gmew:
Modified error code handling so that localmag no longer exits when it
receives an error from the last wave server in its list.  Program will
now continue even if there are NO AVAILABLE wave servers. DK 08/01/01

trig2disk:
Modified error code handling so that trig2disk no longer exits when it
receives an error from a wave server in its list.  Program will
now continue even if there are NO AVAILABLE wave servers.  This fix
was not super-clean and may have unknowingly changed the behavior of
handling other errors.  DK 08/01/01


CHANGES TO CONFIGURATION FILES and DESCRIPTOR FILES:
**************************************************** 

scream2ew.d:

Added optional command SleepInterval, to set the number of milliseconds scream2ew sleeps after each message processing loop, the default value is 100 ms. John Patton 8/6/2001

eqparam2html:  Added WaveformLinks command, to allow the html links at
the bottom of the eqparam2html page to be configurable via the config 
file. DK 12/20/00

shakemapfeed.d:
Added optional MappingFile command to support the new XML writer.
PNL 3/22/2001

k2ew: Program now optionally writes the entire K2 header to a disk file.
Name of file is specified by a new optional config parameter named
"HeaderFile".  WMK 5/22/01

k2ew  Version 2.20:  Improved handling of resend
         requests (more focus on oldest waiting packet); added commands
         "MaxBlkResends", "MaxReqPending", "ResumeReqVal",  "WaitResendVal",
         "RestartComm"; improved debug log output messages; added logging of
         K2 channel names; changed "# of packets lost" value so that it is
         only the total after a restart (to be consistent with the "# of
         packets received OK" total); added "Program start time", "# of
         packet retries", "Packet error rating" and "Time of last output
         seq err" to the summary listings; added logging of "in-process"
         summary listing at each status output interval.
2001-07-22  Eric Thomas <e.thomas@isti.com>

k2ew Version 2.23:  Added "ChannelNames" and "InvPolFlags" parameters.
2001-08-07  Eric Thomas <e.thomas@isti.com>

K2ew:   Station name remapping:  added new directive to the .d
        file to allow the station name to be specified there. An
        example directive is:  StationID LAX
        The purpose is to rename the station if the K2's STNID needs
        to be something different (for legacy data purposes).
2001-03-22  Paul Friberg <p.friberg@isti.com>

localmag: changed single transport ring to and input and an output ring.
Added ability to read multiple getEventsFrom commands; fixed handling of
wave_servers in traceSource command. PNL 6/10/01

gmew: changed single transport ring to and input and an output ring.
Added ability to read multiple getEventsFrom commands; fixed handling of
wave_servers in traceSource command. PNL 6/10/01

startstop_nt: Added optional command "statmgrDelay" to set the number of seconds startstop
waits after starting statmgr (if present).  This command should be placed 
after the KillDelay command, and before the first Process command.  
John Patton 6/28/2001

startstop_sol: Added optional command "statmgrDelay" to set the number of seconds startstop
waits after starting statmgr (if present).  This command should be placed 
after the KillDelay command, and before the first Process command.  
John Patton 7/16/2001

KNOWN BUGS or DEFICIENCIES:
**************************
Failure of automatic restarts just after Earthworm startup (rare):
  Automatic restarts are accomplished by a coordinated effort of the
statmgr and startstop processes. Statmgr should be the first module listed 
in startstop's configuration file in order for automatic restarts to work 
most effectively.  
  Statmgr learns each module's processid from its heartbeat message. If a module stops 
beating its heart, statmgr will issue a TYPE_RESTART message containing the processid
of the module that died.  Startstop watches for these TYPE_RESTART messages;
when it receives one, it finds that processid in its list of child processes,
then attempts to restart it.  So statmgr needs to get at least one heartbeat
for a module before it can send a TYPE_RESTART message that startstop will
be able to use.  If statmgr is not started before all other modules, it could 
in rare cases miss the one and only heartbeat from a terminal module. 
It would then send a restart message with a null processid and startstop
wouldn't be able to find the child in its list. The dead module would have
to be restarted manually (with the command-line program "restart") before
auto-restarts would be functional for that module.  LDD 6/18/2001
NOTE: The error above is now corrected by changes made to startstop.
JMP 7/16/23001

In import/export modules, there is a mistake in the way they are compiled.  
They should be compiled with "VOLATILE STATIC"; ask Alex for details.

In Windows NT, the time resolution of sleep_ew() is about 16 msec (one clock
tick).  On Solaris, the resolution is about 10 msec.  This is a problem for 
ringtocoax, since packet delays need to be set to a few milliseconds.

Automatic restarts of adsend (using the "restartMe" line in the descriptor
file) can cause an NT system to hang. Therefore, you should never
use the autorestart feature with adsend, but you should bring down
the entire Earthworm system if adsend needs to be restarted.
LDD 5/31/2000 Comments added to adsend.desc, but leave this warning here!

statmgr: A space is needed between "tsec:" and the value. 
If it isn't there, things fail. (Alex)

threads functions: The KillThread function on WindowsNT and Solaris
terminate the thread without ensuring that no mutexes are held. If a thread
holds a mutex when it dies, no other thread can get that mutex. PNL 1/12/2000

carlsubtrig:  The system time must be set to GMT and ew_nt.cmd must have 
TZ=GMT for carlsubtrig to work.  Comments in ew_nt.cmd done 5/25/00. Barbara
	

ew2seisvole: on NT, exits with horrible crash when system is stopped.

 Wave_viewer will display fictitious 2 to 3 sample gaps when scrolling the 
display.
 This does not happen all of the time and is only visible when there are less 
than
 200 samples on the display (2 seconds of data for 100hz data.) DK 2000/06/01

 libsrc/util/putaway.c: there is no include file for the putaway routines,
  thus any errors in arguments passed to putaway routines are not checked
  by the compiler.   PNL 7/10/2000

NUMBER OF RINGS LIMITED ON SOLARIS:
Under Solaris 2.6 (and probably other versions as well), the maximum number 
of shared memory segments is six. This means that on an out-of-the-box machine
you can only configure six rings. If you try to configure more than that, you
will see a cryptic message from tport_create about too many open files.  The
fix to this problem is to add the following lines to the /etc/system
file, and then reboot the system.

 set shmsys:shminfo_shmmax = 4294967295
 set shmsys:shminfo_shmmin = 1
 set shmsys:shminfo_shmmni = 100
 set shmsys:shminfo_shmseg = 20
 set semsys:seminfo_semmns = 200
 set semsys:seminfo_semmni = 70

This allows for 20 rings.

     Lucky Vidmar (7/6/2000)


startstop_solaris: There MAY be a problem with the signal that 
startstop sends to modules during the shutdown sequence. The shutdown 
sequence is started (after typing "quit" to startstop or running "pau")
by startstop placing a terminate message on all transport rings. Modules
should see this message and start their own shutdown. After a configurable
delay, startstop checks to see that all modules have exitted. Any that are 
still running are sent a signal to terminate them. Currently that signal
is SIG_TERM. But since wave_serverV has a handler for SIG_TERM, wave_serverV
sees that as essentially the same as a terminate message. So if wave_serverV
is having problems completing its shutdown, SIG_TERM won't do anything. The
result is that startstop may give up and exit, leaving wave_serverV running.
If that happens, the operator will have to terminate wave_serverV by doing
"kill -9 ". That may leave shared memory and semaphores
stranded in the kernel: run the command "ipcs -a" to see. If necessary,
the stranded shared memory and semaphores may be cleaned up with the
ipcrc command; must be run as root; see the man page.
This problem only exists on Solaris/Unix, not on WindowsNT.
PNL, 10/4/2000

libsrc/utils/kom.c: The comment above k_open() says that only one file can
be open at a time. Yet the Kbuf array has slots for MAXBUF (currently 4) open
files. Does this work, or is the comment to be taken at it's word?
PNL 10/15/00

libsrc/utils/site.c: The strings used for station, channel and network are
required to be fixed length with trailing spaces added to short names. If
the strings given to site_index do not have these trailing blanks, SCN names
will not match. This is not documented anywhere.  PNL 10/15/00

libsrc/utils/logit.c: logit_init() requires a module_id number, which it uses
to construct the log file name. This is not helpful, since the module_id
number is not meaningful to people. Worse, it requires that the config file be
read and earthworm.d lookups be completed before logit calls can be made. Thus
errors in the config file can only be reported to stderr or stdout instead of
being saved in a file.  PNL 11/29/00

TRACEBUF messages.
The definition of `endtime' of the TRACEBUF message is not documented.
Some programmers are taking it as the "expected start time of the next
TRACEBUF packet (if the sample interval is uniform.)" The more accepted
practice is that `endtime' is the time of the last sample of the current
TRACEBUF packet; that is, one sample interval less than the expected
start time of the next TRACEBUF messsage. Using this last definition, if a
TRACEBUF packet has exactly one sample, then its starttime and endtime are
the identical. Clearly this distinction needs to be documented. The file
waveform_format (in the /home/earthworm/DOC directory) gives no specifics 
about start or end times.  PNL 1/24/01
 
usnsn_loc2ew:
Reads from stdin into a buffer, but never checks for overflowing the
buffer. This is especially bad since usnsn_loc2ew is run under to Unix
inetd daemon, so anyone how connects to the socket for usnsn_loc2ew can
cause it to crash, or worse.  PNL, 5/2/01

usnsn_loc2trig:
Reads a travel time table to estimate P and S arrivals. To pick a time before
the P arrival for a given station, usnsn_loc2trig looks in the table for the
next nearer distance and the next shallower depth (relative to the event
location) to get the trigger start time for that station. It assumes that this
time will be earlier than the P arrival time of the the event distance and
depth. However, for most of the traveltime table, travel time decreases with
increasing depth. For most of the table, the increase in time with distance
makes up for the decrease in time with depth. But for distances beyond 165
degrees this is not true: the time selected by usnsn_loc2trig will be AFTER
the P arrival time, and that part of the trace will be missed. The same logic
is applied for determining the end-of-trace time, suing the S
wave. usnsn_loc2trig uses the next more distance and next deeper time for S
arrival to get this end of time. Again, beyond 165 degrees, the assumption
here is not valid. The trace end time will be earlier than the S arrival and
the trace will be cut off too early.  PNL 5/2/01

libsrc/utils/parse_usnsn:
Has a memory leak: whenever it returns early with an error condition, the
allocated memory in ParseNSNMsg is leaked. Since the size of the arrays
is fixed (hard-coded) this memory leak could easily be avoided by simply
declaring the array instead of allocating it.
Also, the loop for parsing phase lines counts up to the number of "associated"
phases as read from teh "nph" line of the message. Since this loop does not
skip over phases that are marked as unused, the loop may end prematurely if
any phases are so marked.  PNL 5/9/01

sm_ew2ora:
There is a bug in sm_ew2ora that involves having multipe time intervals for
components and channels.  If a strong motion message containing information
for a channel that the DB has never seen before, is loaded into the DB, and
then later another message for the same channel with an earlier timestamp
is loaded, the load of the second message will fail, due to problems with
overlapping time intervals, and the call that sm_ew2ora uses to create
those time intervals.  This problem only affects stations that were
not previously loaded via one of the station loader programs stalist*2ora,
and only when receiving SM data that is timestamped with a time that is
prior to the original time for that channel.  The bug lies in the logic
of ewdb_api_PutSMMessage(), and not in the underlying code.
Davidk 05/25/01

A change was made to ewdb_api_PutSMMessage() that dramatically affects
sm_ew2ora.  Please see the note about that function.  Davidk 2001/07/26 


OTHER:
**************************
Earthworm DBMS Applications(oracle): linking:
In order to build earthworm DBMS applications(ON A SOLARIS SYSTEM), a
change must be made to an Oracle makefile (/opt/oracle/rdbms/lib/env_rdbms.mk)

Go to the bottom of the file and comment out all lines in the file starting
with the $(LIBCLNTSH) target definition, so that the file looks as below.
The example provided is from Oracle8.

#$(LIBCLNTSH): \
#            ${ORACLE_HOME}/lib/libclient.a ${ORACLE_HOME}/lib/libsql.a \
#            ${ORACLE_HOME}/lib/libnetv2.a ${ORACLE_HOME}/lib/libnttcp.a \
#            ${ORACLE_HOME}/lib/libnetwork.a ${ORACLE_HOME}/lib/libncr.a \
#            ${ORACLE_HOME}/lib/libcommon.a ${ORACLE_HOME}/lib/libgeneric.a \
#            ${ORACLE_HOME}/lib/libmm.a ${ORACLE_HOME}/rdbms/lib/xaondy.o \
#            ${ORACLE_HOME}/lib/libnlsrtl3.a ${ORACLE_HOME}/lib/libcore4.a \
#            ${ORACLE_HOME}/lib/libepc.a
# $(SILENT)$(ECHO) "Building client shared library libclntsh.so ..."
# $(SILENT)$(ECHO) "Call script $$ORACLE_HOME/bin/genclntsh ..."
# $(GENCLNTSH)
# $(SILENT)$(ECHO) "Built $$ORACLE_HOME/lib/libclntsh.so ... DONE"

Davidk 2001/05/24