WRITE_DD $SSW/cgro/batse/idl/write_dd.pro
[Previous] [Next]
 PROJECT:
	 SDAC

 NAME:
	WRITE_DD
 PURPOSE:
	Write a flare file or daily file of BATSE CONTINUOUS or DISCSP data.  The DISCLA 
	FDB(BDB) file for the flare must already be written.  CONT/DISCSP data 
	from the daily BATSE CONT/DISCSP file is merged with housekeeping 
	from the DISCLA FDB(BDB) file for this flare.  The resulting CONT/DISCSP
	data records have the structure described in file cont_str.pro/
	discsp_str.pro.  The FDR header record has the structure defined 
	in file fdr_sdac_str.pro, padded to the length of the data records.

 CALLING SEQUENCE:
	write_dd, flare [, cont=cont, discsp=discsp, error=error]

 SAMPLE CALL:
	write_dd, 1200, /cont, err=err

 INPUTS:
	item - If an integer, a BATSE flare number to write cont or discsp file for.
	       or if a date in yymmdd string format then write a daily cont or discsp file.
		
 KEYWORD INPUTS:
	CONT - If set, then create CONT file
	DISCSP - If set, the create DISCSP file
 CALLS: ***
	ATIME [1], ATIME [2], BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CHECKVAR [1]
	DATATYPE [1], DATATYPE [2], DATATYPE [3], FIND_DBFILE, FIND_PACKET
	FORM_FILENAME [1], FORM_FILENAME [2], FS_OPEN [1], FS_OPEN [2], LOC_FILE [1]
	LOC_FILE [2], LOC_FILE [3], SC_SECONDS_ED, SIZE_STRUCT, USE_VAX_FLOAT, YMD2TJD
	break_file [4], checkvar [2], uniqo [1], uniqo [2]
	Note: Can only create cont OR discsp file in one call, not both.
	

 OPTIONAL KEYWORD OUTPUTS:
	error - 0/1 indicates no error/error

 MODIFICATION HISTORY:
	Written Kim Tolbert 10/93
	Mod. 11/10/93 KT to write discsp or cont files. (previously only cont)
       Mod. 08/17/94 Amy Skowronek to use concat_dir with directory names
       to accomodate UNIX file systems.
	ras, 17-apr-95, support vms/unix stream files
	AES, 21-apr-95, make stream a keyword of openw, not a variable
       AES, 3-may-95, use m_open after fs_open routine, rather than dd_open
	ras, 3-july-1995, can write daily discsp and cont files, too.
	richard.schwartz@gsfc.nasa.gov, write from daily msfc files at gsfc.
		14-sep-1997.
	richard.schwartz@gsfc.nasa.gov, corrected double file problem in
	variable files. 1-oct-1997
	richard.schwartz@gsfc.nasa.gov, 24-jun-1998, convert floating point in
	file def record to vax format assuming alpha platform.
       amy.skowronek@gsfc.nasa.gov, 13-jan-1999, changed msfc=msfc to /msfc
	in call to fs_open.. second file called in multi-day flare wasn't
	being opened in msfc format


WRITE_FDB $SSW/cgro/batse/idl/write_fdb.pro
[Previous] [Next]

 NAME: 
       WRITE_FDB

 PURPOSE:

 Write a flare data base (FDB) file from the batse data base (BDB) file
 with start and end from the flare and background times selected by the 
 operator in Fs_auto_log section of Fsplot.

 CATEGORY:
       BATSE

 CALLING SEQUENCE:
	flarenum,fst,fen,bst,ben

 CALLS: ***
	ATIME [1], ATIME [2], CHKLOG [1], CHKLOG [2], CONCAT_DIR [1], CONCAT_DIR [2]
	CONCAT_DIR [3], FCHECK, FIND_DBFILE, FIND_PACKET, FS_READ_DD, NEXTBDB
	PARSE_ATIME [1], RADEC_FILL, SC_SECONDS_ED, SIZE_STRUCT, USE_VAX_FLOAT
	concat_dir [4], parse_atime [2]
 INPUTS:
      fst- flare start in sec from 1-Jan-1979
      fen- flare end
      bst- background start
      ben - background end

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	EXTEND - Added to expand the time interval software searches for pointing data
		 while looking at omni events if 3x15min intervals is not long enough.
		 Expanded to 4x60 min intervals.
	none
 CALLED BY:
	DO_FDBFILES, FS_AUTO_LOG
 COMMON BLOCKS:
	radec_com

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:
 Mod. 4/15/93 by AKT.  When entire flare is in omni period, don't have
 any pointing data in entire file.  Changed to read in entire time
 period requested, call radec_fill to fill in holes in pointing position
 if possible.  If not possible (no pointing data in interval), then 
 expands interval by 15 minutes on both ends, and does again.  (If no
 pointing data after doing this 3 times, gives up).  Then when it is
 looping through bdb records, reading and writing, it fills in the
 the corresponding pointing position if necessary.  With this change,
 even files that had some pointing data will now have pointing data filled
 in during omni periods.  This will make it so a user can accumulate
 any subset of the file (previously if first interval selected didn't
 have any pointing data, user was told to accumulate a longer interval.
 eng_telem is still set to -1 for omni data, so we can tell when pointing 
 data was filled in.  

 Mod. 6/2/93 by KT.  When in Omni mode and filling in position data,
 have to use index/2, not index.  index is index into seconds array and
 there are twice as many elements in seconds as in position arrays.
 Mod. 8/17/94 by AES. Used concat_dir with directory logicals to 
 accomodate VMS and UNIX directory name formats
 17-apr-95, vms/unix, ras
  Version 4, ras, 9-Jun-1996, added documentation
  Version 5, richard.schwartz@gsfc.nasa.gov, 6-aug-1997, added provision
	to expand fdb filelength through use of FDB_OFFSET keyword
  Version 6, richard.schwartz@gsfc.nasa.gov, 24-Jun-1998, force times in output
	file def record to vax format.
  Version 7, eva@kano.nascom.nasa.gov, 13-May-1999.
	Added flag EXTEND -- when set, will expand the time interval
	that software searches through to find pointing info when event is omni 
	flare. Search changes from original 3x15 min intervals to 4x60min intervals.


WRITE_LOG $SSW/cgro/batse/idl/write_log.pro
[Previous] [Next]
 PROJECT:
	SDAC
 Name:
       WRITE_LOG

 PURPOSE:
 In normal mode, displays the flare parameters for the current flare 
 (whether a new flare or one that was just modified) and lists the 
 peak rate and total counts for each detector separately.  Then prompts
 operator for whether or not to save these flare parameters.  If this is a 
 new flare, figures out how many records are already in the file using FSTAT,
 new flare number will be new record number.  Also updates the header record
 to contain the total number of flares.  If this flare already existed,
 just rewrites the record containing this flare.
 
 In auto mode, don't talk to operator, just rewrite record containing 
 modified flare. Don't close file.
 
 CATEGORY: 
	batse 


 CALLING SEQUENCE:
	write_log, auto, peakrates, totcounts, batlog, flarenum, recordn, saveflare

 CALLED BY:
	fs_auto_log

 CALLS: ***
	ATIME [1], ATIME [2], BATSE_POINTING, CHKLOG [1], CHKLOG [2], CONV_VAX_UNIX
	SIZE_STRUCT, USE_VAX_FLOAT, batse_read_cat
 INPUTS:
 Calling arguments:
  auto - (input) if =1, then we're in auto mode.
  peakrates - (input) peak rate for each detector
  totcounts - (input) total counts for each detector
  batlog - (input/output) structure containing parameters for current flare
  flarenum - (input/output) if this is a new flare, on entry to fs_auto_log
             will equal 0, on exit will be new flare number.  If flare
             already exists, this is the flare number.
  recordn - (input/output) if new flare, this will be the record number
            the flare parameters are written into.  If flare already exists,
            this is the record number containing the flare (returned by 
            readflare procedure).
  saveflare - (output) 'Y' or 'N', yes/no to whether flare was saved
       none explicit, only through commons;

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 CALLED BY:
	PKUPCHEK
 COMMON BLOCKS:
	flare_catalog, fs_saveplot, fs_saveaccum, CATALOG_FILE

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	BATSE database files must exist.  For use at SDAC only.

 PROCEDURE:
	none

 MODIFICATION HISTORY:

 Mod. 2 Feb 94 by AKT.  Added fs_saveaccum common and just before
 writing flare, call batse_pointing with peak time and position at
 peak, and insert earth and sun position in flare structure that gets
 written in the catalog.

 Mod. 6/28/94 by AES to display detector id's to user as 0-7 rather
 than 1-8.  
 mod, 12-apr-95, ras, convert structures to byte arrays before writing
 Version 5, 24-jun-1998, continue writing in old VAX float format using USE_VAX_FLOAT().
	richard.schwartz@gsfc.nasa.gov.


WRITE_MONTH_CAT $SSW/cgro/batse/idl/write_month_cat.pro
[Previous] [Next]
 PROJECT:
	SDAC
 NAME:
       WRITE_MONTH_CAT
 
 PURPOSE:
 	This procedure writes the BATSE flare catalog into monthly files.
 CATEGORY:
	 batse archive i/o

 CALLING SEQUENCE: 
	Write_month_cat

 CALLED BY:


 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], FIND_IX, HOST_TO_IEEE [1]
	HOST_TO_IEEE [2], HOST_TO_IEEE [3], HOST_TO_IEEE [4], MATCH_STRUCT, OS_FAMILY
	READ_MONTH_CAT, SYS2UT, TIME2FILE, anytim [1], anytim [2], anytim [3], anytim [4]
	anytim [5], batse_read_cat, concat_dir [4]
 INPUTS:
 	none

 KEYWORD INPUTS:
	ON_CHANGE - Write only those months that have changed.

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 COMMON BLOCKS:
	flare_catalog

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	This procedure writes the batse flare catalog monthly files,
	from the common catalog area.  It can be used to fully
	create the monthly files or only to update them.  This
 	procedure was written to support the modularization of the
	catalog to facilitate broadcast using SSW.  Written mainly
	as a test of the technique.
	none

 MODIFICATION HISTORY:
	Version 1, richard.schwartz@gsfc.nasa.gov, 18-nov-1997