Table of contents
CSPICE_BODVCD returns from the kernel pool the double precision values
of an item associated with a body, where the body is specified by an
integer ID code.
Given:
bodyid SPICE ID code for a body of interest. For example, if the
body is the earth, the code is 399.
[1,1] = size(bodyid); int32 = class(bodyid)
item the item name to return.
[1,c1] = size(item); char = class(item)
or
[1,1] = size(item); cell = class(item)
Together, the NAIF ID code of the body and the item name
combine to form a kernel variable name, e.g.,
'BODY599_RADII'
'BODY401_POLE_RA'
The values associated with the kernel variable having
the name constructed as shown are sought. Below
we'll take the shortcut of calling this kernel variable
the "requested kernel variable."
Note that 'item' *is* case-sensitive. This attribute
is inherited from the case-sensitivity of kernel
variable names.
maxn the maximum number of kernel pool values to returns.
[1,1] = size(maxn); int32 = class(maxn)
the call:
values = cspice_bodvcd(bodyid, item, maxn)
returns:
values an array of at most 'maxn' values associated with the
requested kernel variable.
[1,n] = size(values); double = class(values)
with n <= 'maxn'.
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) Retrieve the radii of the Earth from the kernel pool, using both
'RADII' and 'radii' as the item name to return. Since the `item'
variable possesses case sensitivity, the later case should fail.
Trap the error and print it to the output.
Use the PCK kernel below to load the required triaxial
ellipsoidal shape model for the Earth.
pck00008.tpc
Example code begins here.
function bodvcd_ex1()
%
% Load a PCK file.
%
cspice_furnsh( 'pck00008.tpc' )
%
% When the kernel variable
%
% BODY399_RADII
%
% is present in the kernel pool---normally because a PCK
% defining this variable has been loaded (as is the case
% here)---the call
%
values1 = cspice_bodvcd( 399, 'RADII', 3);
fprintf( 'Earth RADII: %10.3f %10.3f %10.3f\n', values1 )
%
% returns the dimension and values associated with the
% variable "BODY399_RADII".
%
%
% The `item' variable possesses case sensitivity.
%
try
%
% A call with improper case in `item' will fail.
%
values2 = cspice_bodvcd( 399, 'radii', 3);
catch
%
% Catch the error, return the error string to the user.
%
disp( 'Expected error signaled:' )
disp( ' ' )
disp( lasterr )
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, the output was:
Earth RADII: 6378.140 6378.140 6356.750
Expected error signaled:
mice: SPICE(KERNELVARNOTFOUND): [bodvcd_c->BODVCD] The variable
BODY399_radii could not be found in the kernel pool. (CSPICE_N0066)
Note that the SPICE(KERNELVARNOTFOUND) error is signaled
when the requested item is not found in the kernel pool.
This routine simplifies looking up PCK kernel variables by
constructing names of requested kernel variables and by
performing error checking.
This routine is intended for use in cases where the maximum number of
values that may be returned is known at compile time. The caller fetches
all of the values associated with the specified kernel variable via a
single call to this routine. If the number of values to be fetched cannot
be known until run time, the lower-level routine cspice_gdpool should be
used instead. cspice_gdpool supports fetching arbitrary amounts of data in
multiple "chunks."
This routine is intended for use in cases where the requested
kernel variable is expected to be present in the kernel pool. If
the variable is not found or has the wrong data type, this
routine signals an error. In cases where it is appropriate to
indicate absence of an expected kernel variable by returning a
boolean "found flag" with the value false, again the routine
cspice_gdpool should be used.
1) If the requested kernel variable is not found in the kernel
pool, the error SPICE(KERNELVARNOTFOUND) is signaled by a
routine in the call tree of this routine.
2) If the requested kernel variable is found but the associated
values aren't numeric, the error SPICE(TYPEMISMATCH) is
signaled by a routine in the call tree of this routine.
3) If the dimension of `values' indicated by `maxn' is too small to
contain the requested values, the error SPICE(ARRAYTOOSMALL)
is signaled by a routine in the call tree of this routine. The
output array `values' must be declared with sufficient size to
contain all of the values associated with the requested kernel
variable.
4) If the input dimension `maxn' indicates there is more room in
`values' than there really is---for example, if `maxn' is 10 but
values is declared with dimension 5---and the dimension of the
requested kernel variable is larger than the actual dimension
of `values', then this routine may overwrite memory. The results
are unpredictable.
5) If any of the input arguments, `bodyid', `item' or `maxn', is
undefined, an error is signaled by the Matlab error handling
system.
6) If any of the input arguments, `bodyid', `item' or `maxn', 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
KERNEL.REQ
NAIF_IDS.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Mice Version 1.2.0, 05-SEP-2021 (EDW) (JDR)
Fixed typo in Usage message.
Edited the -Examples section to comply with NAIF standard. Added
reference to required PCK.
Added -Parameters, -Particulars, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Eliminated use of "lasterror" in rethrow.
Removed reference to the function's corresponding CSPICE header from
-Required_Reading section.
-Mice Version 1.1.1, 29-OCT-2014 (EDW)
Edited -I/O section to conform to NAIF standard for Mice
documentation.
-Mice Version 1.1.0, 23-FEB-2009 (EDW)
Added zzmice_str call on input 'item' to convert string cells to
character arrays if 'item' has type string cells. Added proper
markers for usage string variable types.
-Mice Version 1.0.0, 22-NOV-2005 (EDW)
fetch constants for a body from the kernel pool
physical constants for a body
|