[Previous]
[Next]
NAME:
Carrington
PURPOSE:
Get times when Earth was at Carrington variable XC, and v.v
CALLING SEQUENCE:
FUNCTION Carrington, xc_or_t , $
fraction = fraction , $
longitude = longitude , $
rotation = rotation , $
get_fraction = get_fraction , $
get_longitude = get_longitude , $
get_rotation = get_rotation , $
get_time = get_time , $
get_variable = get_variable , $
near_longitude = near_longitude, $
degrees = degrees
INPUTS:
xc_or_t array; type: any numerical type
if input is a Carrington variable, the
return value is the corresponding UT time
array; type: standard time structure
if input is a UT time, the return value
is a Carrington variable.
OPTIONAL INPUTS:
/get_fraction return fraction of rotation
/get_longitude return heliographic longitude
/get_rotation return integer rotation number
/get_time always return UT time (even if input already
is a UT time)
/get_variable always return Carrington variable (even if
input already is a Carrington variable)
near_longitude=near_longitude
heliographic longitude in [0,360]
If specified this heliographic longitude is
translated into a Carrington variable within half
a rotation from input Carrington variable/time
xc_or_t. Note that the rules for the return value
are the same as without the near_longitude, i.e.
if xc_or_t is a Carrington variable then the
return value is a time structure, unless one of the
get_* keywords is set.
OUTPUTS:
Result If no /get_* keywords are set:
array; type: standard time structure
array; type: double
/get_fraction : fraction of rotation
/get_longitude: heliographic longitude
/get_rotation : integer Carrington rotation nr.
/get_time : UT time
/get_variable : Carrington variable
OPTIONAL OUTPUTS:
fraction=fraction
array; type: double
positive fraction of a rotation
longitude=longitude
array; type: double
heliographic longitude
rotation=rotation
array; type: integer
integer Carrington rotation number
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
AngleRange, CvSky, IsTime, IsType, SubArray, TimeArray, TimeOp, TimeOrigin, TimeSet
TimeUnit, ToRadians, jpl_eph
CALLED BY:
EarthSky3DLoc, EarthTransit3DLoc, InSitu, InterpolateHeliosphere
PlotSynopticMap, RemoteView_Init_View, TimeGet, TimeSet, forecast, forecast_ice
mk_celias, nso_fe_plot, qRemoteView_ChangeCoordinates, qRemoteView_ChangeTimes
qRemoteView_Pick, qRemoteView_Time, qvu_draw, qvu_pick, vu_atlocation
vu_earthskymap, vu_extract, vu_filename, vu_get_page, vu_getdata, vu_gettime
vu_image, vu_insitu, vu_insitu_raw, vu_insitucurve, vu_localskymap, vu_mean
vu_movie, vu_nagoyasourcemap, vu_new_time, vu_planarcut, vu_quick_movie
vu_remoteview, vu_select, vu_set, vu_set_time_entry, vu_solardisk, vu_synopticmap
vu_timeseries, vu_update_marker, vu_vox_write, vu_whatis
PROCEDURE:
An estimate for the Carrington start time is set up first.
This is iteratively refined.
If keyword near_longitude is defined then
the difference in longitude between near_longitude and
xc_or_t is calculated. If the difference is less than
-180 deg then 360 deg is added; if greater than 180 deg
then 360 deg is subtracted.
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
JAN-2004, Paul Hick (UCSD/CASS)
Substantial rewrite to improve precision from several
minutes to about a milli-second, and avoid calls to
CarringtonT0
APR-2004, Paul Hick (UCSD/CASS)
Added code to prevent iteration loop to get stuck in
infinite loop
JUN=2006, Paul Hick (UCSD/CASS)
Bug fix (du was subscripted with n instead of nn)
JUL-2007, Paul Hick (UCSD/CASS)
Merged carringtonvar, carringtont, carringtonlng,
carringtonnr and arg_time into this procedure.
Merged CarringtonNear by adding keyword near_longitude.
AUG-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Removed calls to scearth.
[Previous]
[Next]
NAME:
CenterOfMass
PURPOSE:
Calculate center of mass of a distribution of masses in n dimensions
CATEGORY:
gen/idl/toolbox
CALLING SEQUENCE:
FUNCTION CenterOfMass, mass_array, loc_array
INPUTS:
mass_array array of any structure; type: integer or float
OPTIONAL INPUT PARAMETERS:
loc_array array[n, size(mass_array,/dim)]
i.e. same structure as mass_array with one extra
leading dimension
OUTPUTS:
P scalar, or array[n]; double precision
coordinates of center of mass. In the one-dimensional
case (n=1) a scalar is returned.
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
SubArray, SyncDims
CALLED BY:
even_light, qImage_cw_ZEllipse, qImage_cw_ZUpdate, wedge_content
SIDE EFFECTS:
The center of mass calculation is done in double precision.
PROCEDURE:
Two separate cases are calculated:
> 1. Only the mass_array is specified as an n-dimensional array.
The center of mass is returned as an n-element array (scalar if n=1).
The array index in each dimension is used as the distance scale:
mass_array = [[1,2],[3,4]]
P = centerofmass(mass_array)
results in
P = [0.6,0.7]
> 2. If both mass_array and loc_array are specified then loc_array, with
leading dimension of n elements, specifies the n-dimensional locations
of the masses in mass_array, e.g. in the 3-dimensional case, if mass_array
is a 10x10 array then loc_array would be a 3x10x10 array, with
loc_array[0,*,*] the x-coordinate, loc_array[1,*,*] the y-coordinate and
loc_array[2,*,*] the z-ccordinate.
The above example again:
mass_array = [1,2,3,4]
loc_array = [[0,0],[1,0],[0,1],[1,1]]
P = centerofmass(mass_array)
results in
P = [0.6,0.7]
MODIFICATION HISTORY:
NOV-1999, Paul Hick (UCSD/CASS)
FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
internally the procedure converts the mass array to a normalized mass by
dividing by the total mass. This results in a divide by zero if the sum is
zero (presumably because all masses are zero). To avoid this one unit is
added to each mass.
[Previous]
[Next]
NAME:
CheckDir
PURPOSE:
Check whether a directory exists
CATEGORY:
Environment
CALLING SEQUENCE:
FUNCTION CheckDir, Name, LongName, stay=stay, silent=silent
INPUTS:
Name scalar string, the directory name
Name='' always returns status=1B with
LongName set to the current directory.
OPTIONAL INPUT PARAMETERS:
/stay if set then a 'cd' to the directory is made (if it exists)
OUTPUTS:
Status 0 : directory doesn't exist
1 : directory exists
OPTIONAL OUTPUT PARAMETERS:
LongName scalar string
Status=0 : null string
Status=1 : fully qualified directory name
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
FindAllSubDirs, IDL_postop_win, IDL_vm_startup, RemoteView_Display2D
RemoteView_Display3D, SetFileSpec, clean_loc_smei, forecast_html, forecast_ice
forecast_info, getnagoyasources, getootyasources, getsmeiasources, hide_env
mk_flick, qImage_cw_SmeiMask, qView_FileFilter, skyd_cat, skyd_equ, skyd_version
smei_base_testcase, smei_buf, smei_buf_get, smei_buf_getframe, smei_buf_mget
smei_buf_prep, smei_filepath, smei_frm_cp, smei_frm_findpoint, smei_frm_summary
smei_frm_write, smei_getfile, smei_hdr_get, smei_hdr_make, smei_hdr_plot
smei_mksidereal, smei_orbits_stat, smei_sky_track, smei_star_fitone
smei_star_remove, smei_zld_remove, smeidb_mounted, unhide_env, vu_get_page
vu_image, vu_movie, vu_quick_movie, www_help, www_help_rsi
RESTRICTIONS:
> No attempt is made to pre-process the input directory name
(such as translation of logicals/env. variables, etc.)
CALLS: ***
FILEPATH, InitVar, hide_env, who_am_i
PROCEDURE:
> CD is used to decide whether a directory exists, and is
used to retrieve the full directory name.
> filepath is called to make sure a trailing (back)slash is appended on
Unix and Windows systems.
MODIFICATION HISTORY:
DEC-1997, Paul Hick
SEP-2002, Paul Hick (UCSD/CASS)
Return zero if input spec contains wildcard.
FEB-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added name of calling routine to informational message.
[Previous]
[Next]
NAME:
clean_loc_smei
PURPOSE:
Removes selected files from backup copy of the SMEI tree
(which is accessible by anonymous ftp)
CATEGORY:
smei/pro/main
CALLING SEQUENCE:
idl clean_loc_smei.pro
CALLS:
CheckDir, FindAllFiles, do_file, txt_read
PROCEDURE:
The backup copy is located in subdirectory loc_smei located
in the anon ftp root.
MODIFICATION HISTORY:
DEC-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
CleanGlitchBox
PURPOSE:
Given that a glitch has been detected (specified as a single pixel,
check a neighbourhood of the pixel to decide whether the glitch
covers more than one pixel.
CATEGORY:
Avoidable ?
CALLING SEQUENCE:
FUNCTION CleanGlitchBox, Frames, Loc, spotwidth=SpotWidth, frac=frac
INPUTS:
Frames 3D-array, any type (float or double needed to use NaN option)
stack of 2D frames combined in 3D array; the last dimension counts
the number of frames
Frame elements set to the value !VALUES.F_NAN or D_NAN are ignored
Loc 1-dim array, type long integer
location of pixels already identified as part of glitches
specified as 1-dim indices into the Frames array.
OPTIONAL INPUT PARAMETERS:
spotwidth=SpotWidth
scalar, integer, default=1
should be an odd integer.
defines a neighbourhood of SpotWidth x Spotwidth pixels
!! If SpotWidth is not defined the procedure simply
returns the input Loc array unmodified.
frac=frac scalar, any type, default=1
Used in the criterion for deciding whether a pixel is part of
a glitch or not. See PROCEDURE.
OUTPUTS:
nLoc scalar, long integer
# elements in Loc (=n_elements(Loc))
Loc 1-dim array, type long integer
location of the glitches as 1-dim indices into the Frames array
The array will contain all the input values. Added are all pixels
that are identified as part of the glitch
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
ArrayLocation, BadValue, UNIQ
CALLED BY:
Find2DGlitch
PROCEDURE:
For each element in the Loc array a box of SpotWidth x SpotWidth in the
appropriate frame is processed. Minimum and median in the box are calculated
excluding the center of the box.
The difference between median and minimum is used to identify other pixels
in the box which are considered part of the central glitch. Any pixel more
than frac*(median-minimum) above the median is considered part of the glitch.
MODIFICATION HISTORY:
OCT-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
clock
PURPOSE:
Display time of day (including day of year (DOY) and Julian day number (JD)
CATEGORY:
Totally unnecessary
CALLING SEQUENCE:
PRO clock
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
TimeGet, TimeSet
MODIFICATION HISTORY:
JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
ColorPolarBox
PURPOSE:
Draws a color display for a set of 'skyboxes' as defined by a grid
of spherical coordinates. Draws either a rectangular map
(x=phase,y=polar), a fish-eye map or a Hammer-Aitoff map
CALLING SEQUENCE:
PRO ColorPolarBox, cosP, sinP, Color, $
skyedge = skyedge , $
zero_phase = zero_phase, $
dabg = dabg , $
degrees = degrees , $
black = black , $
void = void , $
fill2edge = fill2edge
INPUTS:
Phase array[n [+1] ] or array[n [+1],m [+1] ]; type: float
Phase angle; 'longitude'
Dimension n and/or m is used to specify the center of
sky box n,m (the box edges will be calculated internally
Dimension n+1 and/or m+1 is used to specify the edges of
sky box n,m
Polar array[m [+1] ] or array[n [+1],m [+1] ]; type: float
Polar angle; 'colatitude'
Box center of box edge can be specified, as for 'Phase'
Color array[n,m]; type: integer
2D array with color indices
boxes with negative color indices are never colored in
boxes with index zero are colored only if keyword /black is set
skyedge scalar; type: float
if set and positive, data are plotted as a 'fish-eye' map.
The value is used as cut-off for the range of polar angles
plotted (polar angles above 'skyedge' not plotted); if set and
negative, a Hammer-Aitoff projection is used; if not set or
zero, a rectangular map is drawn
OPTIONAL INPUTS:
zero_phase=zero_phase
scalar, or array with same structure as 'Phase'; type: float
Only used if Xp is a 1-dim array of box centers.
The input arrays Xp, Yp, Color are rearranged to put
zero_phase in the center of the map.
dabg=dabg array[3]; type: float; default: [0,0,0]
Passed to FishEye and HammerAitoff
Determines the direction of the center of the plot
/degrees if set, all angles are in degrees (default: radians)
/black if set, then color index 0 (black) is drawn with a call to polyfill
By default color index 0 is not drawn (i.e. remains in the
background color).
/void if set, then negative color index is drawn using the foreground
color !p.color. By default these are not drawn (i.e. remain
in the background color).
/fill2edge if set, then the phase angle boundaries of the outermost bins are set to
+/- 180 degrees. Only used if bin centers are specified for
the phase angles.
OUTPUTS:
skyedge scalar
updated only if positive and bigger than 170 deg
(returned value is 170 deg)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, SuperArray, ToDegrees, ToRadians
RESTRICTIONS:
> Color must be a 2D array with dimension [N,M]. The first dimension (N) is the
phase angle dimension; the second (M) is the polar angle dimension
> The Phase and Polar arrays can be 1-dim or 2-dim.
A 1-dim Phase array (n) is interpreted as a 2-dim array (n,m) with all m rows the same.
A 1-dim Polar array (m) is interpreted as a 2-dim array (n,m) with all n columns the same.
> The second dimension of Phase should be the same (n=N) or one larger (n=N+1) than for Color.
If n=N+1 then Phase contains the phase angles of the edges of sky boxes; if n=N it contains
the center phase angles, and the edges are calculated internally.
> The second dimension of Polar should be the same (m=M) or one larger (m=M+1) than for Color.
If m=M+1 then Polar contains the polar angles of the edges of sky boxes; if m=M it contains
the center polar angles, and the edges are calculated internally.
> The value of 'skyedge' is changed to skyedge = (skyedge < 170).
The method of plotting the skyboxes (by connecting the corners by straight lines in
the x-y plane of the plot) does not work for large elongations. Problems are avoiding
by not permitting 'skyedge' to be larger than 170.
PROCEDURE:
> The color array indices contains color indices for NxM 'skyboxes'.
The corners of the boxes are stored in the Phase and Polar arrays
> Phase and Polar are spherical coordinates in a coordinate system where
the reference direction (e.g. the direction to the Sun) is the Z-axis.
> Synonyms:
phase angle = longitude, position angle
polar angle = colatitude, elongation
> The arrays Phase and Polar will usually be obtained by a call to EulerRotate
> The array color can be obtained by a call to GetColors
> If the 'skyedge' keyword is set, then the angles Phase and Polar are plotted
on the screen as a 'fish-eye' view, interpreting the Polar angle
as 'radius' and the Phase angle as an phase angle in the x-y plane of
the plot, i.e. x = Polar*cos(Phase) and y = Polar*sin(Phase).
> The boxes in the x-y plane of the plot are defined by connecting the
corners by straight lines (and using the appropriate color).
> Boxes with color index 0 (black) are skipped by default. If the keyword
'black' is set color index 0 is explicitly colored with polyfill
MODIFICATION HISTORY:
AUG-1999, Paul Hick (UCSD/CASS)
added check for negative color indices, these are now ignored
(GetColors now checks for bad values using the 'finite' function and
sets corresponding boxes to a negative color index).
JAN-2002, Paul Hick (UCSD/CASS)
Improved tests to decide which sky boxes to plot in a fish-eye plot
at large polar angles.
APR-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /fill2edge keyword.
[Previous]
[Next]
NAME:
ColorSkybox
PURPOSE:
Draws a color display for a set of 'skyboxes' as defined by a grid
of spherical coordinates. Draws either a rectangular map
(x=phase,y=latitude), a fish-eye map or a Hammer-Aitoff map
CALLING SEQUENCE:
PRO ColorSkybox, Phase, Latitude, Color, $
skyedge = skyedge , $
zero_phase = zero_phase, $
dabg = dabg , $
degrees = degrees , $
black = black , $
void = void , $
fill2edge = fill2edge
INPUTS:
Phase array[n [+1] ] or array[n [+1],m [+1] ]; type: float
Phase angle; 'longitude'
Dimension n and/or m is used to specify the center of
sky box n,m (the box edges will be calculated internally
Dimension n+1 and/or m+1 is used to specify the edges of
sky box n,m
Latitude array[m [+1] ] or array[n [+1],m [+1] ]; type: float
Latitude angle
Box center or box edge can be specified, as for 'Phase'
Color array[n,m]; type: integer
2D array with color indices
boxes with negative color indices are never colored in
boxes with index zero are colored only if keyword /black is set
skyedge scalar; type: float
if set and positive, data are plotted as a 'fish-eye' map.
The value is used as cut-off for the range of colatitude (polar)
angles plotted (polar angles above 'skyedge' not plotted);
if set and negative, a Hammer-Aitoff projection is used;
if not set or zero, a rectangular map is drawn
OPTIONAL INPUTS:
zero_phase=zero_phase
scalar, or array with same structure as 'Phase'; type: float
Only used if Xp is a 1-dim array of box centers.
The input arrays Xp, Yp, Color are rearranged to put
zero_phase in the center of the map.
dabg=dabg array[3]; type: float; default: [0,0,0]
Passed to FishEye and HammerAitoff
Determines the direction of the center of the plot
/degrees if set, all angles are in degrees (default: radians)
/black if set, then color index 0 (black) is drawn with a call to polyfill
By default color index 0 is not drawn (i.e. remains in the
background color).
/void if set, then negative color index is drawn using the foreground
color !p.color. By default these are not drawn (i.e. remain
in the background color).
/fill2edge if set, then the phase angle boundaries of the outermost bins are set to
+/- 180 degrees. Only used if bin centers are specified for
the phase angles.
OUTPUTS:
skyedge scalar
updated only if positive and bigger than 170 deg
(returned value is 170 deg)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
AngleRange, FishEye, HammerAitoff, InitVar, IsType, SuperArray, ToDegrees, ToRadians
CALLED BY:
PlotEarthSkymap, PlotPolarSkymap
RESTRICTIONS:
> Color must be a 2D array with dimension [N,M]. The first dimension
(N) is the phase angle dimension; the second (M) is the latitude
angle dimension
> The Phase and Latitude arrays can be 1-dim or 2-dim.
A 1-dim Phase array (n) is interpreted as a 2-dim array (n,m) with
all m rows the same. A 1-dim Latitude array (m) is interpreted as
a 2-dim array (n,m) with all n columns the same.
> The second dimension of Phase should be the same (n=N) or one larger
(n=N+1) than for Color. If n=N+1 then Phase contains the phase angles
of the edges of sky boxes; if n=N it contains the center phase angles,
and the edges are calculated internally.
> The second dimension of Latitude should be the same (m=M) or one
larger (m=M+1) than for Color. If m=M+1 then Latitude contains the
latitude angles of the edges of sky boxes; if m=M it contains
the center latitude angles, and the edges are calculated internally.
> The value of 'skyedge' is changed to skyedge = (skyedge < 170).
The method of plotting the skyboxes (by connecting the corners by
straight lines in the x-y plane of the plot) does not work for large
elongations in the fish-eye maps. Problems are avoiding by not
permitting 'skyedge' to be larger than 170.
PROCEDURE:
> The color array indices contains color indices for NxM 'skyboxes'.
The corners of the boxes are stored in the Phase and Latitude arrays
> Phase and Latitude are usually equatorial (RA, dec) or ecliptic
coordinates
> The center of fish-eye and Hammer-Aitoff has phase angle zero_lng
and latitude 0.
> The arrays Phase and Latitude will usually be obtained by a call
to EulerRotate
> The array color can be obtained by a call to GetColors
> If the 'skyedge' keyword is set, then the angles Phase and Latitude
are plotted on the screen as a 'fish-eye' view.
> The boxes in the x-y plane of the plot are defined by connecting the
corners by straight lines (and using the appropriate color).
> Boxes with color index 0 (black) are skipped by default. If the keyword
'black' is set color index 0 is explicitly colored with polyfill
MODIFICATION HISTORY:
AUG-1999, Paul Hick (UCSD/CASS)
added check for negative color indices, these are now ignored
(GetColors now checks for bad values using the 'finite'
function and sets corresponding boxes to a negative color
index).
JAN-2002, Paul Hick (UCSD/CASS)
Improved tests to decide which sky boxes to plot in a fish-eye
plot at large polar angles.
APR-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /fill2edge keyword.
[Previous]
[Next]
NAME:
CombineRotations
PURPOSE:
Combine two rotations, i.e. find the rotation resulting from
first applying one (R1), then another (R2) rotation.
CATEGORY:
gen/idl/toolbox/math
CALLING SEQUENCE:
R = CombineRotations(R1, R2 [,R3,R4,R5], /euler_angles, degrees=degrees)
INPUTS:
R1 array[3,n], array[4,n], array[3,3,n]; type: float
first rotation
R2 array[3,m], array[4,m], array[3,3,m]; type: float
second rotation
R1 and/or R2 can be a single rotation with the other
multiple rotations, i.e. n = 1 and m != 1; or n != 1
and m = 1. The single rotation will be combined with
each of the multiple rotations.
R3,R4,R5 Additional rotations. Up to 5 rotations can be combined
in a single call.
OPTIONAL INPUT PARAMETERS:
/quaternion input and output rotations are in quaternions;
/euler_angles in- and output rotations are in Euler angles triplets
/dcm in- and output rotations are in direction cosine matrices
/geometric in- and putput rotations are in geometic form
(unit vector, plua rotation around unit vector).
/degrees if set then all angles are in degrees (default: radians)
OUTPUTS:
R array[3,n > m]; type: same as input
combined rotation in same form as input
CALLS: ***
CvRotation, InitVar, IsType, SyncArgs
CALLED BY:
CvSky, CvSky_Galactic, smei_cam_quaternion, smei_camera, smei_frm_where
smei_orient_test, vu_planarcut
SEE ALSO:
EulerRotate
PROCEDURE:
See definition of quaternions in: Foley, van Dam, Feiner and Hughes
'Computer graphics, principles and practice', 2nd edition.
Addison-Wesley, 1992, page 1063
MODIFICATION HISTORY:
MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
compile_opt
PURPOSE:
Controls default IDL error handler and special compiler options
CALLING SEQUENCE:
@compile_opt.pro
PROCEDURE:
Included in virtually all IDL procedures in the SSW_SMEI tree
MODIFICATION HISTORY:
JAN-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
coord3to2
PURPOSE:
Convert a 3D position vector to a 2D 'screen location'
CATEGORY:
CALLING SEQUENCE:
result = coord3to2(p, [,/device, /normal])
INPUTS:
p array[3,*]; type: int or float
coordinates of 3d vectors
OPTIONAL INPUT PARAMETERS:
/data, /normal, /device
only one of these should be set
if set the input coordinates are assumed to be in data, normal
or device coordinates. If all are absent, then data coordinates are assumed
OUTPUTS:
p array[3,*]; same type as input
the converted 'screen location'
OPTIONAL OUTPUT PARAMETERS:
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, SyncDims
CALLED BY:
arrow3d, plot3dtext
PROCEDURE:
If a 3D transformation (!p.t) is in effect than all 3D vector arguments supplied to IDL
plot functions while using the /t3d keyword are converted to a 'screen location' for actual plotting.
This function is my best guess as to how this works. The x,y coordinates of the returned
vector indicate where on the screen (inside the plotwindow) the point would be plotted, while
the z-coordinate provides the 'depth' dimension perpendicular to the screen.
MODIFICATION HISTORY:
AUG-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
Cv2Grid
PURPOSE:
Generate function values in a regular grid of NX by NY points.
The input function values are specified on a set random points XP,YP
with function values ZP, or as a 2-D array ZP
CALLING SEQUENCE:
Z = Cv2Grid (ZP, nX,nY, dist=Dist, xp=XP, yp=YP, pos=pos, zflag=Zflag, noflag=NoFlag)
Z = Cv2Grid (ZP, nX,nY, dist=Dist, zflag=Zflag, noflag=NoFlag)
INPUTS:
ZP array[*] or array[*,*]; type:float
if array[*] : function values for a 'random' set of data points
if array[*,*]: any 2-dim array to be rebinned
nX scalar; type: integer
nY scalar: type: integer
size of regular output array
OPTIONAL INPUTS:
dist=Dist
scalar; type: float
data points closer than abs(Dist) grid
spacings from an output grid point are included
in the averaging
xp=XP array[*]; type: float
yp=YP array[*]; type: float
X/Y-coordinates of points in the random set in user-specified units
position=[XB,YB,XE,YE]
array[4]; type: float
XB,YB) X/Y-coordinates of grid point (0,0) in user units
XE,YE X/Y-coordinates of grid point (nX-1,nY-1) in user units
zflag=ZFlag
scalar; type: float; default: !values.f_nan
value used to identify invalid fnc-values in in- and output Z
/noflag if set, no fnc-values are flagged as 'bad'
OUTPUTS:
Z array[nX,nY]; type: float
grid function values.
If no function value was calculated for a particular grid point
the value Zflag is returned
RESTRICTIONS:
The user units for XB,XE,YB,YE should be the same as for XP and YP
PROCEDURE:
> If both keywords xp and yp are present, then zp is assumed to be 1-dim
array of 'random' points. Otherwise zp is assumed to be a 2-dim array.
> The output grid defines a regular grid of nX by nY squares.
> The function values Z are calculated by averaging over points ZP
inside a grid square.
MODIFICATION HISTORY:
JAN-1995, Paul Hick (UCSD); based on Fortran routine CONSTRUCT_GRID
[Previous]
[Next]
NAME:
CvPointOnLos
PURPOSE:
Converts from topocentric to heliocentric coordinates and v.v
CALLING SEQUENCE:
FUNCTION CvPointOnLos, RP,$
oldelo = ELOLD , $
oldphase= PHOLD , $
newelo = ELNEW , $
eorw = EorW , $
degrees = degrees
INPUTS: (either topocentric or heliocentric)
RP array[3,*]; type: float
RP[0,*] = longitude (0<=LNG<=360) and ...
RP[1,*] = latitude (-90<=LAT<=90) of line of sight
RP[2,*] = radial distance to point on los
(in units of the observer-Sun distance)
OPTIONAL INPUT PARAMETERS:
/degrees if set all in- and output angles are in degrees
(default is radians)
OUTPUTS: (either heliocentric or topocentric)
Result array[3,*]; type: float
RP[0,*] = longitude (0<=XLNG<=360) and ...
RP[1,*] = latitude (-90<=XLAT<=90) of line of sight
RP[2,*] = radial distance to point on los
(in units of the observer-Sun distance)
oldelo=OldElo array[*]; type: float
elongation in the old coordinate system; 0<=ELOLD<=180
oldphase=OldPhase array[*]; type: float
phase angle measured counterclockwise from the north
newelo=NewElo array[*]; type: float
elongation in the new coordinate system 0<=ELNEW<=180
EorW array[*]; type: integer
+1 or -1; indicates on which side (East or West) of
the Sun-Earth line the point is located
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
IsType, SubArray, SyncDims, ToRadians, boost
CALLED BY:
EarthSky3DLoc, EarthTransit3DLoc, ThomsonLOSDensity, nagoya_glevel
RESTRICTIONS:
> There is no check for -90 <= XLAT <= 90
PROCEDURE:
> The topocentric coordinate system (with Earth in the origin)
has its X-axis pointing towards the Sun. Y and Z-axis are arbitrary
(usually the X-Y plane will be the ecliptic).
The topocentric longitude is measured in a positive sense, i.e.
counterclockwise as viewed from the positive Z-axis.
> The heliocentric coordinate system (with the Sun in the origin
has its X-axis pointing towards Earth.
The heliocentric longitude is measured in a positive sense.
> Spherical coordinates for both systems: longitude (deg), latitude
(deg) and radial distance (units of Sun-Earth distance).
> Input can be in topocentric or heliocentric coordinates. The output
will be in the other coordinate system (the calculation is symmetric).
> EorW is determined from the input elongation XLNG:
if 0<=XLNG<=180 then EorW = 1; if 180<XLNG<360 the EorW = -1
> If input is in topocentric coordinates then
- OldElo is the angle Sun-Earth-P
- NewElo is the angle Earth-Sun-P
- EorW = +1 if P is towards the east of the Sun (viewed from Earth)
- EorW = -1 if P is towards the west of the Sun (viewed from Earth)
> If input is in heliocentric coordinates then
- OldElo is the angle Earth-Sun-P
- NewElo is the angle Sun-Earth-P
- EorW = -1 if P is towards the east of the Sun (viewed from Earth)
- EorW = +1 if P is towards the west of the Sun (viewed from Earth)
> If RP is negative then the opposite direction (180+XLNG,-XLAT,-RP)
is used.
> The Sun is located at topocentric longitude 0 deg and latitude 0 deg
and radial distance 1.0
> The Earth is located at heliocentric longitude 0 deg and latitude
0 deg and radial distance 1.0
> Internal calculations are done in double precision
> The easiest way to check the equations is to work out the relations
between the x,y,z components of the vector to P in both coordinates
systems.
MODIFICATION HISTORY:
FEB-1990, Paul Hick (UCSD)
Adapted from the subroutine SC_ECLIP.FOR
JUN-1994, Paul Hick (UCSD)
Made the calculation symmetric so that it is valid also going
from heliocentric to topocentric.
[Previous]
[Next]
NAME:
CvPrecess
PURPOSE:
Converts equatorial or ecliptic coordinates for epoch UT1 to
epoch UT2, i.e. corrects for precession between the two epochs.
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvPrecess, UT1, UT2, pos , $
degrees = degrees , $
from_ecliptic = from_ecliptic , $
to_ecliptic = to_ecliptic , $
rectangular = rectangular
CALLS: ***
CvSky, CvSky_Precess, EulerRotate, InitVar, REVERSE
INPUTS:
UT array[n]; type: time structure
initial epoch
UT array[n]; type: time structure
final epoch
pos[2,n] or pos[3,n]
spherical coordinates at start epoch UT1
RA or longitude, declination or latitude, and, optional
the distance (the distance is not modified)
OPTIONAL INPUT PARAMETERS:
/degrees if set, all angles are in degrees
/from_ecliptic
/to_ecliptic
by default the input and output are assumed to be in
equatorial coordinates (RA and declination).
If /from_ecliptic is set then the input is assumed to be
in ecliptic coordinates (longitude and latitude)
If /to_ecliptic is set then the output is in ecliptic
coordinates
OUTPUTS:
pos[2,n] or pos[3,n]
spherical coordinates at final epoch UT2
RA or longitude, declination or latitude, and, optional
the distance (the distance is not modified)
INCLUDE:
@compile_opt.pro
CALLS: ***
CvSky, CvSky_Precess, EulerRotate, InitVar, REVERSE
CALLED BY:
big_eph, getnagoyasources, getootyasources, getsmeiasources, jpl_eph, jpl_test
mpc_eph, mpc_orbit_eph, sgp4_eph, smei_sky, usno_eph
PROCEDURE:
See R. Green, Spherical Astronomy, Cambridge UP, 1985, Sect. 9.5, p. 217
(1) First transform ecliptic longitude and latitude to equatorial right
ascension and declination (for initial epoch);
(2) Transform equatorial coordinates for initial epoch to epoch J2000.0;
(3) Calculate equatorial coordinates for epoch J2000.0 to final epoch;
(4) Transform back to ecliptic coordinates (for final epoch).
MODIFICATION HISTORY:
DEC-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Adapted from Fortran subroutine PRECESSION_ROT
[Previous]
[Next]
NAME:
CvRotation
PURPOSE:
Convert between several ways of specifying rotations
CATEGORY:
gen/idl/toolbox/math
CALLING SEQUENCE:
R = CvRotation( from_euler=from_euler, /to_quaternion, /degrees)
INPUTS:
OPTIONAL INPUT PARAMETERS:
Only one of the from_* keywords is specified:
from_euler=from_euler
array[3,n]; type: real
triplets of Euler angles
from_quaternion=from_quaternion
array[4,n]; type: real
unit quaternion quatruplets with the scalar in array[3,n]
(MUST be unit quanternion)
from_dcm array[3,3,n]; type: float
direction cosine matrices
from_geometric
array[3,n] or array[4,n]
unit vector, plus angle of rotation around unit vector.
array[3,n]: phase angle, latitude and angle of rotation
array[4,n]: rectangular coordinates and angle of rotation
Only one of the /to_* keywords is specified:
/to_euler if set then the output is an array[3,n] of Euler angles
/to_quaternion
if set then the output is an array[4,n] on unit quaternions
/to_dcm if set then direction cosine matrices array[3,3,n] are returned
/to_geometric
if set then a unit vector in rectangular coordinates and an
angle of rotation around the unit vector, array[4,n]
are returned.
/degrees if set, all angles are in degrees (default: radians)
OUTPUTS:
out array[3,n], array[4,n]; type: same as input
Euler angles, unit quaternion, direction cosine matrix
or unit vector with angle of rotation.
CALLS: ***
AngleRange, CV_COORD, InitVar, IsType, ToRadians, boost
CALLED BY:
CombineRotations, CvSky_Galactic, cvsmei, smei_ccd2sky, smei_frm_where
smei_orient_test, smei_sgp4_quat, smei_sky2cam
SEE ALSO:
EulerRotate
RESTRICTIONS:
The quaternion to Euler angle conversion may still have problems near qx = qy = 0
(rotations around the z-axis) and q0 = qz = 0 (rotations around axis in x-y plane.
The singularities themselves (strictly qx=qy=0 and strictly q0=qz=0) are dealt
with properly.
PROCEDURE:
The Euler angle triplets define rotation around z-axis, y-axis and
z-axis respectively.
A specific rotation can be specified by more then one set of Euler
angles or quaternions. For Euler angles [pi+alfa, -beta, pi+gamma] is the same
rotation as [alfa, beta, gamma]. For quaternions [-qx,-qy,-qz,-q0] is the same
rotation as [qx,qy,qz,q0]. If q = cos(phi/2)+sin(phi/2)*u and
-q = cos(chi/2)+sin(chi/2)*v (for unit vectors u and v), then v=-u and
chi/2=180-phi/2, i.e. chi=360-phi. So -q is a rotation over -phi after changing
the sign of the rotation vector.
The conversion /to_euler always returns a positive beta in [0,180].
MODIFICATION HISTORY:
FEB-2003, Paul Hick (UCSD/CASS)
MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Rewrite. Moved scalar quaternion component from first to last position
Improved calculation of quaternions from DCM or Euler angles
(avoiding singularities for q0 close to zero).
[Previous]
[Next]
NAME:
CvSky
PURPOSE:
Converts between ecliptic, heliographic, equatorial and geographic
coordinates
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky, UT, fromvectors , $
from_ecliptic = from_ecliptic , $
from_centered_ecliptic= from_centered_ecliptic, $
from_equatorial = from_equatorial , $
from_galactic = from_galactic , $
from_heliographic= from_heliographic, $
from_geographic = from_geographic , $
from_gse = from_gse , $
from_gsm = from_gsm , $
from_rtn = from_rtn , $
from_ihg = from_ihg , $
to_ecliptic = to_ecliptic , $
to_centered_ecliptic= to_centered_ecliptic, $
to_equatorial = to_equatorial , $
to_galactic = to_galactic , $
to_heliographic = to_heliographic , $
to_geographic = to_geographic , $
to_rtn = to_rtn , $
to_gse = to_gse , $
to_gsm = to_gsm , $
to_ihg = to_ihg , $
heliocentric = heliocentric , $
bodycentric = bodycentric , $
degrees = degrees , $
rectangular = rectangular , $
euler_angles = euler_angles , $
euler_info = euler_info , $
silent = silent
INPUTS:
UT array; type: standard time structure
times (UT); Note that if /rectangular is set then UT
can only be an array[1]
(i.e. a single time must be specified)
fromvectors array;
OPTIONAL INPUTS:
from_ecliptic = from_ecliptic
from_centered_ecliptic = from_centered_ecliptic
from_heliographic= from_heliographic
from_geographic = from_geographic
from_equatorial = from_equatorial
from_rtn = from_rtn
from_gse = from_gse
from_gsm = from_gsm
from_ihg = from_ihg
array [2,n] or array[3,n]
/rectangular NOT set: In[0,*] is longitude, In[1,*] is latitude;
In[2,*] (optional?) is radial distance
/rectangular set: rectangular (x,y,z) coordinates
Alternatively, fromvectors contains the input vectors and the
appropriate keyword /from* is SET.
/to_ecliptic conversion to ecliptic coordinates
/to_centered_ecliptic
conversion to sun-centered ecliptic coordinates
(/heliocentric NOT set) or earth-centered ecliptic
coordinates (/heliocentric SET)
/to_heliographic conversion to heliographic coordinates
/to_geographic conversion to geographic coordinates
/to_equatorial conversion to equatorial ccordinates
/to_rtn conversion to magnetic RTN coordinates
/to_gse conversion to magnetic GSE coordinates
/to_gsm conversion to magnetic GSM coordinates
/to_ihg conversion to inertial heliographic coordinates
/heliocentric used in conjunction with from_centered_ecliptic and
to_centered_ecliptic keywords: sun-centered if /heliocentric
is NOT set; earth-centered if /heliocentric SET
/degrees input and output angles are in degrees
/rectangular input and output is in rectangular coordinates
silent=silent suppresses information messages
INPUTS/OUTPUTS:
Result array[2,*] or array[3,*]; type: double
output array according to selected /to... keyword
if /rectangular is set then the output array will be
in rectangular (x,y,z) coordinates; otherwise spherical
coordinates (longitude, latitude, and (optional) radial
distance is returned
OPTIONAL OUTPUTS:
euler_angles=euler_angles
array[3,*]; type: double
Euler angles applied to input coordinates.
euler_info=euler_info
scalar; type: string
descriptive string describing the transformation
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
CombineRotations, CvSky_Equatorial, CvSky_GSE, CvSky_GSM, CvSky_Galactic
CvSky_Geographic, CvSky_Heliographic, CvSky_IHG, CvSky_RTN, EulerRotate, InitVar
IsType, REVERSE, SuperArray, big_eph, jpl_body, who_am_i
CALLED BY:
Carrington, CvPrecess, CvSky_GSM, EarthSky3DLoc, EarthTransit3DLoc
InsituTimeSeries, PlotEarthSkymap, PlotPolarSkymap, RemoteView
RemoteView_BodyLoc, RemoteView_FovTilt, RemoteView_Init_View
RemoteView_ZEclipticPlane, RotationMeasure, big_eph, big_orbit, cvsmei, jpl_eph
jpl_test, mpc_eph, mpc_orbit_eph, qRemoteView_ChangeCoordinates
qRemoteView_Pick, smei_frm_where, smei_sky, smei_zld_model, smei_zld_remove
usno_eph, vu_extract, vu_planarcut, vu_point_source, vu_timeseries
vu_vox_drawelatitude, vu_vox_drawelongitude, vu_vox_draworbit, vu_vox_write
PROCEDURE:
For the regular celestial coordinate frames see e.g.
R. Green, Spherical Astronomy, Cambridge UP, 1985, Section 17.7, p. 430.
For magnetic RTN,GSE and GSM coordinate frames, see
???
GSE used for magnetic measurements near Earth
x-axis towards Sun, z-axis towards ecliptic North pole
GSM variation on GSE
x-axis towards Sun, z-axis along projection of Earth's magnetic
dipole in plane perpendicular to x-axis. The y-z plane is the
same for GSE and GSM.
RTN used for magnetic field measurements in a heliographic reference
frame. x-axis (R-axis) points radially away from the Sun
The y-axis (T-axis) is the cross product of solar north (solar
rotations axis) and R-axis. The z-axis (N-axis) is the cross product
of R and T-axis.
For an observer in the solar equator the N-axis points toward solar North.
For an observer at Earth x(RTN) = - x(GSE) = -x(GSM), and
three magnetic coordinate frames share the same y-z plane)
IHG used for outer-heliospheric studies. z-axis is toward solar North.
x-axis is towards ascending node of solar equator on ecliptic.
MODIFICATION HISTORY:
MAR-1997, Paul Hick (UCSD/CASS)
adapted from FORTRAN version
MAR-1998, Paul Hick (UCSD/CASS)
now accepts multi-dim arrays
JAN-2001, Paul Hick (UCSD/CASS)
added /rectangular keyword
SEP-2001, Tamsen Dunn, Paul Hick (UCSD/CASS)
added transformations from/to magnetic frames RTN, GSE and GSM
SEP-2006, Paul Hick (UCSD/CASS)
Added fromvectors argument
Added from_centered_ecliptic and to_centered_ecliptic keywords
Added euler_angles and euler_info keywords
Added silent keyword
Added underscores to to* and from* keywords
OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Now accumulates all Euler angles and calls EulerRotate only once
to perform the coordinate transformation.
JUN-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /to_ihg and from_ihg=from_ihg keywords.
[Previous]
[Next]
NAME:
CvSky_Equatorial
PURPOSE:
Euler angles for Ecliptic --> Equatorial conversion
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
abc = CvSky_Equatorial(UT [, /degrees)
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set, all angles are in degrees (default: radians)
OUTPUTS:
abc array[3,n]; type: double
Euler angles for converting from
ecliptic to equatorial coordinates
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
SubArray, SuperArray, TimeGet, ToDegrees
CALLED BY:
CvSky, CvSky_Galactic
PROCEDURE:
Angle ecliptic-equator as in:
Spherical Astronomy, R.M. Green, Cambridge UP, p. 220, eq 9.25
MODIFICATION HISTORY:
AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
CvSky_Galactic
PURPOSE:
Euler angles for Ecliptic --> Galactic conversion
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky_Galactic, UT, degrees=Degrees
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set, all angles are in degrees (default: radians)
OUTPUTS:
abc array[3,n]; Euler angles for converting from
ecliptic to heliographic coordinates
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
CombineRotations, CvRotation, CvSky_Equatorial, CvSky_Precess, REVERSE, TimeSet
CALLED BY:
CvSky
PROCEDURE:
Angle ecliptic-equator as in:
Spherical Astronomy, R.M. Green, Cambridge UP, p. 41, eq 2.31
MODIFICATION HISTORY:
SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
CvSky_Geographic
PURPOSE:
Euler angles for Ecliptic to Geographic conversion
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky_Geographic, UT, degrees=Degrees
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set all angles are in degrees (default: radians)
OUTPUTS:
abc array[3,n]; type: float
Euler angles
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
SubArray, SuperArray, TimeGet, ToDegrees
CALLED BY:
CvSky
PROCEDURE:
MODIFICATION HISTORY:
AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
CvSky_GSE
PURPOSE:
Euler angles for Ecliptic to GSE conversion
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky_GSE, UT, degrees=degrees
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set all angles are in degrees (default: radians)
OUTPUTS:
Result array[3,n]; type: float
Euler angles
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
SubArray, big_eph, jpl_body
CALLED BY:
CvSky
PROCEDURE:
Geocentric Solar Ecliptic (GSE) coordinates:
x-axis points from Earth to Sun
y-axis is in the ecliptic plane opposing orbital motion
z-axis points to ecliptic north
MODIFICATION HISTORY:
AUG-2002, Paul Hick (UCSD/CASS)
OCT-2006, Pual Hick (UCSD/CASS; pphick@ucsd.edu)
Replaced NewcombSun by big_eph
[Previous]
[Next]
NAME:
CvSky_GSEQ
PURPOSE:
Euler angles for Ecliptic to GSEQ conversion
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky_GSEQ, UT, degrees=degrees
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set all angles are in degrees (default: radians)
OUTPUTS:
Result array[3,n]; type: float
Euler angles
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
SubArray, SuperArray, big_eph, jpl_body
PROCEDURE:
Geocentric Solar Equatorial (GSEQ) coordinates:
x-axis points from Earth to Sun
y-axis is parallel to Sun's equatorial plane pointing
east of the Sun
z-axis is pointing north and completes righthanded
coordinate frame
The Sun's rotation axis lies in the x-z plane.
MODIFICATION HISTORY:
OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
CvSky_GSM
PURPOSE:
Euler angles for Ecliptic to GSM conversion
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky_GSM, UT, degrees=degrees
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set all angles are in degrees (default: radians)
OUTPUTS:
Result array[3,n]; type: float
Euler angles
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
CvSky, SubArray, SuperArray, TimeGet, ToDegrees, ToRadians, big_eph, jpl_body
CALLED BY:
CvSky
PROCEDURE:
Geocentric Solar Magnetospheric (GSM) coordinates
x-axis points from Earth to Sun
z-axis is the northern magnetic pole.
The difference between the GSM system and the GSE
and GSEQ is a rotation about the X-axis.
MODIFICATION HISTORY:
AUG-2002, Paul Hick (UCSD/CASS)
JUN-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Bugfix. The conversion of UT to years since 2000 somehow
lost the subtraction of 2000.
[Previous]
[Next]
NAME:
CvSky_Heliographic
PURPOSE:
Euler angles for Ecliptic to Heliographic conversion
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky_Heliographic, UT, degrees=degrees
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set all angles are in degrees (default: radians)
OUTPUTS:
abc array[3,n]; type: float
Euler angles
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
SubArray, SuperArray, TimeGet, TimeUnit, ToDegrees
CALLED BY:
CvSky, vu_solardisk
SEE ALSO:
CvSky_IHG
PROCEDURE:
The ecliptic longitude for the ascending node and the
inclination of equator to ecliptic are from
R. Green, "Spherical astronomy", p. 431
MODIFICATION HISTORY:
AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
CvSky_IHG
PURPOSE:
Euler angles for Ecliptic to IHG conversion
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky_IHG, UT, degrees=degrees
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set all angles are in degrees (default: radians)
OUTPUTS:
abc array[3,n]; type: float
Euler angles
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
SubArray, SuperArray, TimeGet, TimeUnit, ToDegrees
CALLED BY:
CvSky
SEE ALSO:
CvSky_Heliographic
PROCEDURE:
The IHG z-axis is along the solar rotation axis (solar north).
The x-axis is toward the ascending node of the solar equator
on the ecliptic. See
http://nssdcftp.gsfc.nasa.gov/miscellaneous/documents/b46547.txt
and Burlaga, "MHD Processes in the Outer Heliosphere",
Space Sci. Rev. 39, 255-316, 1984.
Note that the nssdc website says:
"The X(IHG) axis drifts slowly with time, approximately one
degree per 72 years", while the Burlaga paper says (p. 260)
".. we shall take the X(IHG) axis along the direction of the
ascending node in 1900". I.e. the Burlaga paper seems to want
the X(IHG) axis fixed at epoch 1900.
Here we follow the description of the website.
The ecliptic longitude for the ascending node and the
inclination of equator to ecliptic are from
R. Green, "Spherical astronomy", p. 431
MODIFICATION HISTORY:
JUN-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
CvSky_Precess
PURPOSE:
Euler angles for precesion of equatorial coordinates from epoch UT to J2000
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
abc = CvSky_Precess(UT [, /degrees)
INPUTS:
UT array[n]; type: time structure
OPTIONAL INPUT PARAMETERS:
/degrees if set, all angles are in degrees (default: radians)
OUTPUTS:
abc array[3,n]; Euler angles for precession from epoch UT to J2000
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
SubArray, SuperArray, TimeGet, ToDegrees
CALLED BY:
CvPrecess, CvSky_Galactic
PROCEDURE:
Precession angles from:
Spherical Astronomy, R.M. Green, Cambridge UP, p. 219, eq 9.23
MODIFICATION HISTORY:
DEC-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
CvSky_RTN
PURPOSE:
Euler angles for Heliographic to RTN conversion at Earth
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION CvSky_RTN, UT_or_LOC, degrees=degrees
INPUTS:
UT_or_LOC array[3,n]; type: float
heliocentric locations in heliographic
coordinates (heliographic longitude, latitude and
distance)
array[n]; type: time structure
UT times; in this case the heliocentric locations
is assumed to be at Earth at the specified times
OPTIONAL INPUT PARAMETERS:
/degrees if set all angles are in degrees (default: radians)
OUTPUTS:
Result array[3,n]; type: float
Euler angles to rotate from heliographic
coordinates to RTN coordinates
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
IsTime, SubArray, big_eph, jpl_body
CALLED BY:
CvSky, RotationMeasure
PROCEDURE:
RTN (Radial, Tangential, Normal) coordinates at point P:
x-axis = radial direction
y-axis = in tangent plane, parallel to solar equator
z-axis = in tangent plane, pointing toward the solar north pole
MODIFICATION HISTORY:
AUG-2002, Paul Hick (UCSD/CASS)
OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added option to directly enter heliocentric locations
in addition to always using Earth's location.
[Previous]
[Next]
NAME:
cvsmei
PURPOSE:
Convert positions between various SMEI-related coordinate frames
CATEGORY:
camera/idl/toolbox
CALLING SEQUENCE:
FUNCTION cvsmei, $
camera = camera , $
quaternion = quaternion , $
mode = mode , $
from_mode = from_mode , $
to_mode = to_mode , $
from_ccd = from_ccd , $
from_camera = from_camera, $
from_equatorial = from_equatorial , $
from_helioecliptic = from_helioecliptic, $
from_map = from_map , $
time = time , $
rectangular = rectangular, $
degrees = degrees , $
force_unit = force_unit , $
to_ccd = to_ccd , $
to_camera = to_camera , $
to_equatorial = to_equatorial, $
to_helioecliptic = to_helioecliptic, $
to_map = to_map , $
inside = inside , $
boolean = boolean , $
ndim = ndim , $
silent = silent , $
count = count
INPUTS:
OPTIONAL INPUT PARAMETERS:
from_map array[2,n]; type: numerical
scalar; type: string
If set to string 'MAP' then the position of all
pixels in the skymap for the specified mode are used.
Pixel locations in a skymap, specified as a zero-base
array index (i.e. lower-left pixel is [0,0].
The mode is "lores" (low-resolution skymap),
"eqmap" (high-resolution equatorial map),
"npmap" (hi-res map of north pole) or "spmap"
(hi-res map of south pole). This is set using
keywords "mode" or "from_mode"
from_equatorial array[2,n] or array[3,n]
positions in the sky as spherical or rectangular
equatorial coordinates.
/rect NOT SET: spherical coordinates
rvec[0,*] is RA;
rvec[1,*] is declination
rvec[3,*] (usually the distance)
/rect SET: rectangular coordinates
rvec[0,*] is x-coordinate (toward vernal equinox)
rvec[1,*] is y-coordinate
rvec[3,*] is z-coordinate (toward equatorial north)
from_helioecliptic
array[2,n] or array[3,n]
positions in the sky as spherical or rectangular
helioecliptic coordinates
/rect NOT SET: spherical coordinates
rvec[0,*] is sun-centered ecliptic longitude;
rvec[1,*] is ecliptic longitude
rvec[3,*] (usually the distance)
/rect SET: rectangular coordinates
rvec[0,*] is x-coordinate (toward sun)
rvec[1,*] is y-coordinate
rvec[3,*] is z-coordinate (toward ecliptic north)
from_camera array[3,n]
positions in the sky as unit vectors in the
UCSD camera frame.
from_ccd array[2,n]; type: double
scalar; type: string
If set to string 'CCD' then the position of all
pixels in the image for the specified mode are used.
pixel locations on the CCD, specified as a zero-based
array index (i.e. lower-left pixel is [0,0])
The unit is the pixel size for mode 0.
Override this by explicitly setting the 'mode' keyword
(so set mode=0 for engineering mode pixels).
/to_map returns array[2,n]; type: double
output is in pixel coodinates in a sky map
selected with the "mode" of "to_mode" keywords
/to_equatorial returns array[3,n] or array[2,n]; type: double
output is in equatorial sky coordinates (rectangular
array[3,n ] if /rectangular is SET.
array[2,n] (RA and dec) if /rectangular NOT set.
/to_helioecliptic
returns array[3,n] or array[2,n]; type: double
output is in helioecliptic sky coordinates (rectangular
array[3,n ] if /rectangular is SET.
array[2,n] (sun-centered ecliptic longitude and latitude
if /rectangular NOT set.
/to_camera returns array[3,n]; type: double
output is a unitvector in the UCSD camera frame
(with z-axis along camera optical axis)
/to_ccd returns array[2,n]; type: double
output is in pixel coordinates on the CCD
The units are mode-dependent.
/rectangular only used if 'from_equatorial' or /to_equatorial is set
if set then 'from_equatorial' is in rectangular
coordinates. The 1st dimension MUST be 3; if it is
not program execution halts.
If /to_equatorial is set then the output is in
rectangular coordinates.
/degrees only used if 'from_equatorial' or /to_equatorial is set
if set, all angles are in degrees (default: radians).
/force_unit only used if 'from_equatorial' or 'from_camera' are set
forces conversion of vectors to unit vectors
For 'from_equatorial' vectors converted to camera
coordinates must be unit vectors. By default only
vectors deviating from unit vectors by more than the
machine precision are explicitly scaled to unit vectors.
camera=camera scalar; type: integer; default: 1
camera number (1,2 or 3)
This determines the fixed S/C-to-camera quaternion for
conversions between camera and equatorial frames;
and CCD-related parameters (fov size, etc.) for
conversions between camera and ccd coordinates
quaternion=quaternion
array[4]; type: double
Coriolis S/C quaternion
Only needed for conversions between camera frame
and equatorial frame.
from_mode=from_mode
to_mode=to_mode
mode=mode scalar; type: integer or string; default: 0
If /to_ccd and/or /from_ccd are set:
mode number (0,1 or 2)
The 'from_mode' and 'to_mode' keyword are necessary only
when both 'from_ccd' and /to_ccd are used (i.e. when
converting CCD coordinates between different modes.
'from_mode' takes priority over 'mode' if from_ccd is set.
'to_mode' takes priority over 'mode' if /to_ccd is set.
If /to_map and/or /from_map are set:
mode string: "lores", "eqmap", "npmap" or "spmap".
The 'from_mode' and 'to_mode' keyword are necessary only
when both 'from_map' and /to_map are used (i.e. when
converting between different types of skymap.
/boolean only used for conversions between camera frame and
CCD coordinates.
if set then the output array 'inside' is a byte array of zeros
and ones indicating whether the corresponding vectory is
outside/inside the field of view (instead of a list of
indices from the IDL 'where' function identifying vectors
inside the field of view).
OUTPUTS:
R array[3,n]; type: float
output locations as specified by /to_equatorial, /to_camera
or /to_ccd keyword.
OPTIONAL OUTPUT PARAMETER:
inside=inside array[n]; type: long (/boolean NOT set) or byte (/boolean set).
Will only exist for conversion between CCD and sky coordinates
(either camera or equatorial)..
If /boolean is not set then 'inside' is a list of indices of
vectors inside field of view
If /boolean is set then 'inside' is a byte array with 0 for
vectors inside or 1 for vectors inside the field of view.
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
qImage_cw_DrawEphem, qImage_cw_Where, smei_findpnt, smei_frm_cvhdr
smei_frm_where, smei_sky_cleanedge_fix, smei_sky_cleanedge_sample
smei_sky_read, smei_sky_track, smei_star_fit, smei_star_remove, smei_zld_remove
stardistance
COMMON BLOCKS:
common cvsmei_save, map_modes, str_modes, cxy_modes, dpb_modes, dim_modes, $
from_maptype_save, to_maptype_save
CALLS: ***
AngleRange, BadValue, CV_COORD, CvRotation, CvSky, InitVar, Inside_Wedge, IsTime, IsType
SubArray, SyncDims, ToDegrees, ToRadians, boost, cvsmei_init, flt_string, gridgen
smei_cam_quaternion, smei_camera, smei_radial2theta, smei_theta2radial, who_am_i
PROCEDURE:
There are four groups of coordinate systems involved:
- CCD coordinates (for three different modes)
- The native camera coordinate frame
- The J2000 equatorial coordinate frame
- Skymap coordinates (for lores maps, and three different
hires maps: equator, north and south pole)
Conversions are done as follows:
CCD <---> Camera <---> J2000 Equatorial <---> Skymaps
Phase 1:
if CCD if /to_ccd then convert to CCD (m0)
if not /to_ccd then convert to Camera
if Camera do nothing
if J2000 do nothing
if Skymaps convert to J2000
After phase 1 we have Camera or J2000 coordinates
unless /to_ccd was set (then we have CCD m0 coordinates)
Phase 2:
if Camera if /to_map then convert to J2000
if J2000 if /to_ccd then convert to Camera
We now have coordinates that are at most one
conversion from the final frame.
Phase 3:
if /to_ccd convert from CCD (m0) or Camera
if /to_camera already in Camera or convert from J2000
if /to_equatorial already in J2000 or convert from Camera
if /to_map convert from J2000
Conversions between camera coordinates and equatorial
coordinates require a Coriolis quaternion and a camera
quaternion. This is provided by explicitly specifying a
camera number and Coriolis quaternion through keywords
'camera' and 'quaternion'
MODIFICATION HISTORY:
MAR-2005, Paul Hick (UCSD/CASS)
Extracted from smei_sky2ccd.
MAR-2008, Paul Hick (UCSD/CASS)
Bug fix in conversion from hires equat map to polar
maps. Force output for RA into [0,360]
APR-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Fairly substantial rewrite to incorporate conversions
from and to helioecliptic maps.
[Previous]
[Next]
NAME:
cvsmei_init
PURPOSE:
Set scaling parameters for cvsmei
CATEGORY:
camera/idl/toolbox
CALLING SEQUENCE:
PRO cvsmei_init , $
mode = mode , $
str = str , $
cxy = cxy , $
mpb = mpb , $
dim = dim , $
degrees = degrees , $
from_maptype = from_maptype , $
to_maptype = to_maptype , $
reset = reset , $
silent = silent , $
get = get
INPUTS:
OPTIONAL INPUT PARAMETERS:
mode = mode scalar; type: string
map type: one of 'lores','eqmap','npmap','spmap','eqfull'
str = str scalar; type: string
cxy = cxy array[2]; type: any
mpb = mpb scalar; type: double
dim = dim array[2]; type: integer
/degrees if set, angular units are degrees (default: radians)
/get if set, retrieve settings
/reset if set, reset everything for standard full-sky maps
/silent suppress informational messages
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, ToDegrees, destroyvar
CALLED BY:
cvsmei, smei_zld_remove
COMMON BLOCKS:
common cvsmei_save, map_modes, str_modes, cxy_modes, dpb_modes, dim_modes, $
from_maptype_save, to_maptype_save
PROCEDURE:
Common block updates
MODIFICATION HISTORY:
FEB-2006, Paul Hick (UCSD/CASS)
APR-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added mode 'eclsun'
[Previous]
[Next]
NAME:
CvT3d
PURPOSE:
Implement three-dimensional transformation of coordinate systems.
!!! t3d provides a transformation matrix for transforming vectors in a
fixed coordinate frame. This routine provides a matrix for
transforming the coordinate frame, while keeping the vectors constant.
Accumulates one or more sequences of translation,
scaling, rotation, (perspective, and oblique) transformations
and returns the resulting 4x4 transformation matrix.
CATEGORY:
Number strangling
CALLING SEQUENCE:
pt = CvT3D(translate=T, scale=S, rotate=R, /degrees)
OPTIONAL INPUTS:
/degrees if set, all angles are assumed to be in degrees (default: radians)
matrix=Matrix float array[4,4]
Used as starting transformation matrix
if absent the identity matrix is used as starting point.
vector=Vector float array[3,*]
x,y,z coordinates in original coordinate frame.
If present, the transformation matrix is applied and the
result is returned, instead of the matrix itself.
All inputs to T3D are in the form of keywords. Any, all, or none of
the following keywords can be present in a call to T3D.
The transformation specified by each keyword is performed in the
order of their descriptions below (e.g., if both TRANSLATE and
SCALE are specified, the translation is done first):
Translate 3-element vector of the translations in the X, Y, and Z directions.
Scale 3-element vector of scale factors for the X, Y, and Z axes.
Rotate n-element vector of the rotations, about the X, Y, and Z axes.
The elements in Rotate are interpreted in sets of 3 for rotations
around X, Y, and Z axes.
XYexch exchange the X and Y axes.
XZexch exchange the X and Z axes.
YZexch exchange the Y and Z axes.
Not implemented
PERSPECTIVE Perspective transformation. This parameter is a scalar (p)
that indicates the Z distance of the center of the projection.
Objects are projected into the XY plane at Z=0, and the "eye"
is at point [0,0,p].
OBLIQUE: A two-element vector of oblique projection parameters.
Points are projected onto the XY plane at Z=0 as follows:
x' = x + z(d COS(a)), and y' = y + z(d SIN(a)).
where OBLIQUE[0] = d, and OBLIQUE[1] = a.
OUTPUTS:
If keyword vector is not specified, then the 4x4 transformation matrix is returned.
If keyword vertor is specified, then the transformation matrix is applied and
the result is returned as a float array[3,*]
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
ToRadians
CALLED BY:
EulerRotate, PlotSolarDisk, RemoteView_FOV_Cube, RemoteView_FOV_loc, qvu_draw
vu_solardisk
RESTRICTIONS:
This routine implements general rotations about the three axes.
PROCEDURE:
> See also IDL procedure t3d.pro
> If a set of vectors is given in the form x[3,*] (containing
x,y,z-coordinates in the original coordinate frame), then
T3DMatrix(..)#x is an array[3,*] with coordinates in the new
coordinate frame.
> Using the /xyexch, /yzexch or /zxexch keywords turns a
right-handed coordinate frame into a left-handed frame. This impacts
the interpretation of the rotation angles (positive rotations are
counter-clockwise in a right-handed coordinate frame), and is better
avoided. These exchange keywords are only useful as final
transformations to swap the corresponding vector coordinates.
MODIFICATION HISTORY:
DMS, Nov, 1987.
DMS, June 1990. Fixed bug that didn't scale or translate
matrices with perspective properly.
DMS, July, 1996. Added MATRIX keyword.
FEB-1998, Paul Hick (UCSD/CASS, pphick@ucsd.edu); based on T3D.pro
[Previous]
[Next]
NAME:
CW_FIELD
PURPOSE:
This widget cluster function manages a data entry field widget.
The field consists of a label and a text widget. CW_FIELD's can
be string fields, integer fields or floating-point fields. The
default is an editable string field.
CATEGORY:
Widget Clusters.
CALLING SEQUENCE:
Result = CW_FIELD(Parent)
INPUTS:
Parent: The widget ID of the widget to be the field's parent.
KEYWORD PARAMETERS:
TITLE: A string containing the text to be used as the label for the
field. The default is "Input Field:".
VALUE: The initial value in the text widget. This value is
automatically converted to the type set by the STRING,
INTEGER, and FLOATING keywords described below.
UVALUE: A user value to assign to the field cluster. This value
can be of any type.
UNAME: A user supplied string name to be stored in the
widget's user name field.
FRAME: The width, in pixels, of a frame to be drawn around the
entire field cluster. The default is no frame.
RETURN_EVENTS: Set this keyword to make cluster return an event when a
<CR> is pressed in a text field. The default is
not to return events. Note that the value of the text field
is always returned when the WIDGET_CONTROL, field, GET_VALUE=X
command is used.
ALL_EVENTS: Like RETURN_EVENTS but return an event whenever the
contents of a text field have changed.
COLUMN: Set this keyword to center the label above the text field.
The default is to position the label to the left of the text
field.
ROW: Set this keyword to position the label to the left of the text
field. This is the default.
XSIZE: An explicit horizontal size (in characters) for the text input
area. The default is to let the window manager size the
widget. Using the XSIZE keyword is not recommended.
YSIZE: An explicit vertical size (in lines) for the text input
area. The default is 1.
STRING: Set this keyword to have the field accept only string values.
Numbers entered in the field are converted to their string
equivalents. This is the default.
FLOATING: Set this keyword to have the field accept only floating-point
values. Any number or string entered is converted to its
floating-point equivalent.
INTEGER: Set this keyword to have the field accept only integer values.
Any number or string entered is converted to its integer
equivalent (using FIX). For example, if 12.5 is entered in
this type of field, it is converted to 12.
LONG: Set this keyword to have the field accept only long integer
values. Any number or string entered is converted to its
long integer equivalent (using LONG).
FONT: A string containing the name of the X Windows font to use
for the TITLE of the field.
FIELDFONT: A string containing the name of the X Windows font to use
for the TEXT part of the field.
NOEDIT: Normally, the value in the text field can be edited. Set this
keyword to make the field non-editable.
OUTPUTS:
This function returns the widget ID of the newly-created cluster.
CALLS: ***
CW_FIELD_EVENT, CW_FIELD_EXPONENT, CW_FIELD_FLOAT, CW_FIELD_GET, CW_FIELD_INT
CW_FIELD_SET, CW_FIELD_VALIDATE, CW_FIELD_VALUE
CALLED BY:
makemovie, qBar, qEphem, qGlitch, qImage, qImage_cw, qImage_cw_SMEI, qLine, qLine_XBase
qLine_YBase, qRemoteView, qSave2File, qShow, qTool, qView, qnagoya, qset_page
qslider_cw, qsmei_sky, qvox, qvu
COMMON BLOCKS:
None.
PROCEDURE:
Create the widgets, set up the appropriate event handlers, and return
the widget ID of the newly-created cluster.
EXAMPLE:
The code below creates a main base with a field cluster attached
to it. The cluster accepts string input, has the title "Name:", and
has a frame around it:
base = WIDGET_BASE()
field = CW_FIELD(base, TITLE="Name:", /FRAME)
WIDGET_CONTROL, base, /REALIZE
MODIFICATION HISTORY:
Written by: Keith R. Crosley June 1992
KRC, January 1993 -- Added support for LONG
integers.
AB, 7 April 1993, Removed state caching.
JWG, August 1993, Completely rewritten to make
use of improved TEXT widget functionality
ACY, 25 March, 1994, fix usage of FRAME keyword
KDB, May 1994, Initial value =0 would result
in a null text field. Fixed
keyword check.
CT, RSI, March 2001: Pass keywords directly into WIDGET_BASE,
without assigning default values, since the defaults are
handled by WIDGET_BASE. Avoids assigning defaults if user passes
in undefined variables.
CT, RSI, July 2001: Fix bug in previous mod. If user passes in a
numeric VALUE but forgets to set the /FLOAT, we still need
to convert to a string before passing onto WIDGET_TEXT.