Table of contents
CSPICE_SRFCSS translates a surface ID code, together with a body
string, to the corresponding surface name. If no such surface name exists,
return a string representation of the surface ID code.
Given:
code an integer ID code for a surface associated with a specified
body.
help, code
LONG = Scalar
bodstr a string designating the body associated with the input surface
ID code.
help, bodstr
STRING = Scalar
`bodstr' may contain a body name or a string representation of
the body's integer ID code. For example, `bodstr' may contain
'1000012'
instead of
'67P/CHURYUMOV-GERASIMENKO (1969 R1)'
Case and leading and trailing blanks in a name are not
significant. Sequences of consecutive embedded blanks
are considered equivalent to a single blank. That is,
all of the following strings are equivalent names:
'67P/CHURYUMOV-GERASIMENKO (1969 R1)'
'67P/Churyumov-Gerasimenko (1969 R1)'
'67P/CHURYUMOV-GERASIMENKO (1969 R1) '
'67P/CHURYUMOV-GERASIMENKO (1969 R1)'
' 67P/CHURYUMOV-GERASIMENKO (1969 R1)'
However, '67P/CHURYUMOV-GERASIMENKO(1969R1)'
is not equivalent to the names above.
the call:
cspice_srfcss, code, bodstr, srfstr, isname
returns:
srfstr the name of the surface identified by `code', for the body
designated by `bodstr', if for this body an association exists
between the input surface ID and a surface name.
help, srfstr
STRING = Scalar
If `code' has more than one translation, then the most
recently defined surface name corresponding to `code' is
returned. `srfstr' will have the exact format (case and
embedded blanks) used in the definition of the
name/code association.
If the input surface ID code and body name do not map
to a surface name, `srfstr' is set to the string
representation of `code'.
`srfstr' should be declared with length SFNMLN (see the
-Parameters section below).
isname a logical flag that is True if a surface name corresponding to
the input ID codes was found and False otherwise.
help, isname
BOOLEAN = Scalar
When `isname' is False, the output string `srfstr' contains a
string representing the integer `code'.
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) Supposed a text kernel has been loaded that contains
the following assignments:
NAIF_SURFACE_NAME += ( 'MGS MOLA 64 pixel/deg',
'MGS MOLA 128 pixel/deg',
'PHOBOS GASKELL Q512' )
NAIF_SURFACE_CODE += ( 1, 2, 1 )
NAIF_SURFACE_BODY += ( 499, 499, 401 )
Translate each surface and body ID code pair to the
associated surface name. Also perform a translation
for a surface ID having no matching name.
Use the meta-kernel shown below to define the required SPICE
kernel variables.
KPL/MK
File: srfcss_ex1.tm
This meta-kernel is intended to support operation of SPICE
example programs. The file contents shown here should not be
assumed to contain adequate or correct versions of data
required by SPICE-based user applications.
\begindata
NAIF_SURFACE_NAME += ( 'MGS MOLA 64 pixel/deg',
'MGS MOLA 128 pixel/deg',
'PHOBOS GASKELL Q512' )
NAIF_SURFACE_CODE += ( 1, 2, 1 )
NAIF_SURFACE_BODY += ( 499, 499, 401 )
\begintext
End of meta-kernel
Example code begins here.
PRO srfcss_ex1
bodstr = [ 'MARS', 'PHOBOS', '499', 'MARS', 'ZZZ' ]
surfid = [ 1L, 1, 2, 3, 1 ]
tf = [ 'false', 'true' ]
meta = 'srfcss_ex1.tm'
cspice_furnsh, meta
for i= 0, n_elements( bodstr )-1L do begin
cspice_srfcss, surfid[i], bodstr[i], srfnam, isname
print, 'surface ID = ', surfid[i]
print, 'body string = ', bodstr[i]
print, 'name found = ', tf[ long(isname) ]
print, 'surface string = ', srfnam
print
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
surface ID = 1
body string = MARS
name found = true
surface string = MGS MOLA 64 pixel/deg
surface ID = 1
body string = PHOBOS
name found = true
surface string = PHOBOS GASKELL Q512
surface ID = 2
body string = 499
name found = true
surface string = MGS MOLA 128 pixel/deg
surface ID = 3
body string = MARS
name found = false
surface string = 3
surface ID = 1
body string = ZZZ
name found = false
surface string = 1
Surfaces are always associated with bodies (which usually are
ephemeris objects). For any given body, a mapping between surface
names and surface ID codes can be established.
Bodies serve to disambiguate surface names and ID codes: the set
of surface names and surface ID codes for a given body can be
thought of as belonging to a name space. A given surface ID code
or surface name may be used for surfaces of multiple bodies,
without conflict.
Associations between surface names and ID codes are always made
via kernel pool assignments; there are no built-in associations.
cspice_srfcss is one of four related procedures:
cspice_srfs2c Surface string and body string to surface ID code
cspice_srfscc Surface string and body ID code to surface ID code
cspice_srfc2s Surface ID code and body ID code to surface string
cspice_srfcss Surface ID code and body string to surface string
cspice_srfs2c, cspice_srfc2s, cspice_srfscc, and cspice_srfcss perform
translations between surface strings and their corresponding integer
ID codes.
Refer to naif_ids.req for details concerning adding new surface
name/code associations at run time by loading text kernels.
1) If the input body string cannot be mapped to a body name, the
output `srfstr' is set to a string representation of the
surface ID code. The output `isname' is set to False.
This case is not treated as an error.
2) If the input surface code cannot be mapped to a surface name,
the output `srfstr' is set to a string representation of the
surface ID code. The input body string is ignored. The output
`isname' is set to False.
This case is not treated as an error.
3) If any of the input arguments, `code' or `bodstr', is
undefined, an error is signaled by the IDL error handling
system.
4) If any of the input arguments, `code' or `bodstr', is not of
the expected type, or it does not have the expected dimensions
and size, an error is signaled by the Icy interface.
5) If any of the output arguments, `srfstr' or `isname', is not a
named variable, an error is signaled by the Icy interface.
Surface name-to-ID mappings may be defined at run time by loading
text kernels containing kernel variable assignments of the form
NAIF_SURFACE_NAME += ( <surface name 1>, ... )
NAIF_SURFACE_CODE += ( <surface code 1>, ... )
NAIF_SURFACE_BODY += ( <body code 1>, ... )
Above, the ith elements of the lists on the assignments' right
hand sides together define the ith surface name/ID mapping.
The same effect can be achieved using assignments formatted as
follows:
NAIF_SURFACE_NAME += <surface name 1>
NAIF_SURFACE_CODE += <surface code 1>
NAIF_SURFACE_BODY += <body code 1>
NAIF_SURFACE_NAME += <surface name 2>
NAIF_SURFACE_CODE += <surface code 2>
NAIF_SURFACE_BODY += <body code 2>
...
Note the use of the
+=
operator; this operator appends to rather than overwrites the
kernel variable named on the left hand side of the assignment.
None.
DSK.REQ
ICY.REQ
NAIF_IDS.REQ
None.
J. Diaz del Rio (ODC Space)
M. Liukis (JPL)
E.D. Wright (JPL)
-Icy Version 1.0.1, 01-JUN-2021 (JDR)
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Edited the header to comply with NAIF standard.
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.0, 15-DEC-2016 (ML) (EDW)
surface ID code and body string to surface string
|