Table of contents
CSPICE_DAFOPR opens a DAF for use by DAF readers
then returns an integer file handle.
Given:
fname the scalar string name of a DAF to open for read (search)
access.
help, fname
STRING = Scalar
the call:
cspice_dafopr, fname, handle
returns:
handle scalar integer value file handle used by other DAF routines to
refer to `fname'.
help, handle
LONG = Scalar
Use cspice_dafcls to close files opened by this routine.
None.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Use a simple routine to output the double precision and integer
values stored in an SPK's segments descriptors. This function
opens a DAF for read, performs a forwards search for the DAF
arrays, prints segments description for each array found, then
closes the DAF.
Use the SPK kernel below as input DAF file for the program.
de421.bsp
Example code begins here.
PRO dafopr_ex1
;;
;; Local constants
;;
kernel = 'de421.bsp'
;;
;; Open a DAF for read. Return a `handle' referring to the file.
;;
cspice_dafopr, kernel, handle
;;
;; Define the summary parameters appropriate
;; for an SPK file.
;;
ND = 2L
NI = 6L
;;
;; Begin a forward search on the file.
;;
cspice_dafbfs, handle
;;
;; Search until a DAF array is found.
;;
cspice_daffna, found
;;
;; Loop while the search finds subsequent DAF arrays.
;;
while found do begin
cspice_dafgs, ND, NI, dc, ic
print, 'Doubles: ', dc
print, 'Integers: ', ic
print, ' '
;;
;; Check for another segment.
;;
cspice_daffna, found
endwhile
;;
;; Safely close the DAF file.
;;
cspice_dafcls, handle
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 1 0 1 2
641 310404
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 2 0 1 2
310405 423048
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 3 0 1 2
423049 567372
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 4 0 1 2
567373 628976
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 5 0 1 2
628977 674740
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 6 0 1 2
674741 715224
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 7 0 1 2
715225 750428
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 8 0 1 2
750429 785632
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 9 0 1 2
785633 820836
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 10 0 1 2
820837 944040
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 301 3 1 2
944041 1521324
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 399 3 1 2
1521325 2098608
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 199 1 1 2
2098609 2098620
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 299 2 1 2
2098621 2098632
Doubles: -3.1691952e+09 1.6968528e+09
Integers: 499 4 1 2
2098633 2098644
Note, the specific contents of `ic' and `dc' depend on the
type of DAF.
Note, the final entries in the integer array contain the segment
start/end indexes. The output indicates the search proceeded
from the start of the file (low value index) towards the end
(high value index).
Most DAFs require only read access. If you do not need to
change the contents of a file, you should open it with cspice_dafopr.
1) If the specified file has already been opened for read
access, the handle already associated with the file is
returned.
2) If the specified file has already been opened for write
access, an error is signaled by a routine in the call
tree of this routine.
3) If the specified file has already been opened by a non-DAF
routine, an error is signaled by a routine in the call
tree of this routine.
4) If the specified file cannot be opened without exceeding
the maximum number of files, the error SPICE(DAFFTFULL)
is signaled by a routine in the call tree of this routine.
5) If the attempt to read the file's file record fails, the error
SPICE(FILEREADFAILED) is signaled by a routine in the call
tree of this routine.
6) If the specified file is not a DAF file, an error is
signaled by a routine in the call tree of this routine.
7) If no logical units are available, an error is
signaled by a routine in the call tree of this routine.
8) If the file does not exist, an error is signaled by a routine
in the call tree of this routine.
9) If an i/o error occurs in the process of opening the file,
the error is signaled by a routine in the call tree of this
routine.
10) If the file name is blank or otherwise inappropriate,
an error is signaled by a routine in the call tree of this
routine.
11) If the file was transferred improperly via FTP, an error is
signaled by a routine in the call tree of this routine.
12) If the file utilizes a binary file format that is not
currently supported on this platform, an error is signaled by
a routine in the call tree of this routine.
13) If the input argument `fname' is undefined, an error is
signaled by the IDL error handling system.
14) If the input argument `fname' is not of the expected type, or
it does not have the expected dimensions and size, an error is
signaled by the Icy interface.
15) If the output argument `handle' is not a named variable, an
error is signaled by the Icy interface.
See argument `fname'.
1) Files opened using this routine must be closed with cspice_dafcls.
DAF.REQ
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 31-MAY-2021 (JDR)
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Edited the header to comply with NAIF standard. Modified code
example to hardcode input SPK.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.1, 11-NOV-2013 (EDW)
Edits and clean up to header text.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
open DAF for read
|