Table of contents
CSPICE_DAFGN returns the name for current array in the current
DAF being searched.
The call:
cspice_dafgn, name
returns:
name the name for the current array (the array found by the latest
call to cspice_daffna or cspice_daffpa).
help, name
STRING = Scalar
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) Read the name for each array in a DAF file.
Use the SPK kernel below as input DAF file for the example.
OUTERPLANETS_V0002.BSP
Example code begins here.
PRO dafgn_ex1
;;
;; Define a DAF from which to read the name for each array in
;; the DAF.
;;
DAF = 'OUTERPLANETS_V0002.BSP'
NI = 6
ND = 2
;;
;; Open the DAF for read
;;
cspice_dafopr, DAF, handle
;;
;; Begin a forward search on 'DAF'.
;;
cspice_dafbfs, handle
cspice_daffna, found
;;
;; Loop while found
;;
while ( found ) do begin
cspice_dafgs, ND, NI, dc, ic
cspice_dafgn, name
;;
;; Output each array name.
;;
print, name
;;
;; Check for a next segment.
;;
cspice_daffna, found
endwhile
;;
;; Close the file.
;;
cspice_dafcls, handle
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
JUP230
SAT261xl
URA083
NEP016.6
The DAF search routines are:
cspice_dafbfs Begin forward search.
cspice_daffna Find next array.
cspice_dafbbs Begin backward search.
cspice_daffpa Find previous array.
cspice_dafgs Get summary.
cspice_dafgn Get name.
cspice_dafcs Continue search.
The main function of these routines is to allow the
contents of any DAF to be examined on an array-by-array
basis.
Conceptually, the arrays in a DAF form a doubly linked list,
which can be searched in either of two directions: forward or
backward. It is possible to search multiple DAFs simultaneously.
cspice_dafbfs (begin forward search) and daffna are used to search the
arrays in a DAF in forward order. In applications that search a
single DAF at a time, the normal usage is
cspice_dafbfs, handle
cspice_daffna, found
while found do begin
cspice_dafgs, nd, ni, dc, ic
cspice_dafgn, name
.
.
cspice_daffna, found
endwhile
cspice_dafbbs (begin backward search) and cspice_daffpa are used to
search the arrays in a DAF in backward order. In applications that
search a single DAF at a time, the normal usage is
cspice_dafbbs, handle
cspice_daffpa, found
while found do begin
cspice_dafgs, nd, ni, dc, ic
cspice_dafgn, name
.
.
cspice_daffpa, found
endwhile
In applications that conduct multiple searches simultaneously, the above
usage must be modified to specify the handle of the file to operate on,
in any case where the file may not be the last one specified by
cspice_dafbfs or cspice_dafbbs. The routine cspice_dafcs (DAF, continue
search) is used for this purpose. Below, we give an example of an
interleaved search of two files specified by the handles `handl1' and
`handl2'. The directions of searches in different DAFs are independent;
here we conduct a forward search on one file and a backward search on the
other. Throughout, we use cspice_dafcs to specify which file to operate
on, before calling cspice_daffna, cspice_daffpa, cspice_dafgs, or
cspice_dafgn.
cspice_dafbfs, handl1
cspice_dafbbs, handl2
cspice_dafcs, handl1
cspice_daffna, found1
cspice_dafcs, handl2
cspice_daffpa, found2
while ( found1 || found2 ) do begin
if ( found1 ) then begin
cspice_dafcs, handl1
cspice_dafgs, nd, ni, dc, ic
cspice_dafgn, name
.
.
cspice_dafcs ( &handl1 );
cspice_daffna ( &found1 );
endif
if ( found2 ) then begin
cspice_dafcs, handl2
cspice_dafgs, nd, ni, dc, ic
cspice_dafgn, name
.
.
cspice_dafcs, handl2
cspice_daffpa, found2
endif
endwhile
At any time, the latest array found (whether by cspice_daffna or
cspice_daffpa) is regarded as the 'current' array for the file in which
the array was found. The last DAF in which a search was started,
executed, or continued by any of cspice_dafbfs, cspice_dafbbs,
cspice_daffna, cspice_daffpa or cspice_dafcs is regarded as the 'current'
DAF. The summary and name for the current array in the current DAF can
be obtained separately, as shown above, by calls to cspice_dafgs
(get summary) and cspice_dafgn (get name).
Once a search has been begun, it may be continued in either
direction. That is, cspice_daffpa may be used to back up during a
forward search, and cspice_daffna may be used to advance during a
backward search.
1) If this routine is called when no search is in progress in the
current DAF, the error SPICE(DAFNOSEARCH) is signaled by a
routine in the call tree of this routine.
2) If the DAF for which the "current" array's name is to be
returned has actually been closed, an error is signaled by a
routine in the call tree of this routine.
3) If no array is current in the current DAF, the error
SPICE(NOCURRENTARRAY) is signaled by a routine in the call tree of
this routine. There is no current array when a search is started by
cspice_dafbfs or cspice_dafbbs, but no calls to cspice_daffna or
cspice_daffpa have been made yet, or whenever cspice_daffna or
cspice_daffpa return the value False in the `found' argument.
4) If the output argument `name' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
ICY.REQ
DAF.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 09-JUL-2021 (JDR)
Edited the header to comply with NAIF standard. Added example's
problem statement and changed input DAF file.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added argument's type and size information in the -I/O section.
-Icy Version 1.0.1, 13-SEP-2012 (EDW)
Edits and clean up to header text.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
get DAF array name
|