C$Procedure GETFOV (Instrument FOV configuration) SUBROUTINE GETFOV( INSTID, ROOM, SHAPE, FRAME, BSIGHT, N, BUNDRY) C$ Abstract C C This subroutine returns the FOV configuration for a specified C instrument. C C$ Copyright C C Copyright (1995), California Institute of Technology. C U.S. Government sponsorship acknowledged. C C$ Required_Reading C C None. C C$ Keywords C C None. C C$ Declarations IMPLICIT NONE INTEGER INSTID INTEGER ROOM CHARACTER*(*) SHAPE CHARACTER*(*) FRAME DOUBLE PRECISION BSIGHT (3) INTEGER N DOUBLE PRECISION BUNDRY (*) C$ Brief_I/O C C VARIABLE I/O DESCRIPTION C -------- --- -------------------------------------------------- C INSTID I NAIF ID of an instrument C ROOM I The largest number of vector components to return. C SHAPE O Instrument FOV shape. C FRAME O Name of the frame FOV vectors defined in. C BSIGHT O Boresight vector. C N O Number of boundary vector components returned. C BUNDRY O FOV boundary vectors. C C$ Detailed_Input C C Not done yet. C C$ Detailed_Output C C Not done yet. C C$ Parameters C C Not done yet. C C$ Files C C Not done yet. C C$ Exceptions C C 1) Not done yet. C C$ Particulars C C Not done yet. C C$ Examples C C Not done yet. C C$ Restrictions C C None. C C$ Author_and_Institution C C B.V. Semenov (JPL) C C$ Literature_References C C None. C C$ Version C C- Beta Version 1.0.0, April 17, 1997 (BVS) C C C-& C$ Index_Entries C C return instrument's FOV configuration C C-& C C Local parameters C INTEGER KWDNLN PARAMETER ( KWDNLN = 32 ) INTEGER NSHAPS PARAMETER ( NSHAPS = 3 ) CHARACTER*(*) KWFRAM PARAMETER ( KWFRAM = 'INS#_FOV_FRAME' ) CHARACTER*(*) KWSHAP PARAMETER ( KWSHAP = 'INS#_FOV_SHAPE' ) CHARACTER*(*) KWBORE PARAMETER ( KWBORE = 'INS#_BORESIGHT' ) CHARACTER*(*) KWBOUN PARAMETER ( KWBOUN = 'INS#_FOV_BOUNDARY_CORNERS' ) C C Local variables C CHARACTER*(KWDNLN) KWORD CHARACTER*(KWDNLN) SHAPID ( NSHAPS ) LOGICAL FOUND CHARACTER*(1) TYPE INTEGER I C C SPICELIB functions C INTEGER RTRIM INTEGER BSRCHC LOGICAL RETURN C C Allowed values of shape identifier. C DATA ( SHAPID (I), I = 1, NSHAPS ) . / . 'CIRCLE', . 'ELLIPSE', . 'POLYGON' . / C C Standard SPICE error handling. C IF ( RETURN () ) THEN RETURN ELSE CALL CHKIN ( 'GETFOV' ) END IF C C Look for the frame keyword and get frame name if found, C complain if not. C CALL REPMI ( KWFRAM, '#', INSTID, KWORD ) CALL GCPOOL ( KWORD, 1, 1, I, FRAME, FOUND ) IF ( .NOT. FOUND ) THEN CALL SETMSG ( 'The variable, ''#'', specifying the frame ' . // 'which instrument # FOV components are ' . // 'defined relative to was not found in the ' . // 'kernel pool. Check whether IK file for ' . // 'the instrument was loaded into the program ' . // 'and whether this variable is specified in ' . // 'that file.' ) CALL ERRCH ( '#', KWORD(1:RTRIM(KWORD)) ) CALL ERRINT ( '#', INSTID ) CALL SIGERR ( 'SPICE(FRAMEKWDNOTFOUND)' ) CALL CHKOUT ( 'GETFOV' ) RETURN END IF C C Look for the shape keyword and get shape identifier if found, C complain if not. C CALL REPMI ( KWSHAP, '#', INSTID, KWORD ) CALL GCPOOL ( KWORD, 1, 1, I, SHAPE, FOUND ) IF ( .NOT. FOUND ) THEN CALL SETMSG ( 'The variable, ''#'', specifying the shape ' . // 'of the instrument # FOV was not found in the ' . // 'kernel pool. Check whether IK file for ' . // 'the instrument was loaded into the program ' . // 'and whether this variable is specified in ' . // 'that file.' ) CALL ERRCH ( '#', KWORD(1:RTRIM(KWORD)) ) CALL ERRINT ( '#', INSTID ) CALL SIGERR ( 'SPICE(SHAPEKWDNOTFOUND)' ) CALL CHKOUT ( 'GETFOV' ) RETURN END IF C C Check whether shape identified that we got is one from the list C of supported, complain if not. C IF ( BSRCHC( SHAPE(1:RTRIM(SHAPE)), NSHAPS, SHAPID ) .EQ. 0) THEN CALL SETMSG ( 'The FOV shape, ''#'', specified in the ' . // 'keyword, ''#'', for the instrument # ' . // 'is not supported. See GETFOV subroutine ' . // 'header for the list of supported instrument ' . // 'FOV shapes.' ) CALL ERRCH ( '#', SHAPE(1:RTRIM(SHAPE)) ) CALL ERRCH ( '#', KWORD(1:RTRIM(KWORD)) ) CALL ERRINT ( '#', INSTID ) CALL SIGERR ( 'SPICE(SHAPENOTSUPPORTED)' ) CALL CHKOUT ( 'GETFOV' ) RETURN END IF C C Look for the boresight keyword and get boresight vector if found, C complain if not. C CALL REPMI ( KWBORE, '#', INSTID, KWORD ) CALL GDPOOL ( KWORD, 1, 3, I, BSIGHT, FOUND ) IF ( .NOT. FOUND ) THEN CALL SETMSG ( 'The variable, ''#'', specifying the boresight ' . // 'of the instrument # was not found in the ' . // 'kernel pool. Check whether IK file for ' . // 'the instrument was loaded into the program ' . // 'and whether this variable is specified in ' . // 'that file.' ) CALL ERRCH ( '#', KWORD(1:RTRIM(KWORD)) ) CALL ERRINT ( '#', INSTID ) CALL SIGERR ( 'SPICE(BORESIGHTKWDNOTFOUND)' ) CALL CHKOUT ( 'GETFOV' ) RETURN END IF C C Check whether boresight specified by three coordinates; C complain if not. C IF ( I .LT. 3 ) THEN CALL SETMSG ( 'The number of the boresight vector components ' . // 'specified in the ''#'' variable is less than ' . // '3. Correct it in the corresponding IK file' . // 'to be a 3-dimensional vector.') CALL ERRCH ( '#', KWORD(1:RTRIM(KWORD)) ) CALL SIGERR ( 'SPICE(BADBORESIGHTSPEC)' ) CALL CHKOUT ( 'GETFOV' ) RETURN END IF C C Look for the FOV boundary vectors, check whether output array C is big enough to hold them; complain if not. C CALL REPMI ( KWBOUN, '#', INSTID, KWORD ) CALL DTPOOL ( KWORD, FOUND, N, TYPE ) IF ( .NOT. FOUND ) THEN CALL SETMSG ( 'The variable, ''#'', specifying the boundary ' . // 'vectors of the instrument # FOV ' . // 'was not found in the ' . // 'kernel pool. Check whether IK file for ' . // 'the instrument was loaded into the program ' . // 'and whether this variable is specified in ' . // 'that file.' ) CALL ERRCH ( '#', KWORD(1:RTRIM(KWORD)) ) CALL ERRINT ( '#', INSTID ) CALL SIGERR ( 'SPICE(BOUNDARYKWDNOTFOUND)' ) CALL CHKOUT ( 'GETFOV' ) RETURN END IF C C Check whether we have enough room to get all boundary vectors, C complain if not. C IF ( N .GT. ROOM ) THEN CALL SETMSG ( 'The number of boundary vector components ' . // 'specified in the ''#'' pool variable is ' . // 'bigger than room to hold them in output array ' . // 'specified by the ROOM input variable of the ' . // 'GETFOV subroutine.' ) CALL ERRCH ( '#', KWORD(1:RTRIM(KWORD)) ) CALL SIGERR ( 'SPICE(TOOMANYBOUNDARYVECTORS)' ) CALL CHKOUT ( 'GETFOV' ) RETURN END IF C C Check whether number of boundary components can be divided by 3 C without reminder. C IF ( MOD( N, 3 ) .NE. 0 ) THEN CALL SETMSG ( 'The boundary vector components ' . // 'specified in the ''#'' pool variable do ' . // 'not represent a set of 3-dimensional ' . // 'vectors. Number of components assigned ' . // 'to the variable cannot be divided by 3 ' . // 'without reminder. ' ) CALL ERRCH ( '#', KWORD(1:RTRIM(KWORD)) ) CALL SIGERR ( 'SPICE(BADBOUNDARYDEFINITION)' ) CALL CHKOUT ( 'GETFOV' ) RETURN END IF C C Boundaries are OK. Get them. C CALL GDPOOL ( KWORD, 1, ROOM, N, BUNDRY, FOUND ) C C All done. C C C Standard SPICE error handling. C CALL CHKOUT ( 'GETFOV' ) RETURN END