[Previous]
[Next]
NAME:
N_CARRINGTON
PURPOSE:
Return Carrington rotation number for given time (iYr,Doy)
CALLING SEQUENCE:
function N_CARRINGTON(iYr,Doy)
INPUTS:
iYr integer year
Doy real day of year (including fraction for time of day)
OUTPUTS:
N_CARRINGTON integer Carrington rotation number
iYr integer start year and ...
Doy real .. day of year for rotation N_CARRINGTON
CALLS: ***
EARTH, Julian, MAP_TZERO
CALLED BY:
AdjustJDCar, BList_NSO_NOAA, BList_WSO_NOAA, MKVTRACE, Pandora, SetGrid, ipsd, ipsdt
INCLUDE:
include 'sun.h'
EXTERNAL:
external EARTH
PROCEDURE:
See R. Green, Spherical Astronomy, Cambridge UP, p. 430-434.
The formulae on p. 434 is used to obtain a first estimate for
the Carrington rotation number. The subroutine MAP_TZERO is used
to refine the estimate.
MODIFICATION HISTORY:
APR-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
NicHdr
PURPOSE:
Converts SMEI double precision header to binary trailer for Nic file
and v.v
CALLING SEQUENCE:
subroutine NicHdr(id,hdr,cTrailer)
INPUTS:
id integer 0: convert to binary
1: convert from binary
CALLED BY:
Peep, bWriteFrm, smei_frm_read, smei_frm_read_get_sdark
INCLUDE:
include 'filparts.h'
include 'smei_frm_hdr.h'
include 'smei_frm_layout.h'
CALLS: ***
ArrR8Zero, Say, Str2Str, Time2Day8, Time2Delta, Time2HMS, Time2JD, Time2Str, Time2YDoy
cInt2Str
MODIFICATION HISTORY:
JUN-2004, Paul Hick (UCSD/CASS)
MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Fixed bug in constructing hdr array from cTrailer. itrim was used
to shorten cTrailer before processing. This can erase a trailing
blank space (32B). Very bad.
[Previous]
[Next]
NAME:
NODAT
PURPOSE:
NOrmalize DATa: subtract a zodiacal dust cloud model from the raw data
CATEGORY:
Data processing
CALLING SEQUENCE:
program NoDat
INPUTS:
Unnormalized Helios data file (.ZLD file).
OUTPUTS:
Output file has the same name as input file, except for the file type
which is .DAT and is created in the same directory as the .ZLD file.
CALLS: ***
ArrI4AddConstant, AskYN, BadR4, DustAsymmetry, HOSRead, HOSUpdate, LSQFIT, Say
bOpenFile, iDeleteSymbol [1], iDeleteSymbol [2], iFreeLun, iGetFileSpec
iGetSymbol [1], iGetSymbol [2], iHOSInfo, iHOSRead, iHOSWrite, iPutFileSpec
iSetSymbol [1], iSetSymbol [2]
INCLUDE:
include 'filparts.h'
include 'openfile.h'
include 'hos_e9.h'
RESTRICTIONS:
The maximum number of points fitted is given by the parameter value nT
(1000 at present). The polarization brightness is NOT fitted.
PROCEDURE:
LsqFit at end of this file
> The zodiacal dust cloud brightness for each line of sight
(photometer/sector) combination is modeled by the function
I = C*r^P (I = intensity [S10], r= s/c-Sun distance [AU]). The
constants C and P least squares fitted (after taking
logarithms, the fit becomes linear).
> After the fit is removed, the average intensity over the residual time
series for each photometer/sector/filter combination is subtracted
(i.e. the 'background' level is redefined)
> The color index is reset from 101,102,103 in the .ZLD input file to
1,2,3 in the .DAT output file
MODIFICATION HISTORY:
1990, Valerie Hung. Modification of earlier version with the same name.
JUN-1992, Paul Hick (UCSD); Added option to use correction for
asymmetry of zodiacal dust cloud
[Previous]
[Next]
NAME:
nrBCUCOF
PURPOSE:
Returns table C used by nrBCUINT for bicubic interpolation
CATEGORY:
Math: function approximation
CALLING SEQUENCE:
subroutine nrBCUCOF(Y,Y1,Y2,Y12,D1,D2,C)
INPUTS:
Given are four gridpoints of a rectangular grid cell, numbered
counterclockwise from the lower left)
Y(4) real function values in grid points
Y1(4) real partial derivatives in x1 direction
Y2(4) real partial derivatives in x2 direction
Y12(4) real cross-derivatives
D1 real length of grid cell in x1 direction
D2 real length of grid cell in x2 direction
OUTPUTS:
C real coefficients needed for nrBCUINT
CALLED BY:
nrBCUINT
PROCEDURE:
See Numerical Recipes, par. 3.6, p 99
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrBCUINT
PURPOSE:
Find function value of point inside grid cell by bicubic interpolation
CATEGORY:
Math: function approximation
CALLING SEQUENCE:
subroutine nrBCUINT(Y,Y1,Y2,Y12,X1L,X1U,X2L,X2U,X1,X2,ANSY,ANSY1,ANSY2)
INPUTS:
Given are four gridpoints of a rectangular grid cell, numbered
counterclockwise from the lower left)
Y(4) real function values in grid points
Y1(4) real partial derivatives in x1 direction
Y2(4) real partial derivatives in x2 direction
Y12(4) real cross-derivatives
X1L real lower corner in x1 direction
X1U real upper cornner in x1 direction
X2L real lower corner in x2 direction
X2U real upper corner in x2 direction
X1 real x1 coordinate and ..
X2 real x2 coordinate of point where fnc-value is required
OUTPUTS:
ANSY real interpolated fnc-value in X1,X2
ANSY1 real partial derivative in x1 direction
ANSY2 real partial derivative in x2 direction
CALLS: ***
BadR4, nrBCUCOF
PROCEDURE:
See Numerical Recipes, par. 3.6, p. 99
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
NRGTODEN
PURPOSE:
Used by EGIPSY to create density maps
CALLING SEQUENCE:
function NRGTODEN()
INPUTS:
(none)
OUTPUTS:
NR integer # conversion formulae available
CALLS:
BadR4
SEE ALSO:
GTODEN, STRGTODEN
PROCEDURE:
See GTODEN
MODIFICATION HISTORY:
MAY-1994, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrHunt
PURPOSE:
Find the position of X in array XX, starting from an initial guess
CATEGORY:
Math: sorting
CALLING SEQUENCE:
subroutine nrHunt(N,XX,X,JLO)
INPUTS:
N integer dimension of array XX
XX(N) real array. MUST be monotonic.
X real value for which position in XX is required
JLO integer initial guess for position of X
OUTPUTS:
JLO integer array index such that X lies between
XX(JLO) and XX(JLO+1)
CALLED BY:
nrInterpol
RESTRICTIONS:
The array XX must be monotonic (increasing or decreasing).
NO CHECK IS MADE TO ENSURE THE ARRAY IS MONOTONIC.
Call SortR4 if you are not sure the array is sorted.
PROCEDURE:
See Numerical Recipes, par. 3.4, p. 91
(see also subroutine nrLocate)
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
nrInterpol
PURPOSE:
Find approximate function values at positions X, based on some
interpolation scheme on positions XA and fnc-values YA
CATEGORY:
Math: interpolation
CALLING SEQUENCE:
subroutine nrInterpol(N,XA,YA, M,X,Y,Y2A, ID_IN)
INPUTS:
N integer # XA-positions
XA(N) real x-positions where fnc-values are known
the array XA MUST be sorted (this can be
enforced by the value of ID)
YA(N) real fnc-values in positions X
M integer # X-positions
X real x-positions where fnc-values are required
(does not have to be sorted, but it does
speed things up)
Y2A(N) real scratch array
ID integer determines the type of interpolation
If ID is negative, the arrays XA,YA are explicitly sorted to
ensure that XA is in ascending order
abs(ID) = 0,1 linear interpolation
= 2 for each point in X the interpolation is based
on a quadratic polynomial based on three
points in XA (piecewise quadratic)
= 3 for each point in X the interpolation is base
on a cubic polynomial based on four points in XA
(piecewise cubic)
= 4 natural cubic spline interpolation is used
= 5 polynomial interpolation is used (i.e. the
unique polynomial of degree n_elements(XA)-1
OUTPUTS:
X real may have been sorted (if ID negative)
Y real interpolated fnc-values in positions X
CALLS: ***
Sort2R4, nrHunt, nrPolInt, nrRatInt, nrSplInt, nrSpline
CALLED BY:
BRead_WSO, MapWarp
SIDE EFFECTS:
Extrapolation is possible but will produce funny results.
PROCEDURE:
> All interpolation procedures are based on chapter 3 of Numerical
Recipes (see nrSplInt,nrSpline,nrPolInt for more details)
> If the ID value is out of range then ID=1 (linear interpolation,
no sorting is assumed)
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrLocate
PURPOSE:
Find the position of X in an array XX
CATEGORY:
Math: table searching
CALLING SEQUENCE:
subroutine nrLocate(N,XX,X,J)
INPUTS:
N integer dimension of array XX
XX real array; MUST be monotonic
X real value for which position in XX is required
OUTPUTS:
J integer index of array XX such that X lies between
XX(J) and XX(J+1)
- if X < X(1) then J=0
- if X > X(N) then X=N
RESTRICTIONS:
The array XX must be monotonic (increasing or decreasing).
NO CHECK IS MADE TO ENSURE THIS IS THE CASE.
PROCEDURE:
See Numerical Recipes, par. 3.4, p. 90
Uses standard bisection procedure.
See nrHunt if a good initial guess is available
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
nrPolInt
PURPOSE:
Function value approximation by 1-dimensional polynomial interpolation
CATEGORY:
Math: polynomial interpolation
CALLING SEQUENCE:
subroutine nrPolInt(N,XA,YA,X,Y,DY)
INPUTS:
N integer order of interpolating polynomial
max. permitted value is NMAX=10
XA(N) real x-coordinates
YA(N) real y-coordinates (fnc-values)
X real x-coordinate (where interpolated fnc value is required)
OUTPUTS:
Y real y-coordinate (interpolated fnc-value)
DY real error estimate of Y
CALLS: ***
Say
CALLED BY:
nrInterpol, nrPolInt2, nrQRomb, nrQRomo, nrTrapZD
RESTRICTIONS:
The maximum order is set by parameter NMAX (=10)
PROCEDURE:
See Numerical Recipes, par. 3.1, p. 81 (Neville's algorithm)
MODIFICATION HISTORY:
JUN-1992, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrPolInt2
PURPOSE:
Approximate function value in point (X1,X2) by 2D polynomial
interpolation on a 2D array
CATEGORY:
Math: 2D polynomial interpolation
CALLING SEQUENCE:
subroutine nrPolInt2(M,N,X1A,X2A,YA,X1,X2,Y,DY)
INPUTS:
M integer dimension in X1 direction
N integer dimension in X2 direction
X1A(M) real coordinate values in X1 direction
X2A(N) real coordinate values in X2 direction
YA(M,N) real 2D array of function values
X1 real X1 coordinate and ..
X2 real .. X2 coordinate of point where interpolated
.. fnc-value is required
OUTPUTS:
Y real interpolated fnc-value in (X1,X2)
DY real error estimate (based on X1 direction)
CALLS: ***
Say, nrPolInt
RESTRICTIONS:
The dimensions M,N must be less then MMAX and NMAX respectively.
MMAX and NMAX are define as parameters (both equal 10)
PROCEDURE:
See Numerical Recipes, par. 3.6, p. 97
First do M 1-dimensional interpolations in the x2 direction at
x1 value X1A(J) to find the fnc-values at X1A(J),X2. Then do one
final 1-dimensional interpolation in the x1 direction at X2 to find
the fnc-value at X1,X2
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrQRomb
PURPOSE:
CATEGORY:
CALLING SEQUENCE:
real function nrQRomb(Func,A,B)
INPUTS:
OUTPUTS:
CALLS: ***
Say, nrPolInt, nrTrapZD
CALLED BY:
ThomsonLOS, ThomsonLOS3D
EXTERNAL:
INCLUDE:
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
See Numerical Recipes
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrQRomo
CATEGORY:
CALLING SEQUENCE:
real function nrQRomo(Func,A,B,Choose)
INPUTS:
OUTPUTS:
CALLS: ***
Say, nrPolInt
CALLED BY:
ThomsonLOS, ThomsonLOS3D
PROCEDURE:
Available choices for Choose are MidPnt, MidInf, MidSql, MidSqu
See Numerical Recipes, Par. 4.4, p. 116)
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrQSimp
PURPOSE:
CATEGORY:
CALLING SEQUENCE:
subroutine nrQSimp(Func,A,B,S)
INPUTS:
OUTPUTS:
CALLS: ***
Say, nrTrapZD
EXTERNAL:
external Func
INCLUDE:
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
See Numerical Recipes
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrQTrap
PURPOSE:
CATEGORY:
CALLING SEQUENCE:
subroutine nrQTrap(Func,A,B,S)
INPUTS:
Func
A
B
OUTPUTS:
S
CALLS: ***
Say, nrTrapZD
EXTERNAL:
external Func
PROCEDURE:
See Numerical Recipes
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrRatInt
PURPOSE:
CATEGORY:
Math: interpolation and extrapolation
CALLING SEQUENCE:
subroutine nrRatInt(N,XA,YA,X,Y,DY)
INPUTS:
N integer
XA
N integer # points
XA(N) real x-values with known fnc-values
YA(N) real known fnc-values in XA
X real x-value where fnc-value is required
OUTPUTS:
Y real interpolated fnc-value
DY real error estimate
CALLS: ***
Say, cFlt2Str
CALLED BY:
nrInterpol
PROCEDURE:
See Numerical Recipes, par. 3.2, p. 85
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrSpline
PURPOSE:
Calculate second derivatives in X locations of interpolating spline
for Y fnc-values (the 2nd derivative array serves as input to
the interpolation subroutine nrSplInt)
CATEGORY:
Math: interpolation and extrapolation
CALLING SEQUENCE:
subroutine nrSpline(N,X,Y,YP1,YPN,Y2)
INPUTS:
N integer # points and fnc-values
X(N) real x-values; MUST be sorted
Y(N) real function values
YP1 real derivative at point 1
if YP1>=1.e30 then 2nd derivative is zero in point 1
YPN real derivative at point N
if YP1>=1.e30 then 2nd derivative is zero in point N
OUTPUTS:
Y2(N) real second derivatives at locations X
CALLS: ***
Say
CALLED BY:
SplineX, SplineY, nrInterpol, nrSplInt2, nrSpline2
RESTRICTIONS:
The X array must be sorted.
NO CHECK IS MADE TO ENSURE THAT THIS IS THE CASE
PROCEDURE:
See Numerical Recipes, par. 3.4, p. 88
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrSpline2
PURPOSE:
Return second derivatives Y2A in x2 direction for all MxN grid
points (X1A,X2A) . The Y2A array is needed as input to subroutine
nrSplInt2.
CATEGORY:
Math: interpolation and extrapolation
CALLING SEQUENCE:
subroutine nrSpline2(M,N,X1A,X2A,YA,Y2A)
INPUTS:
M,N integer
X1A(M) real array with x1 values
X2A(N) real array with x2 values
YA(M,N) real 2D array with function values
OUTPUTS:
Y2A(M,N) real 2nd derivatives in x2 direction
in grid points (X1A,X2A)
CALLS: ***
Say, nrSpline
PROCEDURE:
See Numerical Recipes, par. 3.6, p. 100
nrSpline is used on all N columns (constant X1) to obtain the second
derivatives in the x2 direction of a 1-dimensional natural spline
through fnc-values Y(N,Ix2=1..M).
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
nrSplInt
PURPOSE:
Calculate fnc-value in X using cubic spline interpolation
CATEGORY:
Math: interpolation and extrapolation
CALLING SEQUENCE:
subroutine nrSplInt(N,XA,YA,Y2A,X,Y)
INPUTS:
N integer # points
XA(N) real x-coordinates
YA(N) real fnc-values
Y2A(N) real 2nd derivatives
(output from subroutine nrSpline)
X real x-coordinate where fnc-value is required
OUTPUTS:
Y real interpolated fnc-value in point X
CALLS: ***
Say
CALLED BY:
SplineX, SplineY, nrInterpol, nrSplInt2
PROCEDURE:
See Numerical Recipes, par. 3.4, p. 89
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrSplInt2
PURPOSE:
Approximate function value in X1,X2 by interpolating on 2D normal
spline on grid X1A,Y2A with fnc-values YA
CATEGORY:
Math: interpolation and extrapolation
CALLING SEQUENCE:
subroutine nrSplInt2(M,N,X1A,X2A,YA,Y2A,X1,X2,Y)
INPUTS:
M,N integer grid dimensions
X1A(M) real # points in x1 direction
X2A(N) real # points in x2 direction
YA(M,N) real fnc-values in grid points
Y2A(M,N) real 2nd derivatives in x2 direction in grid
points (from subroutine nrSpline2)
X1,X2 real coordinates where fnc-value is required
OUTPUTS:
Y real interpolated fnc-value in X1,X2
CALLS: ***
nrSplInt, nrSpline
PROCEDURE:
Based on chapter 3 of Numerical Recipes
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrSqueezeX
CALLING SEQUENCE:
subroutine nrSqueezeX(XN1,XN2,XM1,XM2,NX,NY,ZN,bFlag)
CALLS: ***
SplineGridX
PROCEDURE:
Obsolete. Use SplineGridX
[Previous]
[Next]
NAME:
nrSqueezeY
CALLING SEQUENCE:
subroutine nrSqueezeY(YN1,YN2,YM1,YM2,NX,NY,ZN,bFlag)
CALLS: ***
SplineGridY
PROCEDURE:
Obsolete. Use SplineGridY
[Previous]
[Next]
NAME:
nrTrapZD
PURPOSE:
CATEGORY:
CALLING SEQUENCE:
subroutine nrTrapZD(Func,A,B,S,N)
INPUTS:
OUTPUTS:
CALLS:
Choose, Say, nrPolInt
CALLED BY:
nrQRomb, nrQSimp, nrQTrap
EXTERNAL:
INCLUDE:
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
See Numerical Recipes
MODIFICATION HISTORY:
JUN-1993, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
nrZbrac
PURPOSE:
Bracket one or more zeros in a given interval for a function of one
independent variable
CATEGORY:
Math: finding roots
CALLING SEQUENCE:
logical function nrZbrac(Func,X1,X2,iFix)
INPUTS:
FUNC real function to be tested; should be declared external in
the calling program
X1,X2 real limits of interval to be tested
iFix integer
OUTPUTS:
nrZbrac logical .TRUE. if zero is bracketed; .FALSE. if not
X1,X2 real values bracketing zeroes
CALLED BY:
ThomsonMidpoint, ThomsonMidpointFar
SEE ALSO:
nrZBrent, nrZbrak
RESTRICTIONS:
XB1 and XB2 must be declared in the calling program with a dimension
equal or greater than the input value of NB.
PROCEDURE:
"Outward search" for roots. The interval is expanded outward by
a factor 1.6*(X2-X1) until a zero is bracketed.
See Press et al., "Numerical Recipes", Cambridge UP (1989), par. 9.1,
p. 245
[Previous]
[Next]
NAME:
nrZbrak
PURPOSE:
Bracket one or more zero's in a given interval for a function of one
independent variable
CATEGORY:
Math: finding roots
CALLING SEQUENCE:
subroutine nrZbrak(FUNC,X1,X2,N,XB1,XB2,NB)
INPUTS:
FUNC real function to be tested; should be declared external in
the calling program
X1,X2 real limits of interval to be tested
N integer # subintervals to be tested
NB integer maximum # sign changes looked for
OUTPUTS:
NB integer # sign changes detected
XB1(NB),XB2(NB)
real limits of subintervals over which sign change
is detected
SEE ALSO:
nrZBrent, nrZbrac
RESTRICTIONS:
XB1 and XB2 must be declared in the calling program with a dimension
equal or greater than the input value of NB.
PROCEDURE:
"Inward search" for roots. Subdivide a given interval [X1,X2] into
N subintervals and look for sign changes across the subintervals.
See Press et al., "Numerical Recipes", Cambridge UP (1989), par. 9.1,
p. 245
[Previous]
[Next]
NAME:
nrZBrent
PURPOSE:
Find node (zero) of function of one variable
CATEGORY:
Math: finding roots
CALLING SEQUENCE:
real function nrZBrent(FUNC,X1,X2,TOL)
INPUTS:
FUNC name of the function
should be declared as real external function in the
calling program, i.e.
EXTERNAL FUNC
X1,X2 real x-values which bracket the required node,
i.e. FUNC(X1)*FUNC(X2) >= 0
TOL real tolerance in position of node
OUTPUTS:
nrZBrent real x-value (with accuracy TOL) which makes function value zero
CALLS: ***
Say
CALLED BY:
KeplerOrbit, ThomsonMidpoint, ThomsonMidpointFar
SEE ALSO:
nrZBrentd, nrZbrac, nrZbrak
RESTRICTIONS:
> The node must be bracketed by X1 and X2, i.e. FUNC(X1)*FUNC(X2) >= 0.
PROCEDURE:
See Press and Teukolsky, Numerical Recipes
[Previous]
[Next]
NAME:
nrZBrentd
PURPOSE:
Find node (zero) of function of one variable
CATEGORY:
Math: finding roots
CALLING SEQUENCE:
double precision function nrZBrentd(FUNC,X1,X2,TOL)
INPUTS:
FUNC name of the function
should be declared as double precision external function in the
calling program, i.e.
double precision FUNC
external FUNC
X1,X2 double precision x-values which bracket the required node,
i.e. FUNC(X1)*FUNC(X2) >= 0
TOL double precision tolerance in position of node
OUTPUTS:
nrZBrentd double precision x-value (with accuracy TOL) which makes function value zero
CALLS: ***
Say
CALLED BY:
Time2KeplerOrbit
SEE ALSO:
nrZBrent
RESTRICTIONS:
> The node must be bracketed by X1 and X2, i.e. FUNC(X1)*FUNC(X2) >= 0.
PROCEDURE:
See Press and Teukolsky, Numerical Recipes