HELIOS_1 $SMEI/for/lib/hos/helios_1.f
[Previous] [Next]
 NAME:
	HELIOS_1
 PURPOSE:
	Returns the heliographic or ecliptic longitude of the Helios 1
	spacecraft for a given time
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	function HELIOS_1(iYrIn,Doy)
 INPUTS:
	iYr		integer		year
					(if iYr < 0 then then the ecliptic longitude is returned)
	Doy		real		day of year, including fraction for time of day
 OUTPUTS:
	HELIOS_1	real		heliographic longitude (degrees, 0<=EARTH<360)
 CALLS: ***
	ECLIPTIC_HELIOGRAPHIC, HOSOrbit
 CALLED BY:
	READ_HOS
 EXTERNAL BY:
	READ_HOS
 PROCEDURE:
	The spacecraft is assumed to move in the ecliptic
 MODIFICATION HISTORY:
	JAN-1991, Paul Hick (UCSD)


HELIOS_2 $SMEI/for/lib/hos/helios_2.f
[Previous] [Next]
 NAME:
	HELIOS_2
 PURPOSE:
	Returns the heliographic or ecliptic longitude of the Helios 2
	spacecraft for a given time
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	function HELIOS_2(iYrIn,Doy)
 INPUTS:
	iYr		integer		year
					(if iYr < 0 then then the ecliptic longitude is returned)
	Doy		real		day of year, including fraction for time of day
 OUTPUTS:
	HELIOS_2	real		heliographic longitude (degrees, 0<=EARTH<360)
 CALLS: ***
	ECLIPTIC_HELIOGRAPHIC, HOSOrbit
 CALLED BY:
	READ_HOS
 EXTERNAL BY:
	READ_HOS
 PROCEDURE:
	The spacecraft is assumed to move in the ecliptic
 MODIFICATION HISTORY:
	JAN-1991, Paul Hick (UCSD)


HERDISK $SMEI/user/pphick/for/main/herdisk.f
[Previous] [Next]
 NAME:
	HERDISK
 PURPOSE:
	Reads data from the HELIOS optical platter (5 or 12 inch)
	(the CDs contain a Windows NT executable herdisk.exe to read
	the raw data files. It writes 'packed' Helios data (see RESTRICTIONS).
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	program HERDISK
 INPUTS:
	To get info on command line arguments:
		herdisk -? (Linux)
		herdisk /? (Windows)

	Data read from 12 inch optical disk, 5 inch optical disks or CD.
	All media have subdirectories AR,AZ,BZ and BR (A=Helios 1, B=Helios 2,
	R=Reduced data, Z=Zodiacal light data). HERDISK needs the name of the
	parent directory of these subdirectories to locate the data.
	This Helios 'root directory' is determined using one of the following
	steps in sequence:

	1. Check the command line
		To read from the 5 or 12 inch optical disks specify HER5
		or HER12, respectively. In this case the symbol LIB_OD_UNIT
		should be set to the optical drive where the platter is mounted
	2. Check the symbol LIB__OD_UNIT
		(On VMS this symbol is set automatically if LIBDEV is used to
		mount the optical disk)
	3. Prompt the user for the root directory
 OUTPUTS:
	Disk file
 CALLS: ***
	ArrR4Bad, ArrR4Copy, AskChar, AskI4, AskR4, AskWhat, AskYN, BadR4, CvR4, DATE_DOY
	ForeignArg, Int2Str, Julian, OCv2Flt, OCv2Int, OGetRecord, Say, Str2Str, bOpenFile
	iArrR4ValuePresent, iCheckDirectory, iFilePath, iFreeLun, iGetDefaultDir
	iGetFileSpec, iGetLogical [1], iGetLogical [2], iGetSymbol [1], iGetSymbol [2]
	iHOSInfo, iHOSWrite, iPutFileSpec, iSearch, iSetFileSpec, itrim, lowercase
 INCLUDE:
	include		'hos_e9.h'
	include		'filparts.h'
	include		'dirspec.h'
	include		'openfile.h'
 COMMON BLOCKS:
	common /OPEN_NEXT_FILE/ iYr,iMon,INDX,INDXTOT,ISP,IDT,cDir,cAim
 RESTRICTIONS:
	(the following is no longer true. Structures are no longer used, so
	the alignment problem no longer arises).

	The Helios data are written to a binary disk file (i.e. open for
	direct, unformatted access) using the structures defined in include
	file E9_HOS.H.

	For photometers 1 and 2 (16 and 31 degrees) the structure is:

	structure /DATA_STRUCT/
	    real*4     TIME        !Day of year
	    integer*2  PHOTOM      !16 or 31 degree photometer
	    integer*2  COLOR       !+100 if not NODATted
	    integer*2  FILTER      !Filter wheel setting
	    real*4     DISTANCE    !Distance of spacecraft from Sun (AU)
	    real*4     POSITION    !Position of spacecraft w.r.t Sun
	    real*4     INTENS(32)  !Intensities in the 32 sectors
	end structure

	For photometer 3 (90 degree) the structure is:

	structure /DEG90_STRUCT/
	    real*4     TIME        !Day of year
	    integer*2  PHOTOM      !90 degree photometer
	    integer*2  COLOR       !+100 if not NODATted
	    real*4     DISTANCE    !Distance of spacecraft from Sun (AU)
	    real*4     POSITION    !Position of spacecraft w.r.t Sun
	    real*4     INTENS      !Intensity
	    real*4     POLARIZ     !Polarization
	end structure

	Note that the definition of the 16/32 photometer record is nonaligned
	(three integer*2 variables in a row). Many Fortran compilers will by default
	add 2 bytes after the color entry, extending the length of the structure
	to 148 bytes, rather than 146. Usually the compiler will have a switch to
	'pack' the structure, i.e. force the compiler NOT to insert the 2 extra bytes.
	Historically, Helios data at UCSD have been 'packed' (on older VMS computers
	this was the default). To remain compatible, programs using E9_HOS.H should
	be compiled with the 'pack' switch turned on:
	For VAX Fortran this is the /NOALIGN switch, e.g. use
		FORTRAN/NOALIGN/WARNING=NOALIGN
	For Absoft Fortran for NT, this is the -N33 switch (available under
		F77 Options/Miscellaneous/Pack structure elements)
 EXAMPLES:
	Linux:		herdisk -ha -zld -ascii -silent
	Windows:	herdisk /ha /zld /ascii /silent
	VMS:		run HERDISK			! Runs 5 inch version
			$ HERDISK HER5			! Runs 5 inch version
			$ HERDISK HER12			! Runs 12 inch version
			(The last two versions must be stored in a DCL symbol)
 PROCEDURE:
    12 - inch platter:
	The two sides of the optical disk are labeled HELIOS01 and HELIOS02.
	HELIOS01 contains HELIOS A reduced data and HELIOSB zodiacal light data;
	HELIOS02 contains HELIOS A zodiacal light data and HELIOSB reduced data.
     5 - inch platters:
	There are three double-sided disks labeled HELIOS01 through HELIOS06
	HELIOS01 : Helios A reduced data
	HELIOS02 : Helios A reduced data; Helios A zodiacal light data
	HELIOS03 : Helios A zodiacal light data
	HELIOS04 : Helios B reduced data
	HELIOS05 : Helios B zodiacal light data
	HELIOS06 : Helios B zodiacal light data
    CD set:
	There are three CDs with label HELIOS_AR, HELIOS_AZ and HELIOS_B
	HELIOS_AR : Helios A reduced data
	HELIOS_AZ : Helios A zodiacal light data
	HELIOS_B  : Helios B reduced and zodiacal light data

	Data selection is determined by choosing among the following options:

	(1)  HELIOS A or HELIOS B
	(2)  Zodiacal light data or reduced data
	(3)  Color UV, Blue, Visual or all three
	(4)  Only the 90 deg. photometer or all three photometers
	(5)  If all three photometers [option 4]: one filter 1-5, filter 4 and
		5, or all 5 filters (4=Clear,5=Polarization brightness).

	For the 90 deg. photometer both clear and PB are read, unless the  selected
	filter is 1,2 or 3 (in which case the 90 deg photometer is omitted completely).

	To run on the VMS Vax:
	$ $COM:LIBDEV ODMOUNT		(to mount optical disk)
	$ run $EXE:HERDISK
	$ $COM:LIBDEV ODMOUNT		(to dismount optical disk)

	HERDISK can be run most easily using the LIBPLAY procedure (type PLAY
	HELIOS and use the options ODMOUNT and HER5 or HER12)
 ????	HERDISK can also be submitted as a batchjob using option K of the
	HELIOS command procedure. Make sure you have the optical disk mounted
	before you submit the job (using LIBDEV ODMOUNT). You will also need
	an input file containing the answers to all the questions HERDISK asks
	in interactive mode:

	A or B		(HELIOS A or B)
	Z or R		(Zodiacal light or reduced data)
	Y or N		(Only 90 deg data (1) or all photometers (0))
	A,U,B,V		(Color; A = all colors)
	A,1,2,3,4,5,C	(Filter; A = all filters; C = Clear+pB)
	year1
	doy1		(start date)
	year2
	doy2		(end date)
	filename	(name for the outputfile) 

	- Bad (negative) data are flagged as BadR4().
	- The color value is offset by 100 to indicate that the data have
		not been normalized  (run NODAT or THEFIT to normalize the data).
	- The output file will always have the extension .HER

	The arrays IAZ,IBZ,IAR,IBR contain the number of measurement cycles in
	each month (each non-zero entry in one of these arrays stands for one
	magnetic tape of HELIOS data).
	The array IDENT contains locations in the INTA and REALA arrays where
	the values for various quantities are located.

	Zodiacal light data (see Description of the zodiacal-light-data-tape
	of the HELIOS Zodiacal Light Experiment E9):

	INTA(  IDENT(1,1)   ) --> year
	REALA( IDENT(2,1)   ) --> distance Sun-spacecraft in AU
	REALA( IDENT(2,1)+1 ) --> ecliptic longitude Sun (seen from spacecraft;
		equinox 1975)
	REALA( IDENT(3,1)+I ) (I=1,32) --> for photometers 1 and 2: clear
		intensities for filters 1 through 4; for filter 5 (polarization 
		data) the intensities are stored after location 352 instead of
		608). 
	REALA( IDENT(4,1)   ) --> clear brightness for photometer 3
	REALA( IDENT(5,1)   ) --> polarization brightness for photometer 3

	Reduceced data (Description of the reduced-data-tape of the HELIOS
	Zodiacal Light Experiment E9):

	INTA(  IDENT(1,2)   ) --> year
	REALA( IDENT(2,2)   ) --> distance Sun-spacecraft in AU
	REALA( IDENT(2,2)+1 ) --> ecliptic longitude Sun
	REALA( IDENT(3,2)+I ) (I=1,32) --> for photometers 1 and 2: clear
		intensities for filters 1 through 5
	REALA( IDENT(4,2)+COLOR ) --> clear brightness for photometer 3
	REALA( IDENT(5,2)+COLOR ) --> polarization brightness for photometer 3
		(COLOR = 1,2,3 for UV,Blue and Visual, respectively)

	ERRORS ON OPTICAL PLATTER:
	AZ75JAN.128	read errors (empty file on CD?)
	AZ75MAR.002	'Funny INTA(1) = 0'; seemingly no data
	AZ76SEP.038	last 11 logical records contain nonsensical data
	BZ76AUG.002	one bad logical record
	BZ76AUG.032	no data
	BZ76AUG.038	no data
	BZ76NOV.114	(last 18 logical records) and ...
	BZ76NOV.115	(first 8 records) give wrong year 1911 (error is corrected by
			software).
	BZ78DEC.###	contain data for January 1979
 MODIFICATION HISTORY:
	FEB-1992, Paul Hick (UCSD/CASS)
		Modified for use on 5 inch optical disk on VMS
	JUN-1998, Paul Hick (UCSD/CASS)
		Modified to run from CD in Windows NT
	NOV-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Modified to run on from CD in Linux
		Fixes needed to compile under g77:
		- main program: introduced IREAL array equivalenced to REALA
			for use in call to OCv2Flt.
		- OGetRecord: now uses bOpenFile to open the raw Helios files
			On VMS the files are opened as sequential, unformatted files;
			on NT and Linux they are opened as direct acess, unformatted files
			with the proper record length in bytes.
			On NT the files must be opened readonly to access the CD.
		- OCv2Int: integer*2 argument to MVBITS replaced by integer*4
		- OCv2Flt: removed calls to intrinsic IIOR
		Also added command line argument /silent (On NT the program
		sometimes crashes when lines are written to the screen too fast;
		setting /silent circumvents this problem).
	OCT-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Minor revision of help display when specifying /? or -? switch.
		Also added ascii command line argument to produce ascii output files


HLngEarth $SMEI/ucsd/gen/for/lib/time/hlngearth.f
[Previous] [Next]
 NAME:
	HLngEarth
 PURPOSE:
	Returns the heliographic or ecliptic longitude (in degrees) of the
	sub-Earth point
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	double precision function HLngEarth(tt)
 INPUTS:
	tt(2)		integer			2-element standard time
 OUTPUTS:
	HLngEarth	double precision	heliographic longitude (degrees, in [0,360)
 CALLS: ***
	Time2EclipticHeliographic, Time2SunNewcomb
 CALLED BY:
	Time2Carrington
 SEE ALSO:
	XMAP_SC_POS
 PROCEDURE:
	Typically used as external function to e.g. XMAP_SC_POS
 MODIFICATION HISTORY:
	JAN-1991, Paul Hick (UCSD/CASS)
	JUL-1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu), added option to return ecliptic longitude


HLngEastLimb $SMEI/ucsd/gen/for/lib/time/hlngeastlimb.f
[Previous] [Next]
 NAME:
	HLngEastLimb
 PURPOSE:
	Returns the heliographic or ecliptic longitude (in degrees) of the
	solar east limb
 CALLING SEQUENCE:
	double precision function HLngEastLimb(tt)
 INPUTS:
	tt(2)		integer			2-element standard time
 OUTPUTS:
	HLngEastLimb	double precision	heliographic longitude (degrees, in [0,360)
 CALLS: ***
	Time2EclipticHeliographic, Time2SunNewcomb
 SEE ALSO:
	XMAP_SC_POS
 PROCEDURE:
	Typically used as external function to e.g. XMAP_SC_POS
 MODIFICATION HISTORY:
	???-????, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


HLngWestLimb $SMEI/ucsd/gen/for/lib/time/hlngwestlimb.f
[Previous] [Next]
 NAME:
	HLngWestLimb
 PURPOSE:
	Returns the heliographic or ecliptic longitude (in degrees) of the
	solar west limb
 CALLING SEQUENCE:
	double precision function HLngWestLimb(tt)
 INPUTS:
 INPUTS:
	tt(2)		integer			2-element standard time
 OUTPUTS:
	HLngWestLimb	double precision	heliographic longitude (degrees, in [0,360)
 CALLS: ***
	Time2EclipticHeliographic, Time2SunNewcomb
 SEE ALSO:
	XMAP_SC_POS
 PROCEDURE:
	Typically used as external function to e.g. XMAP_SC_POS
 MODIFICATION HISTORY:
	???-????, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


hos_e9 $SMEI/for/h/hos_e9.h
[Previous] [Next]
 NAME:
	hos_e9
 PURPOSE:
	Parameter constant for manipulating Helios photometer data
 INCLUDED BY:
	Average, Connect, Dust, HERDISK, HOSPlot, HOSRead, HOSRunningMean, HOSUpdate, HOSWrite
	NODAT, Pandora, Pandora_Records, PrintAll, READ_HOS, TheFit, iHOSArch, iHOSInfo
	iHOSRead
 PROCEDURE:


HOSdos2vms $SMEI/user/pphick/for/main/hosdos2vms.f
[Previous] [Next]
 NAME:
	HOSdos2vms
 PURPOSE:
	Converts a binary Helios file create on Windows or
	Linux to a VMS binary with the appropriate record length.
 CATEGORY:
	I/O: Helios photometers
 CALLING SEQUENCE:
	program HOSdos2vms
 INPUTS:
	Binary Helios file
 OUTPUTS:
	VMS Binary Helios file
 CALLS: ***
	ArrI4Copy, AskChar, HOSInquire, Say, bOpenFile, cInt2Str
 INCLUDE:
	include		'dirspec.h':
 RESTRICTIONS:
	The last block may contain a couple of trailing records of garbage.
	No attempt is made to discard those. Probably the best way to fix this
	would be to modify HOSInquire to return the number of records as an extra
	argument.
 PROCEDURE:
	When a Helios photometer file created in DOS or Linux is moved to VMS, it
	can only be opened as a VMS block file with a record length of 512 bytes
	(128 words). The record length is determined by a call to HOSInquire.
	Then the file is read and written back to disk in a binary file with
	the appropriate record length. The resulting file should be readable
	by any of the Helios programs on VMS.
 MODIFICATION HISTORY:
	DEC-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


HOSInquire $SMEI/ucsd/gen/for/os/fnc/hosinquire.f
[Previous] [Next]
 NAME:
	HOSInquire
 PURPOSE:
	Determine record length for a Helios file
 CATEGORY:
	Kludge
 CALLING SEQUENCE:
	subroutine HOSInquire(cFile,iRecl)
 INPUTS:
	cFile	character*(*)	file name
 OUTPUTS:
	iRecl	integer		record length in 4-byte words (usually 37 or 6)
				= 0 if not succesful
 CALLED BY:
	HOSdos2vms, iOpenFile
 INCLUDE:
	include		'dirspec.h'
 CALLS: ***
	CvSwap, Say, bGetLun, iFreeLun
 RESTRICTIONS:
	It is assumed that the record length is an integer number of
	longwords (4-byte words).
 PROCEDURE:
 >	This kludge is necessary for DOS, Unix and Linux. Helios files are opened as
	direct access files. It is necessary to explicitly use the recl
	keyword to provide the record length in bytes (in VMS this is not necessary).
 >	The resulting record length can be used directly in an open statement:
		open (iU, file=cFile, status='OLD',access='DIRECT', recl=iRecl)
	This should work both under DOS, VMS and Linux. Unix has not been tried yet.
 >	First an inquire by name is tried.
	VMS returns the record length in bytes; this is converted to longword.
	DOS returns a zero-record length.
	The record length is determined from the file content by
	looking for photometer/color combinations.
 MODIFICATION HISTORY:
	JUN-1998, Paul Hick (UCSD/CASS)
	JAN-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Photometer values are now tested for values 1,2,3. If the first photometer
		value read from file is not one of these, then bytes are swapped and the
		same test is done again. If swapping bytes changes the photometer value to
		1,2 or 3 then byte swapping is applied to all integers read from file.
		This should allow the routine to work when Helios files created on VMS, Windows
		or Linux are opened on a Unix machine and v.v. (iHOSRead uses the same trick)


HOSOrbID $SMEI/for/lib/hos/hosorbid.f
[Previous] [Next]
 NAME:
	HOSOrbID
 PURPOSE:
	Identifies spacecraft and year which best fits a given combination of
	time, heliocentric distance and ecliptic longitude
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine HOSOrbID(TT,R,L,iSc,iYr, dRMin)
 INPUTS:
	TT	real		day of year (print result if < 0)
	R	real		heliocentric distance of spacecraft
	L	real		ecliptic longitude of spacecraft
 OUTPUTS:
	iSc	integer		spacecraft ID (1 for Helios A; 2 for Helios B)
	iYr	integer		year ID
	dRMin	real
 CALLS: ***
	HOSOrbit, Say, cFlt2Str, cInt2Str, cosd, iwhitespace, pInfR4
 CALLED BY:
	Pandora, READ_HOS, iHOSArch, iHOSInfo
 PROCEDURE:
	The Helios A position is calculated for the given day of year in years
	1974-1985; the same for Helios B in years 1976-1980. The resulting
	distance-longitude coordinates are compared with the input coordinates.
	The spacecraft-year combination giving the closest match (i.e. closest
	in absolute distance) are presented as ouput.
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD)


HOSOrbit $SMEI/for/lib/hos/hosorbit.f
[Previous] [Next]
 NAME:
	HOSOrbit
 PURPOSE:
	Calculates the position of a Helios spacecraft at a given time
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine HOSOrbit(iSc,iYr,Doy,rSun,rLng,VR,VT)
 INPUTS:
	iSc	integer		spacecraft (1=Helios A; 2=Helios B)
	iYr	integer		year and
	Doy	real		day of year, where s/c location is required
 OUTPUTS:
	rSun	real		spacecraft distance to Sun in AU
	rLng	real		spacecraft ecliptic longitude (Equinox 1975.0 ???)
	VR	real		radial velocity (AU/day)
	VT	real		tangential velocity (AU/day)
 CALLS: ***
	Julian, KeplerOrbit
 CALLED BY:
	ExtractPosition, ExtractPositionn8, HELIOS_1, HELIOS_2, HOSOrbID, Pandora
 PROCEDURE:
	The spacecraft orbit is assumed to lie in the ecliptic
	See O. Montenbruck, Practical Ephemeris Calculations, p. 42-45
	Perihelion passages for Helios A:

	year       doy           JD               ecl long perih

	1975      74.38411   2442486.8841             257.8521    !
	1975     264.5102       2677.0102                .8493    !
	1976      89.6610       2867.1610                .8570    !
	1976     279.7965       3057.2965                .8478    !
	1977     103.9367       3247.4367                .8448    !
	1977     294.0973       3437.5973                .8496    !
	1978     119.2591       3627.7591                .8517    !
	1978     309.4239       3817.9239                .8518    !
	1979     134.5879       4008.0879                .8530    !
	1979
	1980     149.9095       4388.4095                .8465    !
	1980     340.2279       4578.7279                .8542    !
	1981     164.978        4768.729              257.978
	1981
	1982
	1982
	1983
	1983

	Perihelion passages for Helios B:

	1976     108.1035    2442885.6035             294.2079     !
	1976     293.7552       3071.2552             294.2007     !
	1977     113.5434       3257.0434             294.2332     !
	1977     299.3565       3442.8565             294.2353     !
	1978     120.2137       3628.7137             294.2470     !
	1978     306.0831       3814.5831             294.2528     !
	1979     126.9678       4000.4678             294.2577     !
	1979     312.8478       4186.3478             294.2553     !
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD)
	1997, Paul Hick (UCSD), replaced explicit orbit calculation by
		call to KeplerOrbit


HOSPlot $SMEI/user/pphick/for/main/hosplot.f
[Previous] [Next]
 NAME:
	HOSPlot
 PURPOSE:
	Viewing and editing of Helios brightness time series
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	program HOSPlot
 INPUTS:
	Helios data files
	FOREIGN		see PROCEDURE
 OUTPUTS:
	Edit operations are recorded in the input file upon exit
 CALLS: ***
	ArrR4GetMinMax, AskI4, AskR4, AskWhat, AskYN, BLANKLINE, BadR4, CLEARWINDOW, DRAW, DRAWBOX
	DRAWI, FOUT, ForeignInput, GinBar, HOSPlot_DrawBase, HOSPlot_EditPoints
	HOSPlot_EraseBase, HOSPlot_bCommand, HOSRead, HOSUpdate, IGETDEVILIMITS, IGIN
	ISETBACKGROUNDCOLOR, ISETCENTERJUSTIFY, ISETCOLOR, ISETFOREGROUNDCOLOR
	ISETHORIZJUSTIFY, ISETMIDDLEJUSTIFY, ISETRIGHTJUSTIFY, ISETSYSNORMAL
	ISETSYSUNITS, ISETTERMANDPLOT, ISETTOPJUSTIFY, ISETVERTJUSTIFY
	ISWITCHGRAPHICSOFF, ISWITCHGRAPHICSON, IndexR4, MOVE, MOVEDRAW, MOVEDRAWI, MOVEI, Say
	USRDF, XYLABEL, bIsXEvent, cFlt2Str, cInt2Str, iHOSInfo, itrim, iwhitespace, pInfR4
 INCLUDE:
	include		'openfile.h'
	include		'hos_e9.h'
 COMMON BLOCKS:
	common /QUERIES/ DAT2,TOP1,TOP2
	common /ZOOM/	 TBeg,TEnd,TMax,TMin,YMax,YMin
 RESTRICTIONS:
	Only one photometer/color combination is read from the input file and 
	available for viewing/editing.
 PROCEDURE:
    >  Display options:
	- Next sector		- Jump sector		- Edit filter
	- Print time series	- Zoom			- Exit
	Editing options:
	- subtracting linear 'background' (baseline subtraction)
	- removing bad data points
	- shift baseline for (part of) a time series
   >	Data points can be marked by vertical dashes, squares or crosses.
	The choice is made in the command line invoking HOSPLOT (the $ commands
	should be stored in a symbol, which is then executed at the DCL prompt)
		dashes:	  run HOSPLOT    or    $ HOSPLOT
		squares:  $ HOSPLT HOSPLOT1
		crosses:  $ HOSPLOT HOSPLOT2
	(the squares option basically implements the old TPRINT
	program, written by Tina Schwenn)
 MODIFICATION HISTORY:
	?
	NOV-1991, Paul Hick (UCSD); added LAYOUT=1 option; introduced file checking by bOpenFile
	JUN-1992, Paul Hick (UCSD); added 'shift baseline' option
		  Paul Hick (UCSD); added GinBar calls (EMU-TEK only)
	SEP-1998, Paul Hick (UCSD); modified data input section (now uses iHOSInfo, HOSRead) and
				data output section (now uses HOSUpdate)


HOSPlot_bCommand $SMEI/user/pphick/for/main/hosplot.f
[Previous] [Next]
 NAME:
	HOSPlot_bCommand
 PURPOSE:
	Controls continuation of the graphics display loop
 CALLING SEQUENCE:
	logical function HOSPlot_bCommand(bAllFlt,bAllClr,kP,iS,iBeg,iEnd,jEdt,NR,iT,NN)
 INPUTS:
	If IPHOTOM .ne. 3 then always iBegFilt=4

	kP		integer		photometer
	iBeg		integer		1=All filters used; 4=Only CLEAR and PB used
	NR(5)	integer		number of data points for each filter
 OUTPUTS:
	jEdt		integer		0=No filter to be edited;1-5=filter to be edited
	iS		integer		1-32 sector to be processed
	HOSPlot_bCommand
			logical		.TRUE.=Continue; .FALSE.=Stop
 CALLS: ***
	ASKI4G, BLANKLINE, GinBar, IGIN, ISETCOLOR, ISETFOREGROUNDCOLOR, Int2Str, MOVEDRAW
	Str2Str, TimeOut, XYLABEL, bIsXEvent, cInt2Str, hardcopy
 CALLED BY:
	HOSPlot


HOSPlot_DrawBase $SMEI/user/pphick/for/main/hosplot.f
[Previous] [Next]
 NAME:
	HOSPlot_DrawBase
 CALLING SEQUENCE:
	subroutine HOSPlot_DrawBase(TMin,YMin,TMax,YMax,T1,Y1,T2,Y2)
 CALLS: ***
	BLANKLINE, IGIN, MOVEDRAW, XYLABEL, bIsXEvent
 CALLED BY:
	HOSPlot
 PROCEDURE:
	Plot baseline ad return endpoints


HOSPlot_EditPoints $SMEI/user/pphick/for/main/hosplot.f
[Previous] [Next]
 NAME:
	HOSPlot_EditPoints
 CALLING SEQUENCE:
	subroutine HOSPlot_EditPoints(iS,TMin,TMax,YMin,YMax,jTMin,jTMax,jtt,TT,YY,NN)
 CALLS: ***
	BLANKLINE, BadR4, DRAWBOX, GinBar, IGIN, ISETBACKGROUNDCOLOR, ISETCOLOR
	ISETFOREGROUNDCOLOR, XYLABEL, bIsXEvent
 CALLED BY:
	HOSPlot
 PROCEDURE:
	Allows editing of points associated with the filter and sector


HOSPlot_EraseBase $SMEI/user/pphick/for/main/hosplot.f
[Previous] [Next]
 NAME:
	HOSPlot_EraseBase
 CALLING SEQUENCE:
	subroutine HOSPlot_EraseBase(TMin,YMin,TMax,YMax,X1,Y1,X2,Y2)
 CALLS: ***
	ISETBACKGROUNDCOLOR, ISETCOLOR, MOVEDRAW
 CALLED BY:
	HOSPlot
 PROCEDURE:
	Erase baseline


HOSRead $SMEI/for/lib/hos/hosread.f
[Previous] [Next]
 NAME:
	HOSRead
 PURPOSE:
	Read Helios for specific color and filter
 CATEGORY:
	I/O: Helios data
 CALLING SEQUENCE:
	subroutine HOSRead(iD,cFile,nT,iT,NN,TT,PP,CC,FF,RR,LL,nnS,ZZ)
 INPUTS:
	iD	integer		identifies data properties
				each bit in ID identifies a property defined in include file hos_e9.h
				Bits are set by summing parameters defined in the include file.
				Bits set for input are for:
				- HOS__P_*: photometer selection (ignored if nS=1)
				  * is set to one of the following: 1, 2, 3, 12, 13, 23, 123 indicating
				  which photometers are selected. ALL can be used as alternative for 123.
				- HOS__C_*: color selection
				  * is set to one of the following: 1, 2, 3, 12, 13, 23, 123
				  indicating which colors are selected. ALL can be used as alternative for
				  123. Instead of numbers 1, 2 or 3 the letters U, B and V can be used,
				  e.g, UB is an alternative for 12, etc.
				- HOS__F_*: filter selection (ignored if nS=1)
				  * is set to one of the following: 1, 2, 3, 4 or 5 indicating which
				  filters are selected. POL can be used to select the three polarized
				  filters 1,2 and 4; CLR selects filter 4; PB selects filter 5; CLRPB
				  selects filters 4 and 5. ALL selects all five filters.
				- HOS__NOT: negates the above photometer/color/filter selection
				- HOS__AA or HOS__BB: spacecraft selection (ignored if name of input
				  file conforms to the standard Helios format).
				- HOS__SWAP_SECT: indicate whether ordering of sectors uses modified sectors
				  numbers (resulting in swapping of sectors in output array; see PROCEDURE).
				- HOS__SINGLE: indicate whether arrays NN, CC, FF, PP should be filled or not;
				  see PROCEDURE
	cFile	character*(*)	name of Helios data file
				if cFile has the standard form HyrLF_doy.* then a single color and filter
				are read (determined from the file name)
	nT	integer		maximum # records read into output arrays
	nnS	integer		2 <= nnS <= 32 or nnS = 1.
				If nnS >= 2: # sectors to be returned in ZZ for 16 and 31 deg photometer
				MUST BE EVEN. ODD VALUE WILL BE ROUNDED DOWN TO EVEN NUMBER
				If nnS = 1 : forces reading of clear data for photometer 3 (i.e. photometers
				1 and 2 are ignored and pB also is ignored)
				(Note that this overrides the photometer/filter setting in iD)
 OUTPUTS:
	iD	integer		several bits are modified
				- HOS__P_*: if nnS = 1 then the HOS__P_3 bit is set; if the file contains data
					for only one photometer, then the corresponding HOS__P_* bit is set.
				- HOS__C_*: if the file contains data for only one color, then the
					corresponding HOS__C_* bit is set.
				- HOS__F_*: if the file contains data for only one filter, then the
					corresponding HOS__F_* bit is set.
				- HOS__AA or HOS__BB: if the name of the input file conforms to the standard
					Helios format then the appropriate spacecraft bit is set
				- HOS__NONORM: is set or cleared depending on the color entry in the 1st record
					(set if > 100, indicating an unnormalized file, otherwise cleared)

	iT	integer		# records read into output arrays (<=nT)
	NN(iT)	integer		record number (not filled if HOS__SINGLE set)
	TT(iT)	real		day of year
	PP(iT)	integer		photometer: 1=16 deg, 2=31 deg, 3=90 deg (not filled if HOS__SINGLE set and
					only one photometer is selected.
	CC(iT)	integer		color indices (not filled if HOS__SINGLE set and only one color is selected)
	FF(iT)	integer		filter indices (not filled if HOS__SINGLE set and only one filter is selected)
	RR(iT)	real		heliocentric distance (AU)
	LL(iT)	real		topocentic ecliptic longitude (degrees)
	ZZ(nnS,iT) real		intensities
				if nnS >= 2 then clear and pB for photometer 3 are stored in the first two
				sector locations ZZ(1,*) and ZZ(2,*).
				if nS =1 then only the clear data is stored in Z(1,*).
 CALLS: ***
	ArrR4Copy, Say, bHOSName, bOpenFile, cInt2Str, iArrI4Total, iFreeLun, iHOSRead
 CALLED BY:
	Dust, HOSPlot, HOSRunningMean, NODAT, PrintAll, READ_HOS, TheFit
 SEE ALSO:
	HOSUpdate, HOSWrite
 INCLUDE:
	include		'openfile.h'
	include		'hos_e9.h'
 SIDE EFFECTS:
 >	An odd input value of nnS gives the same result as nnS-1, i.e. nnS will be rounded down
	to the nearest even integer. In addition, nnS is kept inside the range [2,32].
 >	Use HOSUpdate or HOSWrite to write data back to a disk file.
 RESTRICTIONS:
 >	Adding parameters from the include file hos_e9.h to build the value for iD needs to be
	done with some care: make sure to set each bit only once e.g. iD = HOS__P_1+HOS__P_ALL is WRONG
	since it selects photometer 1 twice and will not give the expected response.
	(the only really save way to combine the HOS__* parameters is using a logical or as e.g.
	in iD = HOS__P_1 .or. HOS__P_ALL)
 >	The CC array always contains the value 1,2 or 3, even for unnormalized files.
	Check the HOS__NONORM bit in the return value of iD, or use iHOSInfo to find out whether a file
	contains unnormalized data (as indicated by a color entry 101, 102 or 103 in the file).
 PROCEDURE:
 >	HOSRead will first try to use the input file name to open a file. If not succesfull
	it will prompt for a file name. Not selecting a file results in program termination.
 >	The 90 degree intensity and pB are returned in Z(1,*) and Z(2,*), respectively, UNLESS nnS=1.
 >	if nnS = 1 the the clear intensity for photometer will be read into array Z(*)
	ignoring the photometer and filter selection in iD.
 >	If nnS < 32, some of the anti-solar sectors are omitted, e.g. if nnS=28 then sectors
	15,16,17,18 will not be present. I.e. an even number of sectors centered on the solar
	direction are returned in ZZ.
 >	If HOS__SWAP_SECT is not set in iD then sectors 1..nnS/2 and 33-nnS/2..32 (i.e. the first and the
	last nnS/2 sectors) are returned in ZZ(1..nnS/2,*) and ZZ(nnS/2+1..nnS), respectively.
	I.e. nnS sectors are stored in ZZ by increasing sector number: 1..nnS/2,33-nnS/1..33
 >	If HOS__SWAP_SECT is set in iD then sectors 1..nnS/2 and 33-nnS/2..32 (i.e. the first and the
	last nnS/2 sectors) are returned in ZZ(nnS/2+1..nnS) and ZZ(1..nnS/2,*), respectively.
	I.e. nnS sectors are stored according to modified sector number (-15,..,+16) sweeping the sky
	from west to east (Helios 1) or east to west (Helios 2).
 >	HOS__SINGLE can be set to save on memory requirements if single photometer/color/filter combinations
	are read. If HOS__SINGLE is set then the record number array NN is not filled (note that this means that
	HOSUpdate cannot be used to update the file); if only a single photometer is selected then only
	PP(1) is filled; if a single color is selected then only CC(1) is filled; if a single filter is
	selected only FF(1) is filled. In this case arguments NN, and one or more of PP, CC and FF can be
	scalar variables. Note that it is the responsibility of the caller to make sure that the selection in
	iD is indeed for a single photometer, color and/or filter.
 MODIFICATION HISTORY:
	SEP-1998, Paul Hick (UCSD/CASS)
	MAY-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu), introduced bit-by-bit handling of iD


HOSRunningMean $SMEI/user/pphick/for/main/hosrunningmean.f
[Previous] [Next]
 NAME:
	HOSRunningMean
 PURPOSE:
	Subtracts a running mean from the Helios photometer data.
 CATEGORY:
	Data processing: Helios
 CALLING SEQUENCE:
	program HOSRunningMean
 INPUTS:
	Normalized data files produced by the program CONNECT
 OUTPUTS:
	Filtered data file with the same name as input file, except for extension
 CALLS: ***
	HOSRead, HOSWrite, Say, T_FILTER, iGetFileSpec, iHOSInfo
 INCLUDE:
	include		'hos_e9.h'
	include		'filparts.h'
 RESTRICTIONS:
    >  If the input file contains 90 degree data, the 90 deg records should
	be at the end of the file, AFTER the 15/30 degree data (if present).
	If this is not the case not all records from the input file are 
	processed. CONNECT automatically takes care of this.
 PROCEDURE:
    >	The input name should have a file name of the type XYrLF_doy.DAT, where
	X=A/B for HELIOS A/B, Yr are two digits indicating the year of
	observation, L=U,B,V depending on which color is used, F is the number
	of the filter user for the 15-30 deg photom (F=9 if the file contains
	only 90 deg photom data), doy is the day of year for the first data
	point on the file, .DAT is the default extension for a normalized data file.
    >	This type file name is created automatically when using the program CONNECT.FOR
 MODIFICATION HISTORY:
	MAY-1989, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


hosucsd $SMEI/for/h/hosucsd.h
[Previous] [Next]
 NAME:
	hosucsd
 PURPOSE:
	Parameter definition for several Helios-related data arrays
 CATEGORY:
	Helios data processing
 INCLUDED BY:
	READ_HOS
 PROCEDURE:
	Used by main program SANHEL and subroutine READ_HOS
 MODIFICATION HISTORY:
	MAR-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


HOSUpdate $SMEI/for/lib/hos/hosupdate.f
[Previous] [Next]
 NAME:
	HOSUpdate
 PURPOSE:
	Update Helios data file
 CATEGORY:
	I/O: Helios
 CALLING SEQUENCE:
	subroutine HOSUpdate(iD,cFile,nT,iT,NN,TT,PP,CC,FF,RR,LL,nS,ZZ)
 INPUTS:
	iD		integer		identifies data properties
					each bit identifies a property defined in include file hos_e9.h
					Bits are set by summing parameters defined in the include file.

					Bits used are:
					HOS__SWAP_SECT: if set sectors are assumed to be ordered by
					modified sector number (see PROCEDURE).
					HOS__NONORM: the color is set to 1,2 or 3 if this bit is not set;
					and to 101,102,103 if this bit is set
					HOS__OS_*: passed to iHOSRead

	cFile		character*(*)	name of file to be updated
	nT		integer		(not used)
	iT		integer		number of records
	N(iT)		integer		record number
					Only record numbers which have the
					sign bit set will be updated
	T(iT)		real		times (day of year)
	P(iT)		integer		photometer (1/2/3)
	C(iT)		integer		colors (1/2/3)
	F(iT)		integer		filters (1/2/3/4/5)	
	R(iT)		real		heliocentric distance (AU)
	L(iT)		real		ecliptic longitude of Sun
	nS		integer		# sectors
	Z(nS,iT)	real		intensities
 OUTPUTS:
	Output to existing Helios file
 CALLS: ***
	ArrR4Copy, Say, bOpenFile, cInt2Str, iFreeLun, iHOSRead, iHOSWrite, iwhitespace
 CALLED BY:
	HOSPlot, NODAT
 INCLUDE:
	include		'openfile.h'
	include		'hos_e9.h'
 SIDE EFFECTS:
 >	The sign bit of all NN elements are cleared again.
 >	Argument nT is not used
 >	Each record is read by iHOSRead. This defines the no-normalization bit passed
	to the subsequenc write by iHOSWrite.
 RESTRICTIONS:
	The setting of the swap bit (HOS__SWAP_SECT) in iD should be the same as used
	in the call to HOSRead used to fill the original arrays.
 PROCEDURE:
 >	The arrays are usually read using HOSRead (the argument lists
	of HOSUpdate, HOSWrite and HOSRead are identical). The record number array
	NN refers to the file read by HOSRead
 >	A record number can be marked for update by setting the sign bit
	using:  NN(I) = IBSET(NN(I),31)
 >	By default (HOS__SWAP_SECT not set) the nS sectors of the intensity
	array are assumed to refer to sectors 1..nS/2,33-nS/2,..32, and are
	written to file in that order.
 >	If the swap bit (HOS__SWAP_SECT) is set in iD, then the sectors are assumed
	to be ordered by modified sector number: 1-nS/2,...nS/2, corresponding to normal
	sector numbers: 33-nS/2,..32,1,..,nS/2, i.e. the first and second
	half are swapped. The sectors will be swapped back into normal order
	before being written to file by iHOSWrite
 MODIFICATION HISTORY:
	SEP-1998, Paul Hick (UCSD/CASS)
	MAY-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu), updated handling of data properties in iD


HOSWrite $SMEI/for/lib/hos/hoswrite.f
[Previous] [Next]
 NAME:
	HOSWrite
 PURPOSE:
	Write Helios data file
 CATEGORY:
	I/O: Helios
 CALLING SEQUENCE:
	subroutine HOSWrite(iD,cFile,nT,iT,NN,TT,PP,CC,FF,RR,LL,nS,ZZ)
 INPUTS:
	iD		integer		identifies data properties
					each bit identifies a property defined in include file hos_e9.h
					Bits are set by summing parameters defined in the include file.

					Bits used are:
					HOS__SWAP_SECT: if set sectors are assumed to be ordered by
					modified sector number (see PROCEDURE).
					HOS__NONORM: no-normalization bit; passed to iHOSWrite
	cFile		character*(*)	name of file to be updated
	nT		integer		(not used)
	iT		integer		number of records
	NN(iT)		integer		record number
					Only record numbers which have the
					sign bit set will be updated
	TT(iT)		real		times (day of year)
	PP(iT)		integer		photometer (1/2/3)
	CC(iT)		integer		colors (1/2/3, 101/102/103)
	FF(iT)		integer		filters (1/2/3/4/5)	
	RR(iT)		real		heliocentric distance (AU)
	LL(iT)		real		ecliptic longitude of Sun
	nS		integer		# sectors
	ZZ(nS,iT)	real		intensities
 OUTPUTS:
	Output to new Helios file
 CALLS: ***
	ArrR4Copy, Say, bOpenFile, cInt2Str, iArrI4ValuePresent, iFreeLun, iHOSWrite
 CALLED BY:
	HOSRunningMean, TheFit
 INCLUDE:
	include		'openfile.h'
	include		'hos_e9.h'
 SIDE EFFECTS:
 >	Arguments nT and NN are not used.
	(the arguments are kept only to keep the argument lists of
	HOSRead, HOSUpdate and HOSWrite identical).
 RESTRICTIONS:
	The setting of the 4th digit of iD should be the same as used
	in the call to HOSRead used to fill the arrays.
 PROCEDURE:
 >	The arrays are usually read using HOSRead (the argument lists
	of HOSUpdate, HOSWrite and HOSRead are identical). The record number array
	NN refers to the file read by HOSRead
 >	By default (HOS__SWAP_SECT not set) the nS sectors of the intensity
	array are assumed to refer to sectors 1..nS/2,33-nS/2,..32, and are
	written to file in that order.
 >	If HOS__SWAP_SECT is set, the sectors are assumed to be ordered by
	modified sector number: 1-nS/2,...nS/2, corresponding to normal
	sector numbers: 33-nS/2,..32,1,..,nS/2, i.e. the first and second
	half are swapped. The sectors will be swapped back into normal order
	before being written to file by iHOSWrite.
 MODIFICATION HISTORY:
	SEP-1998, Paul Hick (UCSD/CASS)
	MAY-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu), updated handling of data properties in iD