GAL_CNTR $SMEI/for/lib/hos/gal_cntr.f
[Previous] [Next]
 NAME:
	GAL_CNTR
 PURPOSE:
	Flag data points close to the galactic center
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	subroutine GAL_CNTR(iSc,iCnt,NST,NS,LL,PP,ZZ)
 INPUTS:
	iSc		integer		1=Helios A, 2=Helios B
	iCnt		integer		# observations
	NST,NS		integer		range of sectors (modified sectors #)
	LL(iCnt)	real		ecliptic longitude of Sun
	PP(iCnt)	integer		=1,2; photometer ID
	ZZ(NST:NS,iCnt)	real		intensities
 OUTPUTS:
	ZZ(NST:NS,iCnt)	real		intensities
 CALLS: ***
	BadR4
 CALLED BY:
	READ_HOS
 SIDE EFFECTS:
	No corrections are made for Helios B (iSc=2)
 PROCEDURE:
	When the ecliptic longitude of a sector falls inside the range
	specified in arrays GALMIN,GALMAX (indicating the range of ecliptic
	longitude where the galactic center contributes significantly to the
	signal) the intensity is flagged (set to BadR4())
 MODIFICATION HISTORY:
	???-????, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


GAMMALN $SMEI/ucsd/gen/for/lib/math/gammaln.f
[Previous] [Next]
 NAME:
	GAMMALN
 PURPOSE:
	Calculate natural logarithm of gamma function for X>1
 CATEGORY:
	Math: special functions
 CALLING SEQUENCE:
	function GAMMALN(XX)
 INPUTS:
	XX	real*4	(read-only)	x-value where gamma fnc is evaluated
 OUTPUTS:
	GAMMALN real*4	logarithm of gamma function in X
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
	Lanczos formulae. Calculations are performed in double precision.
 MODIFICATION HISTORY:
	Numerical Recipes, p. 157.


GaussLookup $SMEI/ucsd/gen/for/lib/math/gausslookup.f
[Previous] [Next]
 NAME:
	GaussLookup
 PURPOSE:
	Calculates exp(-x*x-y*y) using lookup table
 CATEGORY:
	Math
 CALLING SEQUENCE:
	function GaussLookup(X,Y)
 INPUTS:
	X		real		X-coordinate
	Y		real		Y-coordinate
 OUTPUTS:
	F		real		fnc value
 CALLS: ***
	FLINT
 CALLED BY:
	GridSphere3D, GridSphereRange, GridSphereWeight, RebinSphere
 SEE ALSO:
	CosLookup, SinLookup
 MODIFICATION HISTORY:
	SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Get2Dval $SMEI/for/lib/get2dval.f
[Previous] [Next]
 NAME:
	Get2Dval
 PURPOSE:
	2D linear interpolationInterpolates values from positions
	specified as XC,XL (modified Carrington variable, latitude (deg)
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	subroutine Get2Dval(XCbeg,XCend,nLng,nLat,F2D,N,XC,XL,FF)
 INPUTS:
	(all input is read-only)
	nLng		integer		# longitudes
	nLat 		integer		# latitudes
	F2D(nLng,nLat)	real		2D array (longitude, latitude)
	N		integer		# points
					
	XC(N)		real		Modified Carrington variable
	XL(N)		real		Heliographic latitude (deg)
 OUTPUTS:
	FF(N)		real		Interpolated function values
 CALLS: ***
	FLINT
 CALLED BY:
	MkGModel, MkVModel, MkVObsn360
 INCLUDE:
	include		'mapangles.h'
 PROCEDURE:
 >	The modified Carrington variable is mapped to the range [1,nLng]
	The latitude is mapped to the range [1,nLat]
	The distance is mapped to the range [1,nRad]
 >	For each point, if any of the neighbours contains a bad value, or if any of the
	coordinates is more than one bin width outside the index ranges, then the value
	BadR4() is returned (see FLINT).
 MODIFICATION HISTORY:
	MAY-1997, Paul Hick (UCSD; pphick@ucsd.edu)


Get3DTval $SMEI/for/tdlib/get3dtval.f
[Previous] [Next]
 NAME:
	Get3DTval
 PURPOSE:
	3D linear interpolationInterpolates values from positions
	specified as XC,XL,RP (modified Carrington variable, latitude (deg) and
	time (in XC)
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	call Get3TDval(XCbe,XCtbeg,XCtend,nLng,nLat,nT,F3D,N,XC,XL,TI,FF)
 INPUTS: (all input is read-only)
	XCbe(2,nT)	real		Beginning and ending Carrington variables
	XCtbeg		double precision Beginning of time intervals
	Xctend		double precision Ending of time intervals
	nLng		integer		# longitudes
	nLat 		integer		# latitudes
	nT		integer		# time points
	F3D(nLng,nLat,nT) real	3D array (longitude, latitude, time)
	N		integer		# points
					
	XC(N)		real		Modified Carrington variable
	XL(N)		real		Heliographic latitude (deg)
	TI(N)		double precision Carrington variable value from first time
 OUTPUTS:
	FF(N)		real		Interpolated function values
 CALLS: ***
	FLINT
 CALLED BY:
	Extractd, MkGModeltdn, MkVModeltd, shift_MOD [1], shift_MOD [2], write3D_infotd3D
 INCLUDE:
	include		'mapcoordinates.h'
 PROCEDURE:
 >	The modified Carrington variable is mapped to the range [1,nLng]
	The latitude is mapped to the range [1,nLat]
	The time is mapped to the range [1,nT]
 >	For each point, if any of the neighbours contains a bad value, or if any of the
	coordinates is more than one bin width outside the index ranges, then the value
	BadR4() is returned (see FLINT).
 MODIFICATION HISTORY:
	MAY-1997, Paul Hick (UCSD; pphick@ucsd.edu)


Get3Dval $SMEI/for/lib/get3dval.f
[Previous] [Next]
 NAME:
	Get3Dval
 PURPOSE:
	3D linear interpolationInterpolates values from positions specified as
	XC,XL,RP (modified Carrington variable, latitude (deg) and distance (AU)
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	subroutine Get3Dval(XCbeg,Xcend,RR,dRR,nLng,nLat,nRad,F3D,N,XC,XL,RP,FF)
 INPUTS: (all input is read-only)
	RR		real
	dRR		real		Distance between individual maps (in AU)
	nLng		integer		# longitudes
	nLat 		integer		# latitudes
	nRad		integer		# DF maps formed (height begins ~0 AU)
	F3D(nLng,nLat,nRad) real	3D array (longitude, latitude, radial distance)
	N		integer		# points
					
	XC(N)		real		Modified Carrington variable
	XL(N)		real		Heliographic latitude (deg)
	RP(N)		real		Heliocentric distance (AU)
 OUTPUTS:
	FF(N)		real		Interpolated function values
 CALLS: ***
	FLINT
 CALLED BY:
	ExtractInsitu, MkPos, ipsd
 INCLUDE:
	include		'mapcoordinates.h'
 PROCEDURE:
 >	The modified Carrington variable is mapped to the range [1,nLng]
	The latitude is mapped to the range [1,nLat]
	The distance is mapped to the range [1,nRad]
 >	For each point, if any of the neighbours contains a bad value, or if any of the
	coordinates is more than one bin width outside the index ranges, then the value
	BadR4() is returned (see FLINT).
 MODIFICATION HISTORY:
	MAY-1997, Paul Hick (UCSD; pphick@ucsd.edu)


Get4Dval $SMEI/for/tdlib/get4dval.f
[Previous] [Next]
 NAME:
	Get4Dval
 PURPOSE:
	4D linear interpolationInterpolates values from positions
	specified as XC,XL,RP (modified Carrington variable, latitude (deg) and
	distance (AU)
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	call Get4Dval(NN,XCbe,XCtbeg,XCtend,RR,dRR,nLng,nLat,nMap,nT,
			F4D,N,TI,XC,XL,RP,FF)
 INPUTS: (all input is read-only)
	NN		integer		# of F4D parameters
	XCbe(2,nT)	real		Beginning and ending Carrington variables
	XCtbeg		double precision Beginning of time intervals
	Xctend		double precision Ending of time intervals
	RR		real		Beginning map distance
	dRR		real		Distance between individual maps (in AU)
	nLng		integer		# longitudes
	nLat 		integer		# latitudes
	nMap		integer		# DF maps formed (height begins ~0 AU)
	nT		integer		# time points
	F4D(nLng,nLat,nMap,nT) real	4D array (longitude, latitude, radial distance, time)
	N		integer		# points
					
	TI(N)		real		Carrington variable value from first time
	XC(N)		real		Modified Carrington variable
	XL(N)		real		Heliographic latitude (deg)
	RP(N)		real		Heliocentric distance (AU)
 OUTPUTS:
	FF(NN,N)	real		Interpolated function values
 CALLS: ***
	FLINT
 CALLED BY:
	Extractd, Extractd3d, MkPostd, ipsdt, write3D_infotd3D
 INCLUDE:
	include		'mapcoordinates.h'
 PROCEDURE:
 >	The modified Carrington variable is mapped to the range [1,nLng]
	The latitude is mapped to the range [1,nLat]
	The distance is mapped to the range [1,nMap]
 >	For each point, if any of the neighbours contains a bad value, or if any of the
	coordinates is more than one bin width outside the index ranges, then the value
	BadR4() is returned (see FLINT).
 MODIFICATION HISTORY:
	MAY-1997, Paul Hick (UCSD; pphick@ucsd.edu)


get_compiler [1] $SMEI/ucsd/gen/for/os/linux/get_compiler_gnu.f
[Previous] [Next]
 NAME:
	get_compiler
 CALLING SEQUENCE:
	subroutine get_compiler(f77id)
 CALLED BY:
	Time2System


get_compiler [2] $SMEI/ucsd/gen/for/os/linux/get_compiler_intel.f
[Previous] [Next]
 NAME:
	get_compiler
 CALLING SEQUENCE:
	subroutine get_compiler(f77id)
 CALLED BY:
	Time2System


GetLOSValue $SMEI/for/lib/getlosvalue.f
[Previous] [Next]
 NAME:
	GetLOSValue
 PURPOSE:
	4D linear interpolation. Interpolates values from positions
	specified as modified Carrington variable (XC), latitude (XL), heliocentric
	distance (RP) and time (XT).
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	subroutine GetLOSValue(iRow,nRow,XCbegMAT,XCendMAT,F3D,N,PPlos,FFlos)
 INPUTS:
	iRow			integer		coordinate to interpolate on (1..nRow)
	nRow			integer		# coordinates
	XCbegMAT(nTim)		real		Start Carrington variable
	XCendMAT(nTim)		real		End Carrington variable

	F3D(nRow,nLng,nLat,nRad,nTim)real	5D array (coordinate, longitude, latitude,
						radial distance, time)
	N			integer		# points
	PPlos(4,N)		real		Lng/lat/rad/time of points on los
 OUTPUTS:
	FFlos(nRow,N)		real		Interpolated function values
						(Only FFlos(iRow,*) is modified)
 CALLS: ***
	FLINT, T3D_get_grid, T3D_iget
 CALLED BY:
	LOSIntegralG, LOSIntegralV, LOSProjection
 INCLUDE:
	include		't3d_param.h'
	include		't3d_array.h'
	include		't3d_index.h'
	include		't3d_grid_fnc.h'
	include		't3d_loc_fnc.h'
 PROCEDURE:
 >	The modified Carrington variable is mapped to the range [1,nLng]
	The latitude is mapped to the range [1,nLat]
	The distance is mapped to the range [1,nRad]
 >	For each point, if any of the neighbours contains a bad value, or if any of the
	coordinates is more than one bin width outside the index ranges, then the value
	BadR4() is returned (see FLINT).
 MODIFICATION HISTORY:
	MAY-1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


GinBar $SMEI/ucsd/gen/for/lib/obsolete/ginbar.f
[Previous] [Next]
 NAME:
	GinBar	
 PURPOSE:
	Duummy routine for Windows and Linux
	for functions containing calls to GRPACK functions
 CALLED BY:
	HOSPlot, HOSPlot_EditPoints, HOSPlot_bCommand, TheFit
 PROCEDURE:
	Needed by: MapReadSrf
 MODIFICATION HISTORY:
	JAN-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


GIPSCAST $SMEI/for/lib/gipscast.f
[Previous] [Next]
 NAME:
	GIPSCAST
 PURPOSE:  
	Calculates aftcast and forecast G values at two day intervals.
 CATEGORY: 
	Linear interpolation
 CALLING SEQUENCE:
	subroutine GIPSCAST(MJDEarth,nX,Gval,NS)
 INPUTS:
	MJDEarth		real*8		modified Julian day at the 
						position of the Earth 
	nX			integer		# latititudes
	Gval(-nX/2:nX/2)	real		G values at latitude of Earth
	NS			integer		# fore- and aftcast steps (2 day
						steps)
 OUTPUTS: (to file)
	DOYG(2,-NS:NS)		real		array with current,preceding,  
		and subsequent days of the year (at two day intervals) and the
		corresponding G values for those days
	DEL_G(-NS:NS)		real		differences between
		interpolated G values and the G value presently at Earth
 CALLS: ***
	Julian, Say, bOpenFile, iFilePath, iFreeLun
 INCLUDE:
	include		'dirspec.h'
	include		'openfile.h'
	include		'sun.h'
 MODIFICATION HISTORY:
	JUL-1992, Kari Winfield (UCSD)
	AUG-1992, Susan Rappoport (UCSD)


GIPSIMP $SMEI/for/lib/gipsimp.f
[Previous] [Next]
 NAME:
	GIPSIMP
 PURPOSE:  
	Calculates aftcast and forecast G values at two day intervals.
 CATEGORY: 
	Linear interpolation
 CALLING SEQUENCE:
	subroutine GIPSIMP(cVFile,MJDEarth,nX,Gval,NS)
 INPUTS:
	cVFile		character*(*)	name of IMP data file
	MJDEarth	real*8		modified julian day at the
						position of the Earth
	nX		integer		# latititudes
	Gval(-nX/2:nX/2)real		G values at latitude of Earth
					0 = no G-value is available
	NS		integer		# fore- and aftcast steps (2 day steps)
 OUTPUTS: (to file)
	DOYG(2,-NS:NS)	real		array with current, preceding, and
		subsequent days of the year (at two day intervals) and the
		corresponding G values for those days
	DEL_G(-NS:NS)	real		differences between interpolated G values
					and the G value presently at Earth
 CALLS: ***
	Julian, Say, bOpenFile, iFreeLun
 INCLUDE:
	include		'openfile.h'
	include		'sun.h'
 MODIFICATION HISTORY:
	July 1992, Kari Winfield (UCSD)
	August 1992, Susan Rappoport (UCSD)


grdisp $SMEI/for/h/grdisp.h
[Previous] [Next]
 NAME:
	grdisp
 PURPOSE:
	Defines parameters needed by GRPACK plotting package.


GridFill $SMEI/ucsd/gen/for/lib/grid/gridfill.f
[Previous] [Next]
 NAME:
	GridFill
 PURPOSE:
	Removes empty bins. An empty bin is given the average over all 
	neighbours with valid function values.
 CATEGORY:
	Plotting: contours
 CALLING SEQUENCE:
	subroutine GridFill(nFillIn,nX,nY,Z,NSIDE,Zmin,Zmax)
 INPUTS:
	nFill		integer	The three least-significant digits of nFill are used:
				mod(nFill,1000) >= 100: messages to screen are suppressed
				mod(nFill, 100) >=  10: Z(.,.,2) is used as output array
					(otherwise Z(*,*,2) is never accessed)
				mod(nFill,  10) >=   0: threshold on # valid neighbours
					If zero then all empty bins with extrapolated values
					are filled in. If larger than zero (and at most 8)
					only empty bins with valid neighbours equal or larger
					than the specified threshold are filled in.
	nX,nY		integer	dimensions of input grid
	Z(nX,nY) or Z(nX,nY,2)	!!! Z(nX,nY) can be used only if nFill < 10 !!!
			real	
		Z(.,.,1)	array of function values (BadR4() indicates bad value)
		Z(.,.,2)	used as scratch space; content does not matter
	NSIDE(nX,nY,-1:1,-1:1)
			integer*1 scratch array
 OUTPUTS:
	Z(nX,nY,2)	real
		Z(.,.,1)	array of function values with empty bins removed
				or (only nFill>0)
		Z(.,.,2)	array identifying the extrapolated values:
				= -1  contents of bin is same as valid input value
				=  1  contents of bin is extrapolated value
				nFill>0 only:
				=  0  empty bin with less than nFill neighbours
				      Z(.,.,1) = BadR4() (same as input).
	Zmin		real	minimum function value (incl interpolated fncv)
	Zmax		real	maximum function value (incl interpolated fncv)
 CALLS: ***
	ArrR4GetMinMax, ArrR4Mask, BadR4, GridFillWeight, Int2Str, Say, Str2Str
	iArrR4ValuePresent, iGridScan
 CALLED BY:
	GridSphere3D, GridSphereRange, GridSphereWeight, MKVTRACE, RebinSphere, ipsd, ipsdt
	ipsg2, ipsg2s, ipsg2t, smei_get_lsff
 RESTRICTIONS:
	If the input array Z is declared in the calling program as Z(nX,nY)
	then nFill MUST be less than 10 to avoid accessing Z(*,*,2)
 PROCEDURE:
 >	If nFill = 0 then:
	Step 1: for each empty bin, count the number of non-empty neighbours
	Step 2: find the subset of empty bins with the maximum number of
		non-empty neighbours
	Step 3: for the subset of step 2, calculate the average over the non-
		empty neighbours and assign this average to the empty bin
	Step 4: Go to step 1
	Repeat until there are no empty bins left.

 >	nFill > 0:
	Step 1: for each empty bin, count the number of non-empty neighbours
	Step 2: find the subset of empty bins with nFill or more non-empty
		neighbours
	Step 3: for the subset of step 2, calculate the average over the non-
		empty neighbours and assign this average to the empty bin
	Step 4: Return.

 >	Neighbouring function values are averaged using the function
	GridFillWeight to get weighting factors. The default function
	returns GridFillWeight = 1 (see end of this file).
	Override the default function with a different version by
	making sure it precedes this file in the compilatation.

	The function has the form
		function GridFillWeight(I,J,INX,JNY,ZN)
	I,J and INX,JNY are the indices of empty bin and neighbour bin.
	ZN the function value in the neighbour bin.

 >	'Bad' bins are usually identified by testing for BadR4().
	This can be modified using GridFillBad:

	rbad = BadR4Set(0.0)
	call GridFill(nFillIn,nX,nY,Z,NSIDE,Zmin,Zmax)
	rbad = BadR4Set(rbad)

	The second BadR4Set call restores the original BadR4 value
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD/CASS)
	APR-1999, Paul Hick (UCSD/CASS)
	    simplified code by introducing iGridScan function
	MAY-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    added option to suppress output messages
	NOV-2004, Paul Hick (UCSD/CASS)
	    Added entry point GridFillBad to modify the actual
	    value used to indicate 'bad'.
	FEB-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Removed GridFillBad again. The BadR4 value can
	    now be set by BadR4Set.


GridFillWeight $SMEI/ucsd/gen/for/lib/grid/gridfillweight.f
[Previous] [Next]
 NAME:
	GridFillWeight
 PURPOSE:
	Sample for use in GridFill
 CALLING SEQUENCE:
	function GridFillWeight(I,J,INX,JNY,ZN)
 CALLED BY:
	GridFill
 MODIFICATION HISTORY:
	SEP-2007, Paul Hick (UCSD/CASS)
	    Extracted from gridfill.f


GridRan2Reg $SMEI/ucsd/gen/for/lib/grid/gridran2reg.f
[Previous] [Next]
 NAME:
	GridRan2Reg
 PURPOSE:
	Generate function values in a regular grid of NX by NY points.
	The input function values are specified on a set of NPTS random
	points XP,YP
 CATEGORY:
	Plotting: contours
 CALLING SEQUENCE:
	subroutine GridRan2Reg(DistIn,NPTS,XP,YP,ZP,XB,YB,XE,YE,NX,NY,Z)
 INPUTS:
	DistIn		real		data points closer than abs(Dist) grid
					spacings from a grid point are included
					in the averaging
			If Dist < 0 then input fnc-values in arrays Z and ZP of
			BadR4() values are disregarded in the averaging

	NPTS		integer		number of points in the random set
			If NPTS < 0 then Z returns standard deviations
	XP(NPTS)	real		X/Y-coordinates of points in the
	YP(NPTS)			random set in user-specified units
	ZP(NPTS)	real		function values in the random set
	XB,YB		real		X/Y-coordinate of grid point (1,1)
					in user units
	XE,YE		real		X/Y-coordinate of grid point (NX,NY)
					in user units

	NX,NY		integer		dimensions of regular output grid
 OUTPUTS:
	Z(NX,NY)	real		grid function values.
					If no function value was calculated for
					a particular grid point the value
					BadR4() is returned
 CALLS: ***
	ArrI4Zero, ArrR4DivideByArrI4, ArrR4Zero, BadR4, Say
 SEE ALSO:
	GridReg2Reg
 RESTRICTIONS:
 >	The user units for XB,XE,YB,YE should be the same as for XP and YP
 >	The # elements in the output grid are limited to the
	value set for parameter NMAX. Currently NMAX=10000.
 PROCEDURE:
 >	BadR4() is used to identify invalid fnc-values in in- and output Z
 >	The output grid defines a regular grid of NYxNX squares.
	The function values Z are calculated by averaging over points ZP
	inside a grid square.
 MODIFICATION HISTORY:
	1989-1990, Paul Hick (SRON,MPAE,UCSD/CASS)
	1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu); complete revision


GridReg2Reg $SMEI/ucsd/gen/for/lib/grid/gridreg2reg.f
[Previous] [Next]
 NAME:
	GridReg2Reg
 PURPOSE:
	Generate function values in a regular grid of NX by NY points. The
	input function values are specified on a regular grid of MX by MY points
 CATEGORY:
	Plotting: contours
 CALLING SEQUENCE:
	subroutine GridReg2Reg(Dist,MX,MY,ZP,NX,NY,Z)
 INPUTS:
	Dist		real		data points closer than abs(Dist) grid
					spacings from a grid point are included
					in the averaging
			If Dist < 0 then input fnc-values in arrays Z and ZP of
			BadR4() values are disregarded in the averaging

	MX,MY		integer		dimensions of regular input grid
	ZP(MX,MY)	real		function values in input grid

	NX,NY		integer		dimensions of regular output grid
 OUTPUTS:
	Z(NX,NY)	real		grid function values.
					If no function value was calculated for
					a particular grid point the value
					BadR4() is returned
 CALLS: ***
	BadR4
 SEE ALSO:
	GridRan2Reg
 RESTRICTIONS:
	The user units for XB,XE,YB,YE should be the same as for XP and YP
 PROCEDURE:
 >	BadR4() is used to identify invalid fnc-values in in- and output Z
 >	The output grid defines a regular grid of NYxNX squares.
	The function values Z are calculated by averaging over points ZP
	inside a grid square.
 MODIFICATION HISTORY:
	1989-1990, Paul Hick (SRON,MPAE,UCSD/CASS)
	1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu); complete revision


GridSphere2D $SMEI/ucsd/gen/for/lib/grid/gridsphere2d.f
[Previous] [Next]
 NAME:
	GridSphere2D
 PURPOSE:
	Fills 'holes' and/or smooths a 2D array using a Gaussian weighting function.
	The array dimensions represent a regular grid in spherical coordinates
	(longitude and latitude). The third is the grid in radial distance.
 CALLING SEQUENCE:
	subroutine GridSphere2D(dXC,nLng,nLat,nR,Z,WidDeg,iBadZ,WThreshold,ClipLng)
 INPUTS:
	    real	dXC		! range of Carrington variable covered by nLng
					! i.e. number of 360 deg rotations.
	    integer	nLng		! # longitudes
	    integer	nLat		! # latitudes
	    integer	nR		! # radial distances
	    real	Z(nLng,nLat,nR)	! 3D array of function values
	    real	WidDeg		! Width of Gaussian used for angular
					! smoothing (in degrees) (WidDeg<0 has
					! special meaning; see PROCEDURE)
	    integer	iBadZ		! 0: Invalid elements remain invalid;
					!    valid elements are replaced by a
					!    smoothed value
					! 1: All elements (valid and invalid) are
					!    replaced by smoothed values.
					! 2: Invalid elements are replaced by
					!    smoothed values; valid elements remain
					!    untouched.
					!
					! The following two options are useful if all
					! bad bins have to be filled in with something.
					! Use them at your own risk (see PROCEDURE).
					!
					! 3: Same as iBadZ=1, but if any invalid
					!    elements remain at the end, these are
					!    all filled in by a call to GridFill
					! 4: Same as iBadZ=2, but if any invalid
					!    elements remain at the end, these are
					!    all filled in by a call to GridFill
					!
					! >=10: use open grid for longitude and latitude
	    real	WThreshold	! The replacement by a smoothed value is
					! made only if total weight is 
					! larger than/equal to the threshold value.
					! (see PROCEDURE).
	    real	ClipLng		! Longitude difference (see PROCEDURE)
					! (usually set to zero).
 OUTPUTS:
	    real	Z(nLng,nLat,nR)	  smoothed array of function values
 CALLS: ***
	GridSphere3D
 CALLED BY:
	MkDMap, MkDMaptdn, MkShift, MkShiftdn, MkVMap, MkVMaptdN, SW_Model_Kinematic, ipsd
	ipsdt, ipsg2, ipsg2s, ipsg2t, shift_MOD [1], shift_MOD [2], sim_MOD, smei_skyd_fts
	smei_skyd_init, smei_skyd_make, smei_skyd_sky
 PROCEDURE:
	GridSphere2D is a one-line wrapper around GridSphere3D
 MODIFICATION HISTORY:
	FEB-1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


GridSphere3D $SMEI/ucsd/gen/for/lib/grid/gridsphere3d.f
[Previous] [Next]
 NAME:
	GridSphere3D
 PURPOSE:
	Fills 'holes' and/or smooths a 3D array using a Gaussian weighting function.
	Two of the array dimensions represent a regular grid in spherical
	coordinates (longitude and latitude). The third represents a regular
	grid in radial distance.
 CALLING SEQUENCE:
	subroutine GridSphere3D(dXC,nLng,nLat,nR,Z,WidDeg,R1,iBadZ,WThreshold,ClipLng)
 INPUTS:
	dXC		real		range of Carrington variable covered by nLng
					i.e. number of 360 deg rotations.
	nLng		integer		# longitudes
	nLat		integer		# latitudes
	nR		integer		# radial distances
	Z(nLng,nLat,nR)	real		3D array of function values
	WidDeg		real		Width of Gaussian used for angular
					smoothing (in degrees) (WidDeg<0 has
					special meaning; see PROCEDURE)
	R1		real		(3D version only)
				R1 > 0:Radial distance for inner boundary (in
					grid spacings), i.e. location of Z(*,*,1)
					R1=0 IS INVALID; MUST BE R1>0
				R1 < 0:(value does not matter)
					suppresses the radial smoothing, i.e.
					each subarray Z(*,*,i),i=1,nR is
					2D smoothed over longitude and latitude only.
	iBadZ		integer	     0: Invalid elements remain invalid;
					valid elements are replaced by a
					smoothed value
				     1: All elements (valid and invalid) are
					replaced by smoothed values.
				     2: Invalid elements are replaced by
					smoothed values; valid elements remain
					untouched.

					The following two options are useful if all
					bad bins have to be filled in with something.
					Use them at your own risk (see PROCEDURE).

				     3: Same as iBadZ=1, but if any invalid
					elements remain at the end, these are
					all filled in by a call to GridFill
				     4: Same as iBadZ=2, but if any invalid
					elements remain at the end, these are
					all filled in by a call to GridFill

				  >=10: Use open grid for longitude and latitude (?)
				 >=100: Use lookup table for Gaussian

	WThreshold	real		The replacement by a smoothed value is
					made only if total weight is 
					larger than/equal to the threshold value.
					(see PROCEDURE).
	ClipLng		real		Longitude difference (see PROCEDURE)
					(usually set to zero).
 OUTPUTS:
	Z(nLng,nLat,nR)	real		smoothed array of function values
 CALLED BY:
	GridSphere2D
 INCLUDE:
	include		'math.h'
 CALLS: ***
	ArrR4Copy, BadR4, GaussLookup, GridFill, Say, iArrR4ValuePresent
 RESTRICTIONS:
 >	GridSphere3D uses internal scratch arrays, which are
	dimensioned using 3 parameters, LNG,LAT and LNR. If the scratch
	arrays are too small, program execution stops.
 >	iBadZ=3 and iBadZ=4:
	GridFill uses a 2D algorithm to fill in holes. If nR>1 then GridFill
	is applied to each level k=1,nR separately.
 PROCEDURE:
 >	Invalid or 'Bad' array elements are indicated by the value BadR4()
 >	The 1st dimension represents a regular grid in longitude covering
	[0,360] degrees, i.e. Lng(i) = 360*(i-1)/(nLng-1), i=1,nLng.
	The 2nd dimension represents a regular grid in latitude covering
	[-90,+90] degrees, i.e. Lat(j) = -90*[-1+2*(j-1)/(nLat-1)], j=1,nLat.
	The 3rd dimension represents a regular grid in radial distance,
	i.e. R(k) = R1+k-1
 >	Obviously, 2D arrays can be smoothed by setting nR=1.
 >	GridSphere2D is just a special call to GridSphere3D with R1=-1 (the
	value does not matter as long as it's negative).
 >	The weighting is Gaussian with weight=1 at the origin. To avoid loosing
	valid elements for iBadZ=0 or 1, set the threshold weight to a
	value less than 1.
 >	The angular weighting factor involves the angular distance between
	two locations on a sphere. The points are connected by two arcs,
	one is the minimum angular distance A (0<A<180), the other is the
	complementary angle AC=360-A (180<AC<360).
	If ClipLng=0 the angle A is always used. As a result, the smoothed
	function value for small/large longitudes will depend on the input
	function values at large/small longitudes with fairly large weighting
	factors (since the angular distance is small).
	This effect can be suppressed by setting ClipLng to a non-zero value.
	If the longitude difference abs(Lng(i1)-Lng(i2)) is larger than
	ClipLng, then the corresponding element is excluded.
	BE CAREFUL WHEN USING THIS OPTION. In particular, setting
	ClipLng to values around 180 degrees affects the smoothing for
	points near the poles (where points with a wide range of longitude
	differences are close together). As a guideline 
	ClipLng > 180+3*WidDeg is probably not a bad place to start.
 >	If WidDeg > 0, the smoothing procedure is speeded up by looping
	over only part of the array when calculating the smoothed function 
	value. Excluded are all elements which are more than 3 times the
	Gaussian width away from the element for which the smoothed value is
	calculated (the weight would be less than exp(-9)). The exclusion
	is based on an approximate calculation of the distance between points.
	Near the poles there may be a problem (see the explanation in the code),
	but I think it's under control now.
	In case you don't trust the result set WidDeg to a negative value.
	If WidDeg <0, then the absolute value is used as Gaussian width, and
	the whole array is used in the calculation of the smoothed average.
	The procedure will be a LOT slower though.
 >	If ClipLng=0 then the averaging algorithm is mod(XCend-XCbeg), i.e. if
	in the input array column 1 (XC = XCend) and column nLng (XC = XCbeg)
	are the same this is also true for the output array.
	HOWEVER this symmetry is broken if iBadZ=3 or 4 because of the extra
	call to GridFill.
 MODIFICATION HISTORY:
	FEB-1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


GridSphereRange $SMEI/ucsd/gen/for/lib/grid/gridsphere3d.f
[Previous] [Next]
 NAME:
	GridSphereRange
 PURPOSE:
 CALLING SEQUENCE:
	entry GridSphereRange(range_lo_,range_hi_)
 CALLS: ***
	ArrR4Copy, BadR4, GaussLookup, GridFill, Say, iArrR4ValuePresent
 CALLED BY:
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 MODIFICATION HISTORY:
	MAY-2007, Paul Hick (pphick@ucsd.edu)


GridSphereWeight $SMEI/ucsd/gen/for/lib/grid/gridsphere3d.f
[Previous] [Next]
 NAME:
	GridSphereWeight
 PURPOSE:
 CALLING SEQUENCE:
	entry GridSphereWeight(nLng,nLat,nR,Z,ZThreshold_)
 CALLS: ***
	ArrR4Copy, BadR4, GaussLookup, GridFill, Say, iArrR4ValuePresent
 CALLED BY:
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 MODIFICATION HISTORY:
	MAY-2007, Paul Hick (pphick@ucsd.edu)


grpack $SMEI/for/h/grpack.h
[Previous] [Next]
 NAME:
	grpack
 PURPOSE:
	Parameter definitions needed by GRPACK plot package


GTODEN $SMEI/for/lib/gtoden.f
[Previous] [Next]
 NAME:
	GTODEN
 PURPOSE:
	Used by EGIPSY to create density maps
 CALLING SEQUENCE:
	function GTODEN(IDFNC,G)
 INPUTS:
	IDFNC		integer		ID for indentifying conversion formulae
					if < 0 in GTODEN the inverse is applied
	G		real		G-value to be converted
 OUTPUTS:
	GTODEN		real		Calculated density
 CALLS: ***
	BadR4
 CALLED BY:
	ConvertG2D
 SEE ALSO:
	NRGTODEN, STRGTODEN
 PROCEDURE:
	To add additional conversions from G value to density, do the following
	(the places where these changes should be made is indicated in the code)
 > 1.	Add code for the conversion. This would look like:

	else if (IDFNC .eq. ?) then
	    <more code>
	    GTODEN = <return value for density>
	else if (IDFNC .eq. -?) then
	    <more code>
	    GTODEN = <return value for G-value from inverse function>

	? stands for the next higher IDFNC value not yet in use
 > 2.	Add a string descriptor for the function. This would look like:

	else if (IDFNC .eq. ?) then
	    cStr = '<string desciptor>'

	? is the same value as the one in the previous step

 > 3.	Increase NRGTODEN. The line defining the new NRGTODEN will usually be:

	NRGTODEN = ?

	where ? again is the same value as in the previous steps
 MODIFICATION HISTORY:
	MAY-1994, Paul Hick (UCSD)