dafps |
Table of contents
ProcedureDAFPS ( DAF, pack summary ) SUBROUTINE DAFPS ( ND, NI, DC, IC, SUM ) AbstractPack (assemble) an array summary from its double precision and integer components. Required_ReadingDAF KeywordsCONVERSION FILES DeclarationsIMPLICIT NONE INTEGER ND INTEGER NI DOUBLE PRECISION DC ( * ) INTEGER IC ( * ) DOUBLE PRECISION SUM ( * ) Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- ND I Number of double precision components. NI I Number of integer components. DC I Double precision components. IC I Integer components. SUM O Array summary. Detailed_InputND is the number of double precision components in the summary to be packed. NI is the number of integer components in the summary. DC are the double precision components of the summary. IC are the integer components of the summary. Detailed_OutputSUM is an array summary containing the components in DC and IC. This identifies the contents and location of a single array within a DAF. ParametersNone. ExceptionsError free. 1) If ND is zero or negative, no DP components are stored. 2) If NI is zero or negative, no integer components are stored. 3) If the total size of the summary is greater than 125 double precision words, some components may not be stored. See $Particulars for details. FilesNone. ParticularsThe components of array summaries are packed into double precision arrays for reasons outlined in [1]. Two routines, DAFPS (pack summary) and DAFUS (unpack summary) are provided for packing and unpacking summaries. The total size of the summary is (NI - 1) ND + -------- + 1 2 double precision words (where ND, NI are nonnegative). ExamplesThe numerical results shown for this example may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation. 1) Replace the body ID code 301 (Moon) with a test body ID, e.g. -999, in every descriptor of an SPK file. Example code begins here. PROGRAM DAFPS_EX1 IMPLICIT NONE C C SPICELIB functions. C INTEGER CARDI C C Local parameters. C INTEGER LBCELL PARAMETER ( LBCELL = -5 ) INTEGER DSCSIZ PARAMETER ( DSCSIZ = 5 ) INTEGER FILSIZ PARAMETER ( FILSIZ = 256 ) INTEGER MAXOBJ PARAMETER ( MAXOBJ = 1000 ) INTEGER ND PARAMETER ( ND = 2 ) INTEGER NI PARAMETER ( NI = 6 ) INTEGER NEWCOD PARAMETER ( NEWCOD = -999 ) INTEGER OLDCOD PARAMETER ( OLDCOD = 301 ) C C Local variables. C CHARACTER*(FILSIZ) FNAME DOUBLE PRECISION DC ( ND ) DOUBLE PRECISION SUM ( DSCSIZ ) INTEGER HANDLE INTEGER I INTEGER IC ( NI ) INTEGER IDS ( LBCELL : MAXOBJ ) LOGICAL FOUND C C Get the SPK file name. C CALL PROMPT ( 'Enter name of the SPK file > ', FNAME ) C C Initialize the set IDS. C CALL SSIZEI ( MAXOBJ, IDS ) C C Open for writing the SPK file. C CALL DAFOPW ( FNAME, HANDLE ) C C Search the file in forward order. C CALL DAFBFS ( HANDLE ) CALL DAFFNA ( FOUND ) DO WHILE ( FOUND ) C C Fetch and unpack the descriptor (aka summary) C of the current segment. C CALL DAFGS ( SUM ) CALL DAFUS ( SUM, ND, NI, DC, IC ) C C Replace ID codes if necessary. C IF ( IC(1) .EQ. OLDCOD ) THEN IC(1) = NEWCOD END IF IF ( IC(2) .EQ. OLDCOD ) THEN IC(2) = NEWCOD END IF C C Re-pack the descriptor; replace the descriptor C in the file. C CALL DAFPS ( ND, NI, DC, IC, SUM ) CALL DAFRS ( SUM ) C C Find the next segment. C CALL DAFFNA ( FOUND ) END DO C C Close the file. C CALL DAFCLS ( HANDLE ) C C Find the set of objects in the SPK file. C CALL SPKOBJ ( FNAME, IDS ) WRITE(*,'(A)') 'Objects in the DAF file:' WRITE(*,*) ' ' WRITE(*,'(20I4)') ( IDS(I), I= 1, CARDI ( IDS ) ) END When this program was executed on a Mac/Intel/gfortran/64-bit platform, using the SPK file named de430.bsp, the output was: Enter name of the SPK file > de430.bsp Objects in the DAF file: -999 1 2 3 4 5 6 7 8 9 10 199 299 399 RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) H.A. Neilan (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) E.D. Wright (JPL) VersionSPICELIB Version 1.1.0, 06-JUL-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. Added complete code example. SPICELIB Version 1.0.3, 10-OCT-2012 (EDW) Removed the obsolete Reference citation to "NAIF Document 167.0." Corrected ordering of header section. SPICELIB Version 1.0.2, 10-MAR-1992 (WLT) Comment section for permuted index source lines was added following the header. SPICELIB Version 1.0.1, 22-MAR-1990 (HAN) Literature references added to the header. SPICELIB Version 1.0.0, 31-JAN-1990 (IMU) |
Fri Dec 31 18:36:08 2021