Table of contents
CSPICE_DAFCLS closes the DAF referred to by a handle.
Given:
handle file handle referring to a DAF.
[1,1] = size(handle); int32 = class(handle)
the call:
cspice_dafcls( handle )
closes the DAF, i.e. removes the file from read or write
access by the SPICE DAF subsystem.
Use this routine to close files opened by cspice_dafopr and
cspice_dafopw.
returns:
None.
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 function 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 the segment 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.
function dafcls_ex1()
%
% Local constants
%
kernel = 'de421.bsp';
%
% Open a DAF for read. Return a `handle' referring to the file.
%
handle = cspice_dafopr( kernel );
%
% Define the summary parameters appropriate
% for an SPK file.
%
ND = 2;
NI = 6;
%
% Begin a forward search on the file.
%
cspice_dafbfs( handle );
%
% Search until a DAF array is found.
%
found = cspice_daffna;
%
% Loop while the search finds subsequent DAF arrays.
%
while found
[dc, ic ] = cspice_dafgs( ND, NI );
fprintf( 'Doubles: ' )
fprintf( '%f ', dc )
fprintf( '\n' )
fprintf( 'Integers: ' )
fprintf( '%d ', ic )
fprintf( '\n\n' )
%
% Check for another segment.
%
found = cspice_daffna;
end
%
% Safely close the DAF.
%
cspice_dafcls( handle )
When this program was executed on a Mac/Intel/Octave6.x/64-bit
platform, the output was:
Doubles: -3169195200.000000 1696852800.000000
Integers: 1 0 1 2 641 310404
Doubles: -3169195200.000000 1696852800.000000
Integers: 2 0 1 2 310405 423048
Doubles: -3169195200.000000 1696852800.000000
Integers: 3 0 1 2 423049 567372
Doubles: -3169195200.000000 1696852800.000000
Integers: 4 0 1 2 567373 628976
Doubles: -3169195200.000000 1696852800.000000
Integers: 5 0 1 2 628977 674740
Doubles: -3169195200.000000 1696852800.000000
Integers: 6 0 1 2 674741 715224
Doubles: -3169195200.000000 1696852800.000000
Integers: 7 0 1 2 715225 750428
Doubles: -3169195200.000000 1696852800.000000
Integers: 8 0 1 2 750429 785632
Doubles: -3169195200.000000 1696852800.000000
Integers: 9 0 1 2 785633 820836
Doubles: -3169195200.000000 1696852800.000000
Integers: 10 0 1 2 820837 944040
Doubles: -3169195200.000000 1696852800.000000
Integers: 301 3 1 2 944041 1521324
Doubles: -3169195200.000000 1696852800.000000
Integers: 399 3 1 2 1521325 2098608
Doubles: -3169195200.000000 1696852800.000000
Integers: 199 1 1 2 2098609 2098620
Doubles: -3169195200.000000 1696852800.000000
Integers: 299 2 1 2 2098621 2098632
Doubles: -3169195200.000000 1696852800.000000
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).
Because the DAF subsystem must keep track of what files are open at
any given time, it is important that DAF files be closed only with
cspice_dafcls, to prevent the remaining DAF routines from failing,
sometimes mysteriously.
Note that when a file is opened more than once for read access,
cspice_dafopr returns the same handle each time it is re-opened.
Each time the file is closed, cspice_dafcls checks to see if any other
claims on the file are still active before physically closing
1) If the specified handle does not belong to a DAF
that is currently open, nothing happens.
2) If this routine is used to close a `handle' not associated with
a DAF, an error is signaled by a routine in the call tree of
this routine.
3) If the input argument `handle' is undefined, an error is
signaled by the Matlab error handling system.
4) If the input argument `handle' is not of the expected type, or
it does not have the expected dimensions and size, an error is
signaled by the Mice interface.
None.
None.
MICE.REQ
DAF.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Mice Version 1.1.0, 10-AUG-2021 (EDW) (JDR)
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Edits to the -Examples section to comply with NAIF standard.
Modified code example to hardcode SPK file to be used as input.
Eliminated use of "lasterror" in rethrow.
Removed reference to the function's corresponding CSPICE header from
-Required_Reading section.
-Mice Version 1.0.0, 10-JUL-2012 (EDW)
close DAF
|