Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_dskcls

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_DSKCLS closes a DSK file opened for read or write.

I/O


   Given:

      handle   the file handle for an open DSK file.

               help, handle
                  LONG = Scalar

      optmiz   is a logical flag indicating whether the DSK should be
               segregated before it is closed.

               help, optmiz
                  BOOLEAN = Scalar

               This option applies only to files open for write access. The
               value of `optmiz' has no effect for files opened for read
               access.

   the call:

      cspice_dskcls, handle, optmiz

   returns:

   The routine closes the file indicated by `handle'. The close operation
   tests the file to ensure the presence of data segments.

Parameters


   None.

Examples


   Any numerical results shown for these examples may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Create a three-segment DSK file using plate model data for
      Phobos. Use latitudinal, rectangular, and planetodetic
      coordinates in the respective segments. This is not a
      realistic example, but it serves to demonstrate use of
      the supported coordinate systems.

      Use the DSK kernel below to provide, for simplicity, the input
      plate and vertices data. This file has one segment only.

         phobos_3_3.bds


      Example code begins here.


      PRO dskcls_ex1

         ;;
         ;; IcyUser globally defines DSK parameters.
         ;; For more information, please see IcyUser.pro and
         ;; IcyDSK.pro.
         ;;
         @IcyUser

         SPICETRUE = 1L
         NSEG = 3

         cornam = [ 'radius', 'Z-coordinate', 'Z-coordinate', 'altitude']

         ;;
         ;; Assign names of input and output DSK files.
         ;;
         indsk = 'phobos_3_3.bds'
         dsk   = 'phobos_3_3_3seg.bds'

         if ( cspice_exists(dsk) ) then begin
            file_delete, dsk
         endif


         ;;
         ;; Open input DSK for read access; find first segment.
         ;;
         cspice_dasopr, indsk, inhan
         cspice_dlabfs, inhan, dladsc, found


         ;;
         ;; Fetch vertices and plates from input DSK file.
         ;;
         ;; Note that vertex and plate indices are 1-based.
         ;;
         print, 'Reading input data...'

         cspice_dskv02, inhan, dladsc, 1, SPICE_DSK02_MAXVRT, vrtces
         cspice_dskp02, inhan, dladsc, 1, SPICE_DSK02_MAXPLT, plates

         print, 'Done.'


         ;;
         ;; Set input array sizes required by cspice_dskmi2.
         ;;
         voxpsz = SPICE_DSK02_MAXVXP
         voxlsz = SPICE_DSK02_MXNVLS
         worksz = SPICE_DSK02_MAXCEL
         spaisz = SPICE_DSK02_SPAISZ
         makvtl = SPICETRUE

         ;;
         ;; Set fine and coarse voxel scales. (These usually
         ;; need to determined by experimentation.)
         ;;
         finscl = 5.D
         corscl = 4

         ;;
         ;; Open a new DSK file.
         ;;
         cspice_dskopn, dsk, dsk, 0, handle

         for segno=1, NSEG do begin

            ;;
            ;; Create spatial index. We won't generate a
            ;; vertex-plate mapping, so we set the flag
            ;; for creating this map to "false."
            ;;
            print, 'Creating segment ', segno
            print, 'Creating spatial index...'

            cspice_dskmi2, vrtces, plates, finscl, corscl, $
                           worksz, voxpsz, voxlsz, makvtl, $
                           spaisz, spaixd, spaixi


            print, 'Done.'

            ;;
            ;; Set up inputs describing segment attributes:
            ;;
            ;; - Central body: Phobos
            ;; - Surface ID code: user's choice.
            ;;   We use the segment number here.
            ;; - Data class: general (arbitrary) shape
            ;; - Body-fixed reference frame
            ;; - Time coverage bounds (TBD)
            ;;
            center = 401
            surfid = segno
            dclass = SPICE_DSK_GENCLS
            frame  = 'IAU_PHOBOS'

            first = -50.D * cspice_jyear()
            last  =  50.D * cspice_jyear()


            ;;
            ;; Set the coordinate system and coordinate system
            ;; bounds based on the segment index.
            ;;
            ;; Zero out the coordinate parameters to start.
            ;;
            corpar = dblarr(SPICE_DSK_NSYPAR)

            case segno of

               1 : begin

                  ;;
                  ;; Use planetocentric latitudinal coordinates. Set
                  ;; the longitude and latitude bounds.
                  ;;
                  corsys = SPICE_DSK_LATSYS

                  mncor1 = -cspice_pi()
                  mxcor1 =  cspice_pi()
                  mncor2 = -cspice_halfpi()
                  mxcor2 =  cspice_halfpi()

                  end

               2 : begin

                  ;;
                  ;; Use rectangular coordinates. Set the
                  ;; X and Y bounds.
                  ;;
                  ;; The bounds shown here were derived from
                  ;; the plate data. They lie slightly outside
                  ;; of the range spanned by the plates.
                  ;;
                  corsys = SPICE_DSK_RECSYS

                  mncor1 = -1.3D
                  mxcor1 =  1.31D
                  mncor2 = -1.21D
                  mxcor2 =  1.2D

                  end

               3 : begin

                  ;;
                  ;; Set the coordinate system to planetodetic.
                  ;;
                  corsys    = SPICE_DSK_PDTSYS

                  mncor1    = -cspice_pi()
                  mxcor1    =  cspice_pi()
                  mncor2    = -cspice_halfpi()
                  mxcor2    =  cspice_halfpi()

                  ;;
                  ;; We'll use equatorial and polar radii from
                  ;; pck00010.tpc. These normally would be fetched
                  ;; at run time, but for simplicity, we'll use
                  ;; hard-coded values.
                  ;;
                  re        = 13.D0
                  rp        =  9.1D
                  f         = ( re - rp ) / re

                  corpar = [ re, f ]

                  end

               else: message, 'Icy(BUG)'

            endcase

           ;;
           ;; Compute plate model radius bounds.
           ;;
           print, 'Computing ' + cornam[corsys-1] +' bounds of plate set...'

           cspice_dskrb2, vrtces, plates, corsys, corpar, mncor3, mxcor3

           print, 'Done.'

           ;;
           ;; Write the segment to the file.
           ;;
           print, 'Writing segment...'

           cspice_dskw02, handle, $
                          center, $
                          surfid, $
                          dclass, $
                          frame,  $
                          corsys, $
                          corpar, $
                          mncor1, $
                          mxcor1, $
                          mncor2, $
                          mxcor2, $
                          mncor3, $
                          mxcor3, $
                          first,  $
                          last,   $
                          vrtces, $
                          plates, $
                          spaixd, $
                          spaixi

         end

         ;;
         ;; Close the input DSK.
         ;;
         cspice_dskcls, handle, SPICETRUE
         cspice_dascls, inhan

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Reading input data...
      Done.
      Creating segment        1
      Creating spatial index...
      Done.
      Computing radius bounds of plate set...
      Done.
      Writing segment...
      Creating segment        2
      Creating spatial index...
      Done.
      Computing Z-coordinate bounds of plate set...
      Done.
      Writing segment...
      Creating segment        3
      Creating spatial index...
      Done.
      Computing altitude bounds of plate set...
      Done.
      Writing segment...


      Note that after run completion, a new DSK exists in the output
      directory.

   2) Close a new DSK file using DAS segregation. `handle'
      is the DAS file handle of the DSK.

      This is the normal choice for DSK creation.

         cspice_dskcls, HANDLE, SPICETRUE

   3) Close a new DSK file without using DAS segregation. The
      close operation will be fast, but reading the file will be
      less efficient than if the file had been segregated.

         cspice_dskcls, HANDLE, SPICEFALSE

   4) Close an existing DSK file that had been opened
      for read access. In this case `optmiz' is ignored:

         cspice_dskcls, HANDLE, SPICETRUE

      or

         cspice_dskcls, HANDLE, SPICEFALSE

Particulars


   A cspice_dskcls call should balance every cspice_dskopn call.

   This routine provides a DSK-level interface for closing DSK files.

   In cases where DSKs opened for write access are to be closed
   without segregation, this interface is slightly simpler than that
   available at the DAS level.

Exceptions


   1)  If an error occurs when the file is closed, the error is
       signaled by a routine in the call tree of this routine.

   2)  If any of the input arguments, `handle' or `optmiz', is
       undefined, an error is signaled by the IDL error handling
       system.

   3)  If any of the input arguments, `handle' or `optmiz', is not of
       the expected type, or it does not have the expected dimensions
       and size, an error is signaled by the Icy interface.

Files


   See argument `handle'.

Restrictions


   1)  This routine should not be called by user applications that have
       loaded a DSK file via cspice_furnsh. Such applications should call
       the KEEPER routines cspice_unload or cspice_kclear instead.

Required_Reading


   ICY.REQ
   DAS.REQ
   DSK.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   M. Liukis           (JPL)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.1.0, 05-DEC-2021 (JDR)

       Changed input argument name "optimz" to "optmiz" for consistency
       with other routines.

       Edited the -Examples section to comply with NAIF standard.

       Extended -Particulars section.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       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, 13-DEC-2016 (ML) (EDW)

Index_Entries


   close a DSK file



Fri Dec 31 18:43:03 2021