Table of contents
CSPICE_LDPOOL loads the variables contained in a NAIF ASCII kernel file
into the kernel pool.
Given:
fname the name of the text kernel file whose variables will be
loaded into the pool.
[1,c1] = size(fname); char = class(fname)
or
[1,1] = size(fname); cell = class(fname)
the call:
cspice_ldpool( fname )
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) The following program demonstrates how to load the variables
contained in a NAIF ASCII kernel file into the kernel pool
and how to determine the properties of a stored kernel
variable.
The program prompts for text kernel name and for the name of
a kernel variable. If the variable is present in the kernel
pool, the dimension and type of the variable are displayed.
Example code begins here.
function ldpool_ex1()
%
% Prompt for the name of a text-kernel file.
%
fname = input( 'Enter text-kernel name > ', 's' );
%
% Load the kernel. The same operation could be done using
% a cspice_furnsh call.
%
cspice_ldpool( fname );
varnam = input( 'Enter name of kernel variable > ', 's' );
[found, n, vtype] = cspice_dtpool( varnam );
if ( found )
fprintf( '\n' )
fprintf( 'Properties of variable %s:\n', varnam )
fprintf( '\n' )
fprintf( ' Size: %d\n', n )
if ( strcmp( vtype, 'C' ) )
fprintf( ' Type: Character\n' )
else
fprintf( ' Type: Numeric\n' )
end
else
fprintf( '%s is not present in the kernel pool.\n', varnam )
end
%
% It's always good form to unload kernels after use,
% particularly in Matlab due to data persistence.
%
cspice_kclear
When this program was executed on a Mac/Intel/Octave6.x/64-bit
platform, using the PCK file gm_de431.tpc to ask for the
variable 'BODY000_GMLIST', the output was:
Enter text-kernel name > gm_de431.tpc
Enter name of kernel variable > BODY000_GMLIST
Properties of variable BODY000_GMLIST:
Size: 65
Type: Numeric
None.
1) If an I/O error occurs while opening or reading a text kernel,
the error is signaled by a routine in the call tree of this
routine.
2) If any text kernel parsing error occurs, the error is signaled
by a routine in the call tree of this routine.
3) If a kernel pool overflow is detected, an error is signaled by
a routine in the call tree of this routine.
4) If the input argument `fname' is undefined, an error is
signaled by the Matlab error handling system.
5) 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 Mice interface.
See `fname' in -I/O.
1) Normally SPICE applications should load kernels via the
cspice_furnsh routine.
KERNEL.REQ
MICE.REQ
None.
J. Diaz del Rio (ODC Space)
-Mice Version 1.0.0, 30-JUN-2021 (JDR)
LOAD variables from a text kernel file into the pool
|