| Geometric Event Finding Hands-On Lesson, using MPO (FORTRAN) |
Table of ContentsGeometric Event Finding Hands-On Lesson, using MPO (FORTRAN) Overview Note About HTML Links References Tutorials Required Readings The Permuted Index API Documentation Kernels Used SPICE Modules Used Find View Periods Task Statement Learning Goals Approach Solution steps Solution Solution Meta-Kernel Solution Code Solution Sample Output Find Times when Target is Visible Task Statement Learning Goals Approach Solution steps Solution Solution Meta-Kernel Solution Code Solution Sample Output Extra Credit Task statements Solutions Geometric Event Finding Hands-On Lesson, using MPO (FORTRAN)
Overview
In this lesson the student is asked to construct a program that finds the time intervals, within a specified time range, when the BepiColombo Mercury Planetary Orbiter (MPO) is visible from ESA's deep space station in New Norcia. Possible occultation of the spacecraft by Mercury is to be considered. Note About HTML Links
In order for the links to be resolved, if not done already by installing the lessons package under the Toolkit's ``doc/html'' directory, create a subdirectory called ``lessons'' under the ``doc/html'' directory of the ``toolkit/'' tree and copy this document to that subdirectory before loading it into a Web browser. References
Of these documents, the ``Tutorials'' contains the highest level descriptions with the least number of details while the ``Required Reading'' documents contain much more detailed specifications. The most complete specifications are provided in the ``API Documentation''. In some cases the lesson explanations also refer to the information provided in the meta-data area of the kernels used in the lesson examples. It is especially true in case of the FK and IK files, which often contain comprehensive descriptions of the frames, instrument FOVs, etc. Since both FK and IK are text kernels, the information provided in them can be viewed using any text editor, while the meta information provided in binary kernels -- SPKs and CKs -- can be viewed using ``commnt'' or ``spacit'' utility programs located in ``toolkit/exe'' of Toolkit installation tree. Tutorials
Name Lesson steps/routines it describes ---------------- ----------------------------------------------- Time Time Conversion SCLK and LSK Time Conversion SPK Obtaining Ephemeris Data Frames Reference Frames Using Frames Reference Frames PCK Planetary Constants Data Lunar-Earth PCK Lunar and Earth Orientation Data GF The SPICE Geometry Finder (GF) subsystem DSK Detailed Target Shape (Topography) DataThese tutorials are available from the NAIF server at JPL:
https://naif.jpl.nasa.gov/naif/tutorials.html Required Readings
Name Lesson steps/routines that it describes --------------- ----------------------------------------- cells.req Cell/window initialization frames.req Using reference frames gf.req The SPICE geometry finder (GF) subsystem kernel.req Loading SPICE kernels naif_ids.req Body and reference frame names pck.req Obtaining planetary constants data spk.req Computing positions and velocities time.req UTC to ET time conversion windows.req The SPICE window data type The Permuted Index
This text document provides a simple mechanism by which users can discover which SPICE routines perform functions of interest, as well as the names of the source files that contain these routines. This is particularly useful for FORTRAN programmers because some of the routines are entry points; the names of these routines do not translate directly into the name of the respective source files that contain them. API Documentation
For example the path of the source code of the STR2ET routine is
toolkit/src/spicelib/str2et.forSince some of the FORTRAN routines are entry points they may be part of a source file that has different name. The ``Permuted Index'' document mentioned above can be used to locate the name of their source file. Kernels Used
1. Solar System Ephemeris SPK, subsetted to cover only the time
range of interest:
de432s.bsp
2. ESA stations SPK:
estrack_v04.bsp
3. ESA stations frame definitions:
estrack_v04.tf
4. EARTH_FIXED/ITRF93 frame connection:
earthfixeditrf93.tf
5. Binary PCK for Earth:
earth_070425_370426_predict.bpc
6. BepiColombo MPO Spacecraft Trajectory SPK, subsetted to cover
only the time range of interest:
bc_mpo_mlt_50037_20260314_20280529_v05.bsp
7. Generic LSK:
naif0012.tls
8. Generic PCK:
pck00011.tpc
9. Low-resolution Mercury DSK:
mercury_lowres.bds
These SPICE kernels are included in the lesson package.
SPICE Modules Used
CHAPTER EXERCISE ROUTINES FUNCTIONS KERNELS
------- --------- --------- --------- ----------
1 viewpr FURNSH RPD 1-8
TOSTDO WNCARD
REPMC
REPMF
STR2ET
TIMOUT
SSIZED
WNINSD
GFPOSC
WNFETD
2 visibl FURNSH RPD 1-9
TOSTDO WNCARD
REPMC
REPMF
STR2ET
TIMOUT
SSIZED
WNINSD
GFPOSC
GFOCLT
WNDIFD
WNFETD
extra (*) GFDIST 1,6-8
KCLEAR
(*) Additional APIs and kernels used in Extra Credit tasks.
Refer to the headers of the various routines listed above, as detailed
interface specifications are provided with the source code.
Find View PeriodsTask Statement
2027 JAN 03 TDB 2027 JAN 06 TDBwhen the BepiColombo Mercury Planetary Orbiter (MPO) is visible from ESA's New Norcia station. These time intervals are frequently called ``view periods.'' The spacecraft is considered visible if its apparent position (that is, its position corrected for light time and stellar aberration) has elevation of at least 6 degrees in the topocentric reference frame NEW_NORCIA_TOPO. In this exercise, we ignore the possibility of occultation of the spacecraft by Mercury. Use a search step size that ensures that no view periods of duration 5 minutes or longer will be missed by the search. Display the start and stop times of these intervals using TDB calendar dates and millisecond precision. Learning Goals
ApproachSolution steps
Preparation:
SolutionSolution Meta-Kernel
KPL/MK
This is the meta-kernel used in the solution of the tasks in the
Geometric Event Finding Hands On Lesson.
The names and contents of the kernels referenced by this
meta-kernel are as follows:
1. Solar System Ephemeris SPK, subsetted to cover only the
time range of interest:
de432s.bsp
2. ESA stations SPK:
estrack_v04.bsp
3. ESA stations frame definitions:
estrack_v04.tf
4. EARTH_FIXED/ITRF93 frame connection:
earthfixeditrf93.tf
5. Binary PCK for Earth:
earth_070425_370426_predict.bpc
6. BepiColombo MPO Spacecraft Trajectory SPK, subsetted to
cover only the time range of interest:
bc_mpo_mlt_50037_20260314_20280529_v05.bsp
7. Generic LSK:
naif0012.tls
8. Generic PCK:
pck00011.tpc
\begindata
KERNELS_TO_LOAD = (
'kernels/spk/de432s.bsp'
'kernels/spk/estrack_v04.bsp'
'kernels/fk/estrack_v04.tf'
'kernels/fk/earthfixeditrf93.tf'
'kernels/pck/earth_070425_370426_predict.bpc'
'kernels/lsk/naif0012.tls'
'kernels/spk/bc_mpo_mlt_50037_20260314_20280529_v05.bsp'
'kernels/pck/pck00011.tpc'
)
\begintext
Solution Code
PROGRAM VIEWPR
IMPLICIT NONE
C
C Find and display the window of times when the BepiColombo
C MPO spacecraft is above a specified elevation limit in the
C topocentric reference frame of ESA's New Norcia station.
C
C
C SPICELIB functions
C
DOUBLE PRECISION RPD
INTEGER WNCARD
C
C Global GF parameters: we import from this file
C the definition of the GF workspace size parameter
C
C NWMAX
C
INCLUDE 'gf.inc'
C
C Local parameters
C
C Format string for time output:
C
CHARACTER*(*) TDBFMT
PARAMETER ( TDBFMT =
. 'YYYY MON DD HR:MN:SC.### (TDB) ::TDB' )
C
C The meta-kernel:
C
CHARACTER*(*) METAKR
PARAMETER ( METAKR = 'viewpr.tm' )
C
C Maximum number of intervals in any window:
C
INTEGER MAXIVL
PARAMETER ( MAXIVL = 1000 )
C
C Maximum result window size:
C
INTEGER MAXWIN
PARAMETER ( MAXWIN = 2 * MAXIVL )
C
C SPICELIB cell bound:
C
INTEGER LBCELL
PARAMETER ( LBCELL = -5 )
C
C String length parameters:
C
INTEGER CORLEN
PARAMETER ( CORLEN = 10 )
INTEGER FRNMLN
PARAMETER ( FRNMLN = 32 )
INTEGER LNSIZE
PARAMETER ( LNSIZE = 200 )
INTEGER NAMLEN
PARAMETER ( NAMLEN = 32 )
INTEGER OPLEN
PARAMETER ( OPLEN = 50 )
INTEGER TIMLEN
PARAMETER ( TIMLEN = 50 )
C
C Local variables
C
CHARACTER*(CORLEN) ABCORR
CHARACTER*(NAMLEN) CRDSYS
CHARACTER*(NAMLEN) COORD
CHARACTER*(LNSIZE) LINE
CHARACTER*(FRNMLN) OBSFRM
CHARACTER*(OPLEN) RELATE
CHARACTER*(NAMLEN) SRFPT
CHARACTER*(TIMLEN) START
CHARACTER*(TIMLEN) STOP
CHARACTER*(NAMLEN) TARGET
CHARACTER*(TIMLEN) TIMSTR
CHARACTER*(LNSIZE) TITLE
DOUBLE PRECISION ADJUST
C
C Confinement window used to store interval to be searched:
C
DOUBLE PRECISION CNFINE ( LBCELL : MAXWIN )
DOUBLE PRECISION ELVLIM
DOUBLE PRECISION ETBEG
DOUBLE PRECISION ETEND
DOUBLE PRECISION INTBEG
DOUBLE PRECISION INTEND
DOUBLE PRECISION REVLIM
C
C STEPSZ is the step size, measured in seconds, used to search
C for times bracketing a state transition.
C
DOUBLE PRECISION STEPSZ
C
C Result window used to store rise/set times:
C
DOUBLE PRECISION RISWIN ( LBCELL : MAXWIN )
C
C Workspace array:
C
DOUBLE PRECISION WORK ( LBCELL : MAXWIN, NWMAX )
INTEGER I
INTEGER WINSIZ
C
C Load the meta-kernel.
C
CALL FURNSH ( METAKR )
C
C Assign the inputs for our search.
C
C Since we're interested in the apparent location of the
C target, we use light time and stellar aberration
C corrections. We use the "converged Newtonian" form
C of the light time correction because this choice may
C increase the accuracy of the occultation times we'll
C compute using GFOCLT.
C
SRFPT = 'NEW_NORCIA'
OBSFRM = 'NEW_NORCIA_TOPO'
TARGET = 'MPO'
ABCORR = 'CN+S'
START = '2027 JAN 03 TDB'
STOP = '2027 JAN 06 TDB'
ELVLIM = 6.0D0
C
C The elevation limit above has units of degrees; we convert
C this value to radians for computation using SPICE routines.
C We'll store the equivalent value in radians in REVLIM.
C
REVLIM = RPD() * ELVLIM
C
C Since SPICE doesn't directly support the AZ/EL coordinate
C system, we use the equivalent constraint
C
C latitude > REVLIM
C
C in the latitudinal coordinate system, where the reference
C frame is topocentric and is centered at the viewing location.
C
CRDSYS = 'LATITUDINAL'
COORD = 'LATITUDE'
RELATE = '>'
C
C The adjustment value only applies to absolute extrema
C searches; simply give it an initial value of zero
C for this inequality search.
C
ADJUST = 0.D0
C
C STEPSZ is the step size, measured in seconds, used to search
C for times bracketing a state transition. Since we don't expect
C any events of interest to be shorter than five minutes, and
C since the separation between events is well over 5 minutes,
C we'll use this value as our step size. Units are seconds.
C
STEPSZ = 300.D0
C
C Display a banner for the output report:
C
TITLE = 'Inputs for target visibility search:'
CALL TOSTDO ( ' ' )
CALL TOSTDO ( TITLE )
CALL TOSTDO ( ' ' )
LINE = ' Target = #'
CALL REPMC ( LINE, '#', TARGET, LINE )
CALL TOSTDO ( LINE )
LINE = ' Observation surface location = #'
CALL REPMC ( LINE, '#', SRFPT, LINE )
CALL TOSTDO ( LINE )
LINE = ' Observer''s reference frame = #'
CALL REPMC ( LINE, '#', OBSFRM, LINE )
CALL TOSTDO ( LINE )
LINE = ' Elevation limit (degrees) = #'
CALL REPMF ( LINE, '#', ELVLIM, 7, 'F', LINE )
CALL TOSTDO ( LINE )
LINE = ' Aberration correction = #'
CALL REPMC ( LINE, '#', ABCORR, LINE )
CALL TOSTDO ( LINE )
LINE = ' Step size (seconds) = #'
CALL REPMF ( LINE, '#', STEPSZ, 9, 'F', LINE )
CALL TOSTDO ( LINE )
C
C Convert the start and stop times to ET.
C
CALL STR2ET ( START, ETBEG )
CALL STR2ET ( STOP, ETEND )
C
C Display the search interval start and stop times
C using the format shown below.
C
C 2004 MAY 06 20:15:00.000 (TDB)
C
CALL TIMOUT ( ETBEG, TDBFMT, TIMSTR )
LINE = ' Start time = '//TIMSTR
CALL TOSTDO ( LINE )
CALL TIMOUT ( ETEND, TDBFMT, TIMSTR )
LINE = ' Stop time = '//TIMSTR
CALL TOSTDO ( LINE )
CALL TOSTDO ( ' ' )
C
C Every SPICELIB window must have its size initialized.
C
C Initialize the "confinement" window with the interval
C over which we'll conduct the search.
C
CALL SSIZED ( MAXWIN, CNFINE )
CALL WNINSD ( ETBEG, ETEND, CNFINE )
C
C Initialize the result window; this window will contain
C the rise/set times found by our search.
C
CALL SSIZED ( MAXWIN, RISWIN )
C
C In the call below, the workspace dimensions are
C
C ( MAXWIN, NWMAX )
C
C Now search for the time period, within our confinement
C window, during which the apparent target has elevation
C at least equal to the elevation limit.
C
CALL GFPOSC ( TARGET, OBSFRM, ABCORR, SRFPT,
. CRDSYS, COORD, RELATE, REVLIM,
. ADJUST, STEPSZ, CNFINE, MAXWIN,
. NWMAX, WORK, RISWIN )
C
C The function WNCARD returns the number of intervals
C in a SPICE window.
C
WINSIZ = WNCARD( RISWIN )
IF ( WINSIZ .EQ. 0 ) THEN
WRITE (*,*) 'No events were found.'
ELSE
C
C Display the view periods.
C
LINE = 'Visibility times of # as seen from #:'
CALL REPMC ( LINE, '#', TARGET, LINE )
CALL REPMC ( LINE, '#', SRFPT, LINE )
CALL TOSTDO ( LINE )
CALL TOSTDO ( ' ' )
DO I = 1, WINSIZ
C
C Fetch the start and stop times of the Ith interval
C from the search result window RISWIN.
C
CALL WNFETD ( RISWIN, I, INTBEG, INTEND )
C
C Convert the rise time to a TDB calendar string.
C
CALL TIMOUT ( INTBEG, TDBFMT, TIMSTR )
C
C Write the string to standard output.
C
IF ( I .EQ. 1 ) THEN
LINE = 'Visibility or window start time: #'
ELSE
LINE = 'Visibility start time: #'
END IF
CALL REPMC ( LINE, '#', TIMSTR, LINE )
CALL TOSTDO ( LINE )
C
C Convert the set time to a TDB calendar string.
C
CALL TIMOUT ( INTEND, TDBFMT, TIMSTR )
C
C Write the string to standard output.
C
IF ( I .EQ. WINSIZ ) THEN
LINE = 'Visibility or window stop time: #'
ELSE
LINE = 'Visibility stop time: #'
END IF
CALL REPMC ( LINE, '#', TIMSTR, LINE )
CALL TOSTDO ( LINE )
CALL TOSTDO ( ' ' )
END DO
END IF
END
Solution Sample Output
After compiling the program, execute it. The output is:
Inputs for target visibility search:
Target = MPO
Observation surface location = NEW_NORCIA
Observer's reference frame = NEW_NORCIA_TOPO
Elevation limit (degrees) = 6.000000
Aberration correction = CN+S
Step size (seconds) = 300.000000
Start time = 2027 JAN 03 00:00:00.000 (TDB)
Stop time = 2027 JAN 06 00:00:00.000 (TDB)
Visibility times of MPO as seen from NEW_NORCIA:
Visibility or window start time: 2027 JAN 03 00:00:00.000 (TDB)
Visibility stop time: 2027 JAN 03 10:58:25.063 (TDB)
Visibility start time: 2027 JAN 03 21:55:08.488 (TDB)
Visibility stop time: 2027 JAN 04 11:01:14.279 (TDB)
Visibility start time: 2027 JAN 04 21:58:41.333 (TDB)
Visibility stop time: 2027 JAN 05 11:04:00.020 (TDB)
Visibility start time: 2027 JAN 05 22:02:18.477 (TDB)
Visibility or window stop time: 2027 JAN 06 00:00:00.000 (TDB)
Find Times when Target is VisibleTask Statement
Compute the final results twice as well, using the results of both occultation searches. For each of the two shape model cases, store the set of time intervals when the spacecraft is visible in a SPICELIB window. We'll call this the ``result window.'' Display each of the intervals in the result window as a pair of start and stop times. Express each time as a TDB calendar date using the same format as in the previous program. Learning Goals
ApproachSolution steps
SolutionSolution Meta-Kernel
KPL/MK
This is the meta-kernel used in the solution of the tasks in the
Geometric Event Finding Hands On Lesson.
The names and contents of the kernels referenced by this
meta-kernel are as follows:
1. Solar System Ephemeris SPK, subsetted to cover only the
time range of interest:
de432s.bsp
2. ESA stations SPK:
estrack_v04.bsp
3. ESA stations frame definitions:
estrack_v04.tf
4. EARTH_FIXED/ITRF93 frame connection:
earthfixeditrf93.tf
5. Binary PCK for Earth:
earth_070425_370426_predict.bpc
6. BepiColombo MPO Spacecraft Trajectory SPK, subsetted to
cover only the time range of interest:
bc_mpo_mlt_50037_20260314_20280529_v05.bsp
7. Generic LSK:
naif0012.tls
8. Generic PCK:
pck00011.tpc
9. Low-resolution Mercury DSK:
mercury_lowres.bds
\begindata
KERNELS_TO_LOAD = (
'kernels/spk/de432s.bsp'
'kernels/spk/estrack_v04.bsp'
'kernels/fk/estrack_v04.tf'
'kernels/fk/earthfixeditrf93.tf'
'kernels/pck/earth_070425_370426_predict.bpc'
'kernels/lsk/naif0012.tls'
'kernels/spk/bc_mpo_mlt_50037_20260314_20280529_v05.bsp'
'kernels/pck/pck00011.tpc'
'kernels/dsk/mercury_lowres.bds'
)
\begintext
Solution Code
PROGRAM VISIBL
IMPLICIT NONE
C
C Find and display the window of times when the BepiColombo
C MPO spacecraft is above a specified elevation limit in the
C topocentric reference frame of ESA's New Norcia station
C and is not occulted by Mercury.
C
C
C SPICELIB functions
C
DOUBLE PRECISION RPD
INTEGER WNCARD
C
C Global GF parameters: we import from this file
C the definition of the GF workspace size parameter
C
C NWMAX
C
C and the occultation parameters
C
C OCCLN
C SHPLEN
C
INCLUDE 'gf.inc'
C
C Local parameters
C
C Format string for time output:
C
CHARACTER*(*) TDBFMT
PARAMETER ( TDBFMT =
. 'YYYY MON DD HR:MN:SC.### TDB ::TDB' )
C
C The meta-kernel:
C
CHARACTER*(*) METAKR
PARAMETER ( METAKR = 'visibl.tm' )
C
C Maximum number of events we can handle in our event set:
C
INTEGER MAXEVT
PARAMETER ( MAXEVT = 1000 )
C
C Maximum result window size:
C
INTEGER MAXWIN
PARAMETER ( MAXWIN = 2 * MAXEVT )
C
C SPICELIB cell bound:
C
INTEGER LBCELL
PARAMETER ( LBCELL = -5 )
C
C String length parameters:
C
INTEGER BDNMLN
PARAMETER ( BDNMLN = 36 )
INTEGER CORLEN
PARAMETER ( CORLEN = 10 )
INTEGER FRNMLN
PARAMETER ( FRNMLN = 32 )
INTEGER LNSIZE
PARAMETER ( LNSIZE = 78 )
INTEGER MTHLEN
PARAMETER ( MTHLEN = 100 )
INTEGER NAMLEN
PARAMETER ( NAMLEN = 32 )
INTEGER OPLEN
PARAMETER ( OPLEN = 50 )
INTEGER TIMLEN
PARAMETER ( TIMLEN = 28 )
C
C Local variables
C
CHARACTER*(CORLEN) ABCORR
CHARACTER*(BDNMLN) BACK
CHARACTER*(FRNMLN) BFRAME
CHARACTER*(MTHLEN) BSHAPE
CHARACTER*(TIMLEN) BTMSTR
CHARACTER*(NAMLEN) CRDSYS
CHARACTER*(NAMLEN) COORD
CHARACTER*(TIMLEN) ETMSTR
CHARACTER*(FRNMLN) FFRAME
CHARACTER*(FRNMLN) FRAME
CHARACTER*(BDNMLN) FRONT
CHARACTER*(MTHLEN) FSHAPE
CHARACTER*(LNSIZE) LINE
CHARACTER*(OCLLN) OCCTYP
CHARACTER*(OPLEN) RELATE
CHARACTER*(NAMLEN) SRFPT
CHARACTER*(TIMLEN) START
CHARACTER*(TIMLEN) STOP
CHARACTER*(NAMLEN) TARGET
CHARACTER*(LNSIZE) TITLE
DOUBLE PRECISION ADJUST
C
C Confinement window used to store interval to be searched:
C
DOUBLE PRECISION CNFINE ( LBCELL : MAXEVT )
DOUBLE PRECISION DINTBG
DOUBLE PRECISION DINTEN
DOUBLE PRECISION ELVLIM
DOUBLE PRECISION ETBEG
DOUBLE PRECISION ETEND
DOUBLE PRECISION INTBEG
DOUBLE PRECISION INTEND
DOUBLE PRECISION REVLIM
C
C STEPSZ is the step size, measured in seconds, used to search
C for times bracketing a state transition.
C
DOUBLE PRECISION STEPSZ
C
C Result window used to store occultation times:
C
DOUBLE PRECISION OCCWIN ( LBCELL : MAXWIN )
C
C Result window used to store occultation times
C computed using DSK data:
C
DOUBLE PRECISION DOCWIN ( LBCELL : MAXWIN )
C
C Result window used to store rise/set times:
C
DOUBLE PRECISION RISWIN ( LBCELL : MAXWIN )
C
C Result windows used to store visibility periods:
C
DOUBLE PRECISION DVISWN ( LBCELL : MAXWIN )
DOUBLE PRECISION EVISWN ( LBCELL : MAXWIN )
C
C Workspace array:
C
DOUBLE PRECISION WORK ( LBCELL : MAXWIN, NWMAX )
INTEGER I
INTEGER WINSIZ
C
C Load the meta-kernel.
C
CALL FURNSH ( METAKR )
C
C Assign the inputs for our search.
C
SRFPT = 'NEW_NORCIA'
FRAME = 'NEW_NORCIA_TOPO'
TARGET = 'MPO'
ABCORR = 'CN+S'
START = '2027 JAN 03 TDB'
STOP = '2027 JAN 06 TDB'
ELVLIM = 6.0D0
C
C The elevation limit above has units of degrees; we convert
C this value to radians for computation using SPICE routines.
C We'll store the equivalent value in radians in REVLIM.
C
REVLIM = RPD() * ELVLIM
C
C Since we're interested in the apparent location of the
C target, we use light time and stellar aberration
C corrections.
C
C Since SPICE doesn't directly support the AZ/EL coordinate
C system, we use the equivalent constraint
C
C latitude > REVLIM
C
C in the latitudinal coordinate system, where the reference
C frame is topocentric and is centered at the viewing location.
C
CRDSYS = 'LATITUDINAL'
COORD = 'LATITUDE'
RELATE = '>'
C
C STEPSZ is the step size, measured in seconds, used to search
C for times bracketing a state transition. Since we don't expect
C any events of interest to be shorter than five minutes, and
C since the separation between events is well over 5 minutes,
C we'll use this value as our step size. Units are seconds.
C
STEPSZ = 300.D0
C
C We model the target shape as a point. We either model the
C blocking body's shape as an ellipsoid, or we represent its shap
e
C using actual topographic data. No body-fixed reference frame is
C required for the target since its orientation is not used.
C
C We'll set the shape specifications just before our calls to
C the GF occultation finding routine GFOCLT.
C
BACK = TARGET
BSHAPE = 'POINT'
BFRAME = ' '
FRONT = 'MERCURY'
FFRAME = 'IAU_MERCURY'
C
C The occultation type should be set to 'ANY' for a point
C target.
C
OCCTYP = 'ANY'
C
C Display a banner for the output report:
C
TITLE = 'Inputs for target visibility search:'
CALL TOSTDO ( ' ' )
CALL TOSTDO ( TITLE )
CALL TOSTDO ( ' ' )
LINE = ' Target = #'
CALL REPMC ( LINE, '#', TARGET, LINE )
CALL TOSTDO ( LINE )
LINE = ' Observation surface location = #'
CALL REPMC ( LINE, '#', SRFPT, LINE )
CALL TOSTDO ( LINE )
LINE = ' Observer''s reference frame = #'
CALL REPMC ( LINE, '#', FRAME, LINE )
CALL TOSTDO ( LINE )
LINE = ' Blocking body = #'
CALL REPMC ( LINE, '#', FRONT, LINE )
CALL TOSTDO ( LINE )
LINE = ' Blocker''s reference frame = #'
CALL REPMC ( LINE, '#', FFRAME, LINE )
CALL TOSTDO ( LINE )
LINE = ' Elevation limit (degrees) = #'
CALL REPMF ( LINE, '#', ELVLIM, 7, 'F', LINE )
CALL TOSTDO ( LINE )
LINE = ' Aberration correction = #'
CALL REPMC ( LINE, '#', ABCORR, LINE )
CALL TOSTDO ( LINE )
LINE = ' Step size (seconds) = #'
CALL REPMF ( LINE, '#', STEPSZ, 9, 'F', LINE )
CALL TOSTDO ( LINE )
C
C Convert the start and stop times to ET.
C
CALL STR2ET ( START, ETBEG )
CALL STR2ET ( STOP, ETEND )
C
C Display the search interval start and stop times
C using the format shown below.
C
C 2004 MAY 06 20:15:00.000 (TDB)
C
CALL TIMOUT ( ETBEG, TDBFMT, BTMSTR )
LINE = ' Start time = '//BTMSTR
CALL TOSTDO ( LINE )
CALL TIMOUT ( ETEND, TDBFMT, ETMSTR )
LINE = ' Stop time = '//ETMSTR
CALL TOSTDO ( LINE )
CALL TOSTDO ( ' ' )
C
C Every SPICELIB window must have its size initialized.
C
C Initialize the "confinement" window with the interval
C over which we'll conduct the search.
C
CALL SSIZED ( MAXWIN, CNFINE )
CALL WNINSD ( ETBEG, ETEND, CNFINE )
C
C Initialize the result window; this window will contain
C the rise/set times found by our search.
C
CALL SSIZED ( MAXWIN, RISWIN )
C
C Initialize the occultation and visibility windows.
C
CALL SSIZED ( MAXWIN, OCCWIN )
CALL SSIZED ( MAXWIN, DOCWIN )
CALL SSIZED ( MAXWIN, EVISWN )
CALL SSIZED ( MAXWIN, DVISWN )
C
C The adjustment value only applies to absolute extrema
C searches; simply give it an initial value of zero
C for this inequality search.
C
ADJUST = 0.D0
C
C Note that the workspace dimensions are ( MAXWIN, NWMAX ).
C
C Now search for the time period, within our confinement
C window, during which the apparent target has elevation
C at least equal to the elevation limit.
C
CALL GFPOSC ( TARGET, FRAME, ABCORR, SRFPT,
. CRDSYS, COORD, RELATE, REVLIM,
. ADJUST, STEPSZ, CNFINE, MAXWIN,
. NWMAX, WORK, RISWIN )
C
C Now find the times when the apparent target is above
C the elevation limit and is not occulted by the
C blocking body (Mercury). We'll find the times when the target
C is above the elevation limit and *is* occulted, then subtract
C that window from the view period window RISWIN found above.
C
C For this occultation search, we can use RISWIN as
C the confinement window because we're not interested in
C occultations that occur when the target is below the
C elevation limit.
C
C Find occultations within the view period window.
C
FSHAPE = 'ELLIPSOID'
WRITE (*,*) 'Searching using ellipsoid target shape model...'
CALL GFOCLT ( OCCTYP, FRONT, FSHAPE, FFRAME,
. BACK, BSHAPE, BFRAME, ABCORR,
. SRFPT, STEPSZ, RISWIN, OCCWIN )
WRITE (*,*) 'Done.'
C
C Subtract the occultation window from the view period
C window: this yields the time periods when the target
C is visible.
C
CALL WNDIFD ( RISWIN, OCCWIN, EVISWN )
C
C Repeat the search using low-resolution DSK data
C for the front body.
C
FSHAPE = 'DSK/UNPRIORITIZED'
WRITE (*,*) 'Searching using DSK target shape model...'
CALL GFOCLT ( OCCTYP, FRONT, FSHAPE, FFRAME,
. BACK, BSHAPE, BFRAME, ABCORR,
. SRFPT, STEPSZ, RISWIN, DOCWIN )
WRITE (*,*) 'Done.'
CALL WNDIFD ( RISWIN, DOCWIN, DVISWN )
C
C The function WNCARD returns the number of intervals
C in a SPICE window.
C
WINSIZ = WNCARD( EVISWN )
IF ( WINSIZ .EQ. 0 ) THEN
WRITE (*,*) 'No events were found.'
ELSE
C
C Display the visibility time periods.
C
WRITE (*,*) ' '
LINE = 'Visibility start and stop times of '
. // '# as seen from #'
CALL REPMC ( LINE, '#', TARGET, LINE )
CALL REPMC ( LINE, '#', SRFPT, LINE )
WRITE (*, '(A)') LINE
WRITE (*, '(A)') 'using both ellipsoidal and DSK '
. // 'target shape models:'
WRITE (*,*) ' '
DO I = 1, WINSIZ
C
C Fetch the start and stop times of the Ith interval
C from the ellipsoid search result window EVISWN.
C
CALL WNFETD ( EVISWN, I, INTBEG, INTEND )
C
C Convert the start and stop times to TDB calendar
C strings. Write the results.
C
CALL TIMOUT ( INTBEG, TDBFMT, BTMSTR )
CALL TIMOUT ( INTEND, TDBFMT, ETMSTR )
WRITE (*,'('' Ell: '',A, '' : '', A)' ) BTMSTR, ETMSTR
C
C Fetch the start and stop times of the Ith interval
C from the DSK search result window DVISWN.
C
CALL WNFETD ( DVISWN, I, DINTBG, DINTEN )
C
C Convert the start and stop times to TDB calendar
C strings. Write the results.
C
CALL TIMOUT ( DINTBG, TDBFMT, BTMSTR )
CALL TIMOUT ( DINTEN, TDBFMT, ETMSTR )
WRITE (*,'('' DSK: '',A, '' : '', A)' ) BTMSTR, ETMSTR
WRITE (*,*) ' '
END DO
END IF
END
Solution Sample Output
After compiling the program, execute it. The output is:
Inputs for target visibility search:
Target = MPO
Observation surface location = NEW_NORCIA
Observer's reference frame = NEW_NORCIA_TOPO
Blocking body = MERCURY
Blocker's reference frame = IAU_MERCURY
Elevation limit (degrees) = 6.000000
Aberration correction = CN+S
Step size (seconds) = 300.000000
Start time = 2027 JAN 03 00:00:00.000 TDB
Stop time = 2027 JAN 06 00:00:00.000 TDB
Searching using ellipsoid target shape model...
Done.
Searching using DSK target shape model...
Done.
Visibility start and stop times of MPO as seen from NEW_NORCIA
using both ellipsoidal and DSK target shape models:
Ell: 2027 JAN 03 00:00:00.000 TDB : 2027 JAN 03 01:28:03.419 TDB
DSK: 2027 JAN 03 00:00:00.000 TDB : 2027 JAN 03 01:28:03.202 TDB
Ell: 2027 JAN 03 02:00:42.993 TDB : 2027 JAN 03 03:49:50.750 TDB
DSK: 2027 JAN 03 02:00:43.226 TDB : 2027 JAN 03 03:49:50.589 TDB
Ell: 2027 JAN 03 04:22:20.803 TDB : 2027 JAN 03 06:11:38.050 TDB
DSK: 2027 JAN 03 04:22:21.167 TDB : 2027 JAN 03 06:11:37.927 TDB
Ell: 2027 JAN 03 06:43:58.528 TDB : 2027 JAN 03 08:33:25.499 TDB
DSK: 2027 JAN 03 06:43:58.803 TDB : 2027 JAN 03 08:33:25.452 TDB
Ell: 2027 JAN 03 09:05:36.070 TDB : 2027 JAN 03 10:55:12.991 TDB
DSK: 2027 JAN 03 09:05:36.483 TDB : 2027 JAN 03 10:55:13.005 TDB
Ell: 2027 JAN 03 21:55:08.488 TDB : 2027 JAN 03 22:44:11.490 TDB
DSK: 2027 JAN 03 21:55:08.488 TDB : 2027 JAN 03 22:44:11.836 TDB
Ell: 2027 JAN 03 23:15:19.552 TDB : 2027 JAN 04 01:05:59.339 TDB
DSK: 2027 JAN 03 23:15:20.564 TDB : 2027 JAN 04 01:05:59.788 TDB
Ell: 2027 JAN 04 01:36:56.572 TDB : 2027 JAN 04 03:27:47.253 TDB
DSK: 2027 JAN 04 01:36:56.903 TDB : 2027 JAN 04 03:27:47.794 TDB
Ell: 2027 JAN 04 03:58:33.411 TDB : 2027 JAN 04 05:49:35.238 TDB
DSK: 2027 JAN 04 03:58:33.685 TDB : 2027 JAN 04 05:49:35.857 TDB
Ell: 2027 JAN 04 06:20:10.165 TDB : 2027 JAN 04 08:11:23.310 TDB
DSK: 2027 JAN 04 06:20:10.819 TDB : 2027 JAN 04 08:11:23.843 TDB
Ell: 2027 JAN 04 08:41:46.813 TDB : 2027 JAN 04 10:33:11.480 TDB
DSK: 2027 JAN 04 08:41:47.399 TDB : 2027 JAN 04 10:33:12.291 TDB
Ell: 2027 JAN 04 21:58:41.333 TDB : 2027 JAN 04 22:22:13.911 TDB
DSK: 2027 JAN 04 21:58:41.333 TDB : 2027 JAN 04 22:22:13.969 TDB
Ell: 2027 JAN 04 22:51:24.368 TDB : 2027 JAN 05 00:44:02.576 TDB
DSK: 2027 JAN 04 22:51:24.088 TDB : 2027 JAN 05 00:44:02.498 TDB
Ell: 2027 JAN 05 01:13:00.256 TDB : 2027 JAN 05 03:05:51.406 TDB
DSK: 2027 JAN 05 01:13:00.056 TDB : 2027 JAN 05 03:05:51.377 TDB
Ell: 2027 JAN 05 03:34:36.025 TDB : 2027 JAN 05 05:27:40.260 TDB
DSK: 2027 JAN 05 03:34:36.194 TDB : 2027 JAN 05 05:27:40.400 TDB
Ell: 2027 JAN 05 05:56:11.727 TDB : 2027 JAN 05 07:49:29.298 TDB
DSK: 2027 JAN 05 05:56:11.995 TDB : 2027 JAN 05 07:49:29.743 TDB
Ell: 2027 JAN 05 08:17:47.213 TDB : 2027 JAN 05 10:11:18.377 TDB
DSK: 2027 JAN 05 08:17:47.173 TDB : 2027 JAN 05 10:11:18.893 TDB
Ell: 2027 JAN 05 10:39:22.574 TDB : 2027 JAN 05 11:04:00.020 TDB
DSK: 2027 JAN 05 10:39:22.690 TDB : 2027 JAN 05 11:04:00.020 TDB
Ell: 2027 JAN 05 22:27:17.183 TDB : 2027 JAN 06 00:00:00.000 TDB
DSK: 2027 JAN 05 22:27:17.436 TDB : 2027 JAN 06 00:00:00.000 TDB
Extra Credit
These ``extra credit'' tasks are provided as task statements, and unlike the regular tasks, no approach or solution source code is provided. In the next section, you will find the numeric solutions to the questions asked in these tasks. Task statements
2027 JAN 03 TDB
2027 JAN 04 TDB
2027 JAN 03 TDB
2027 JAN 04 TDB
2027 JAN 03 TDB
2027 JAN 04 TDB
Solutions
Inputs for equator crossing search:
Target = MPO
Observer = MERCURY
Observer's reference frame = IAU_MERCURY
Latitude limit (degrees) = 0.000000
Aberration correction = NONE
Step size (seconds) = 300.000000
Start time = 2027 JAN 03 00:00:00.000 (TDB)
Stop time = 2027 JAN 04 00:00:00.000 (TDB)
MPO MERCURY equator crossing times:
Equator crossing or start time: 2027 JAN 03 00:21:02.744 (TDB)
Equator crossing time: 2027 JAN 03 01:34:39.885 (TDB)
Equator crossing time: 2027 JAN 03 02:42:45.780 (TDB)
Equator crossing time: 2027 JAN 03 03:56:22.917 (TDB)
Equator crossing time: 2027 JAN 03 05:04:28.849 (TDB)
Equator crossing time: 2027 JAN 03 06:18:06.007 (TDB)
Equator crossing time: 2027 JAN 03 07:26:11.888 (TDB)
Equator crossing time: 2027 JAN 03 08:39:49.081 (TDB)
Equator crossing time: 2027 JAN 03 09:47:54.901 (TDB)
Equator crossing time: 2027 JAN 03 11:01:32.084 (TDB)
Equator crossing time: 2027 JAN 03 12:09:37.930 (TDB)
Equator crossing time: 2027 JAN 03 13:23:15.135 (TDB)
Equator crossing time: 2027 JAN 03 14:31:20.939 (TDB)
Equator crossing time: 2027 JAN 03 15:44:58.128 (TDB)
Equator crossing time: 2027 JAN 03 16:53:03.959 (TDB)
Equator crossing time: 2027 JAN 03 18:06:41.171 (TDB)
Equator crossing time: 2027 JAN 03 19:14:46.962 (TDB)
Equator crossing time: 2027 JAN 03 20:28:24.150 (TDB)
Equator crossing time: 2027 JAN 03 21:36:29.935 (TDB)
Equator crossing time: 2027 JAN 03 22:50:07.114 (TDB)
Equator crossing or stop time: 2027 JAN 03 23:58:12.944 (TDB)
Inputs for periapsis search:
Target = MPO
Observer = MERCURY
Aberration correction = NONE
Step size (seconds) = 300.000000
Start time = 2027 JAN 03 00:00:00.000 (TDB)
Stop time = 2027 JAN 04 00:00:00.000 (TDB)
MPO periapsis times:
Periapsis or start time: 2027 JAN 03 00:18:33.937 (TDB)
Periapsis time: 2027 JAN 03 02:40:16.998 (TDB)
Periapsis time: 2027 JAN 03 05:01:59.964 (TDB)
Periapsis time: 2027 JAN 03 07:23:43.026 (TDB)
Periapsis time: 2027 JAN 03 09:45:25.991 (TDB)
Periapsis time: 2027 JAN 03 12:07:09.042 (TDB)
Periapsis time: 2027 JAN 03 14:28:52.095 (TDB)
Periapsis time: 2027 JAN 03 16:50:35.082 (TDB)
Periapsis time: 2027 JAN 03 19:12:18.042 (TDB)
Periapsis time: 2027 JAN 03 21:34:01.097 (TDB)
Periapsis or end time: 2027 JAN 03 23:55:44.079 (TDB)
Inputs for apoapsis search:
Target = MPO
Observer = MERCURY
Aberration correction = NONE
Step size (seconds) = 300.000000
Start time = 2027 JAN 03 00:00:00.000 (TDB)
Stop time = 2027 JAN 04 00:00:00.000 (TDB)
MPO apoapsis times:
Apoapsis or start time: 2027 JAN 03 01:29:25.529 (TDB)
Apoapsis time: 2027 JAN 03 03:51:08.495 (TDB)
Apoapsis time: 2027 JAN 03 06:12:51.561 (TDB)
Apoapsis time: 2027 JAN 03 08:34:34.611 (TDB)
Apoapsis time: 2027 JAN 03 10:56:17.595 (TDB)
Apoapsis time: 2027 JAN 03 13:18:00.653 (TDB)
Apoapsis time: 2027 JAN 03 15:39:43.611 (TDB)
Apoapsis time: 2027 JAN 03 18:01:26.677 (TDB)
Apoapsis time: 2027 JAN 03 20:23:09.638 (TDB)
Apoapsis or stop time: 2027 JAN 03 22:44:52.618 (TDB)
|