XMAP_OBS_POS $SSW_SMEI_UCSD/gen/for/lib/ephem/xmap_obs_pos.f
[Previous] [Next]
 NAME:
	XMAP_OBS_POS
 PURPOSE:
	Given the modified Carrington variable XSC of the spacecraft, calculate
	the corresponding modified Carrington variable for an observed location
	at heliographic longitude XLNG
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	function XMAP_OBS_POS(XSC,XLNG)
 INPUTS:
	XSC	real	modified Carrington variable for spacecraft position
	XLNG	real	heliographic longitude for point of observation
			(degrees; 0 <= XLNG < 360)
 OUTPUTS:
	XMAP_OBS_POS
		real	modified Carrington variable for observation point
 CALLED BY:
	MAP_DATA
 PROCEDURE:
	The difference in heliographic longitude between spacecraft and 
	observed location is used to obtain the modified Carrington variable
	for the observed location.
	The difference in longitude is subject to the restriction:
	If the observed point lies in the eastern hemisphere, 0 <= DXLNG < -180;
	If it lies in the western hemisphere 0 <= DXLNG < 180.
	Then XOBS = XSC-DXLNG/360.
 MODIFICATION HISTORY:
	JAN-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


XMAP_SC_POS $SSW_SMEI_UCSD/gen/for/lib/ephem/xmap_sc_pos.f
[Previous]
 NAME:
	XMAP_SC_POS
 PURPOSE:
	Calculate the 'modified Carrington variable' for a given spacecraft
	position at a given time iYr,Doy
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	function XMAP_SC_POS(SC_NAME, iYr, Doy, nCar, JDCar)
 INPUTS:
	SC_NAME		real			external function; identifies spacecraft
	iYr		integer			year
	Doy		real			day of year, including fraction for time of day
	nCar		integer			# Carrington start times
						(see PROCEDURE for meaning of negative nCar)
	JDCar(*)	double precision	Carrington start times (Julian days)
 OUTPUTS:
	XMAP_SC_POS	real			modified Carrington variable
 CALLS: ***
	BadR4, Julian, Say, cFlt2Str
 CALLED BY:
	MAP_DATA
 RESTRICTIONS:
	The time iYr,Doy for which the modified Carrington variable is required
	must be inside the time range covered by JDCar
 REMARK:
	The Carrington rotation number in the discussion below refers to the
	array index of JDCar. If the 'spacecraft' is EARTH this corresponds
	to the conventional Carrington rotation number except for an offset
	which depends on the exact call to MAP_TZERO, which calculates JDCar.
 PROCEDURE:
 >	SC_NAME must be declared EXTERNAL in the calling program
	SC_NAME is a user-written function which calculates the heliographic
		longitude Lng of a spacecraft for a given time iYr,Doy
	The call to SC_NAME has the form:
		Lng = SC_NAME(iYr,Doy)
	where iYr (integer*4) and Doy (real*4) are input and Lng (real*4)
	is output.
 >	DEFINITION: Carrington start time
	Time at which the spacecraft heliographic longitude is zero.
	A list of Carrington start times JDCar is calculated by subroutine
	MAP_TZERO.
 >	DEFINITION: Carrington rotation N
	The spacecraft moves across Carrington rotation N between times
	JDCar(N) and JDCar(N+1). Between these times the spacecraft
	heliographic longitude decreases from 360 to 0.
 >	DEFINITION: Modified Carrington variable
	For a given time T the spacecraft position is inside Carrington
	rotation N at heliographic location (Lng,Lat).
	The rotation number N and the longitude Lng are combined in the
	'modified Carrington variable' by
		XS = N+(360.-Lng)/360.
	i.e. the integer part of XS identifies the Carrington rotation,
	and the fraction the heliographic longitude; as the spacecraft
	moves across Carrington rotation N, XS increases from N to N+1.

 >	If the specified time lies outside the range covered by the
	JDCar array then program execution stops if nCar is set to a
	positive value; for negative values BadR4() is returned. 
 MODIFICATION HISTORY:
	JAN-1991, Paul Hick (UCSD/CASS)
	JUN-2002, Paul Hick (UCSD/CASS)
	    Fixed bug for input times very close to the start/end of a
	    Carrington rotation. The result sometimes would be off by +/- 1.
	OCT-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Bugfix. Changed declaration JDCar(nCar) to JDCar(*).
	    nCar can be negative!