Skip to main content

wrpool

Function wrpool 

Source
pub fn wrpool(ctx: &mut SpiceContext<'_>, unit: i32) -> Result<()>
Expand description

Write the variables in pool to a specified unit

Write to a specified unit a set of “keyword = value” assignments for all currently defined kernel variables. The assignments constitute a text kernel from which the current state of the kernel pool can be restored.

§Required Reading

§Brief I/O

 VARIABLE  I/O  DESCRIPTION
 --------  ---  --------------------------------------------------
 UNIT       I   Logical unit to which the variables in the pool
                will be written.

§Detailed Input

 UNIT     is the logical unit to which the variables in the pool
          will be written.

§Exceptions

 1)  If writing a variable to the output file fails due to an I/O
     error, the error SPICE(WRITEERROR) is signaled.

§Files

 This routine writes to the specified logical unit the kernel
 variables present in the kernel pool. Each variable consists of a
 name and a set of associated values. The variables are written in
 the form of a series of "keyword = value" assignments. The
 assignments are preceded by a SPICE text kernel "\begindata"
 marker.

 The output of this routine, if written to a text file, is a SPICE
 text kernel. The current contents of the kernel pool can be
 restored by clearing the pool and then loading this text kernel.

 If the values are to be written to an output kernel file, the
 file should be opened with a logical unit determined by the
 calling program.

§Examples

 The following code fragment demonstrates how the data from
 several kernel files can be loaded into a kernel pool. After the
 pool is loaded, the values in the pool are written to a kernel
 file.


 C
 C     Store in an array the names of the kernel files whose
 C     values will be loaded into the kernel pool.
 C
       FNAME (1) = 'AXES.KER'
       FNAME (2) = 'GM.KER'
       FNAME (3) = 'LEAP_SECONDS.KER'

 C
 C     Clear the kernel pool. (This is optional.)
 C
       CALL CLPOOL

 C
 C     Load the variables from the three kernel files into the
 C     the kernel pool.
 C
       DO I = 1, 3
         CALL LDPOOL ( FNAME (I) )
       END DO

 C
 C     We can examine the values associated with any double
 C     precision variable in the kernel pool using GDPOOL.
 C
       CALL GDPOOL ( VARIABLE, 1, NMAX, NUMVAL, VALUES, FOUND )

 C
 C     Open the new text file 'NEWKERNEL.KER'.
 C
       CALL TXTOPN ( 'NEWKERNEL.KER', UNIT )

 C
 C     Write the values in the kernel pool to the file.
 C
       CALL WRPOOL ( UNIT )

§Author and Institution

 N.J. Bachman       (JPL)
 J. Diaz del Rio    (ODC Space)
 H.A. Neilan        (JPL)
 B.V. Semenov       (JPL)
 W.L. Taber         (JPL)
 I.M. Underwood     (JPL)

§Version

-    SPICELIB Version 8.1.2, 17-AUG-2021 (JDR) (BVS)

        Edited the header to comply with NAIF standard.

        Updated the $Exceptions section to document the actual error
        handling of the routine.

-    SPICELIB Version 8.1.1, 30-JUN-2014 (NJB)

        Updated header to more accurately describe the output
        of this routine.

-    SPICELIB Version 8.1.0, 19-MAR-2009 (NJB)

        Updated code example to use TXTOPN.

-    SPICELIB Version 8.0.0, 04-JUN-1999 (WLT)

        Added the entry points PCPOOL, PDPOOL and PIPOOL to allow
        direct insertion of data into the kernel pool without having
        to read an external file.

        Added the interface LMPOOL that allows SPICE
        programs to load text kernels directly from memory
        instead of requiring a text file.

        Added the entry point SZPOOL to return kernel pool definition
        parameters.

        Added the entry point DVPOOL to allow the removal of a variable
        from the kernel pool.

        Added the entry point GNPOOL to allow users to determine
        variables that are present in the kernel pool

-    SPICELIB Version 7.0.0, 20-SEP-1995 (WLT)

        The implementation of the kernel pool was completely redone
        to improve performance in loading and fetching data. In
        addition the pool was upgraded so that variables may be
        either string or numeric valued. Both types are supported
        by WRPOOL.

-    SPICELIB Version 5.0.0, 22-AUG-1990 (NJB)

        Increased value of parameter MAXVAL to 5000 to accommodate
        storage of SCLK coefficients in the kernel pool.

-    SPICELIB Version 4.0.0, 12-JUN-1990 (IMU)

        All entry points except POOL and CLPOOL now initialize the
        pool if it has not been done yet.

-    SPICELIB Version 3.0.0, 23-OCT-1989 (HAN)

        Added declaration of FAILED. FAILED is checked in the
        DO-loops in LDPOOL and WRPOOL to prevent infinite looping.

-    SPICELIB Version 1.2.0, 09-MAR-1989 (HAN)

        Parameters BEGDAT and BEGTXT have been moved into the
        $Declarations section.

-    SPICELIB Version 1.1.0, 16-FEB-1989 (IMU) (NJB)

        Parameters MAXVAR, MAXVAL, MAXLEN moved into $Declarations.
        (Actually, MAXLEN was implicitly 32 characters, and has only
        now been made an explicit---and changeable---limit.)

        Declaration of unused function FAILED removed.

-    SPICELIB Version 1.0.0, 08-JAN-1989 (IMU)

§Revisions

-    SPICELIB Version 8.0.0, 04-JUN-1999 (WLT)

        Added the entry points PCPOOL, PDPOOL and PIPOOL to allow
        direct insertion of data into the kernel pool without having
        to read an external file.

        Added the interface LMPOOL that allows SPICE
        programs to load text kernels directly from memory
        instead of requiring a text file.

        Added the entry point SZPOOL to return kernel pool definition
        parameters.

        Added the entry point DVPOOL to allow the removal of a variable
        from the kernel pool.

        Added the entry point GNPOOL to allow users to determine
        variables that are present in the kernel pool

-    SPICELIB Version 7.0.0, 20-SEP-1995 (WLT)

        The implementation of the kernel pool was completely redone
        to improve performance in loading and fetching data. In
        addition the pool was upgraded so that variables may be
        either string or numeric valued.

        The basic data structure used to maintain the list of
        variable names and values was replaced with a hash table
        implementation. Data and names are accessed by means
        of a hash function and linked lists of pointers to existing
        variable names and data values.

-    SPICELIB Version 5.0.0, 22-AUG-1990 (NJB)

        Increased value of parameter MAXVAL to 5000 to accommodate
        storage of SCLK coefficients in the kernel pool.

-    SPICELIB Version 4.0.0, 12-JUN-1990 (IMU)

        All entry points except POOL and CLPOOL now initialize the
        pool if it has not been done yet.

-    SPICELIB Version 3.0.0, 23-OCT-1989 (HAN)

        Added declaration of FAILED. FAILED is checked in the
        DO-loops in LDPOOL and WRPOOL to prevent infinite looping.

-    SPICELIB Version 2.0.0, 18-OCT-1989 (RET)

       A FAILED test was inserted into the control of the DO-loop which
       reads in each kernel variable.

       Previously, if the error action 'RETURN' had been set by a
       calling program, and the call to RDKNEW by LDPOOL failed,
       then execution would continue through LDPOOL, with SPICELIB
       routines returning upon entry. This meant that the routine
       RDKVAR never got a chance to set the EOF flag, which was the
       only control of the DO-loop. An infinite loop resulted in such
       cases. The FAILED test resolves that situation.

-    SPICELIB Version 1.2.0, 9-MAR-1989 (HAN)

        Parameters BEGDAT and BEGTXT have been moved into the
        $Declarations section.

-    SPICELIB Version 1.1.0, 16-FEB-1989 (IMU) (NJB)

        Parameters MAXVAR, MAXVAL, MAXLEN moved into $Declarations.
        (Actually, MAXLEN was implicitly 32 characters, and has only
        now been made an explicit---and changeable---limit.)

        Declaration of unused function FAILED removed.