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_dafopw

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


Abstract


   CSPICE_DAFOPW opens a DAF for subsequent write requests.

I/O


   Given:

      fname    the scalar string name of a DAF to open for read/write access.

               help, fname
                  STRING = Scalar

   the call:

      cspice_dafopw, fname, handle

   returns:

      handle   scalar integer value other DAF routines use to refer to `fname'.

               help, handle
                  LONG = Scalar

Parameters


   None.

Examples


   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) Delete the entire comment area of a DAF file. Note that this
      action should only be performed if fresh new comments are to
      be placed within the DAF file.

      Use the SPK kernel below as input DAF file for the program.

         earthstns_itrf93_201023.bsp


      Example code begins here.


      PRO dafopw_ex1

         ;;
         ;; Local parameters
         ;;
         KERNEL = 'earthstns_itrf93_201023.bsp'
         BUFFSZ = 10
         LINLEN = 1000

         ;;
         ;; Open a DAF for write. Return a `handle' referring to the
         ;; file.
         ;;
         cspice_dafopw, KERNEL, handle

         ;;
         ;; Print the first 10 lines of comments from the DAF file.
         ;;
         print, 'Comment area of input DAF file (max. 10 lines): '
         print, '-------------------------------' +                          $
                '-------------------------------'

         cspice_dafec, handle, BUFFSZ, LINLEN, n, buffer, done

         for i=0, n - 1L do begin
            print, buffer[i]
         endfor

         print, '-------------------------------' +                          $
                '-------------------------------'
         print, ' '
         print, 'Deleting entire comment area...'

         ;;
         ;; Delete all the comments from the DAF file.
         ;;
         cspice_dafdc, handle

         ;;
         ;; Close the DAF file and re-open it for read
         ;; access to work around the cspice_dafec restriction
         ;; on comments not to be modified while they are
         ;; being extracted.
         ;;
         cspice_dafcls, handle

         cspice_dafopr, KERNEL, handle

         ;;
         ;; Check if the comments have indeed been deleted.
         ;;
         cspice_dafec, handle, BUFFSZ, LINLEN, n, buffer, done

         if ( ( done ) and ( n eq 0 ) ) then begin
            print, ' '
            print, '   Successful operation.'
         endif else begin
            print, ' '
            print, '   Operation failed.'
         endelse

         ;;
         ;; Safely close the DAF.
         ;;
         cspice_dafcls, handle

      END


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


      Comment area of input DAF file (max. 10 lines):
      --------------------------------------------------------------

         SPK for DSN Station Locations
         =====================================================================

         Original file name:                   earthstns_itrf93_201023.bsp
         Creation date:                        2020 October 28 12:30
         Created by:                           Nat Bachman  (NAIF/JPL)


         Introduction
      --------------------------------------------------------------

      Deleting entire comment area...

         Successful operation.


Particulars


   Most DAFs require only read access. If you do not need to
   change the contents of a file, you should open it with cspice_dafopr.
   Use cspice_dafopw when you need to

      -- change (update) one or more summaries, names, or
         arrays within a file; or

      -- add new arrays to a file.

   Use cspice_dafcls to close files opened by this routine.

Exceptions


   1)  If the specified file has already been opened, either by the
       DAF routines or by other code, an error is signaled by a
       routine in the call tree of this routine. Note that this
       response is not paralleled by cspice_dafopr, which allows you to open
       a DAF for reading even if it is already open for reading.

   2)  If the specified file cannot be opened without exceeding the
       maximum number of files, the error SPICE(DAFFTFULL) is
       signaled by a routine in the call tree of this routine.

   3)  If the attempt to read the file's file record fails, the error
       SPICE(FILEREADFAILED) is signaled by a routine in the call
       tree of this routine.

   4)  If the specified file is not a DAF file, an error is signaled
       by a routine in the call tree of this routine.

   5)  If no logical units are available, an error is signaled by a
       routine in the call tree of this routine.

   6)  If the file does not exist, an error is signaled by a routine
       in the call tree of this routine.

   7)  If an I/O error occurs in the process of opening the file, the
       error is signaled by a routine in the call tree of this
       routine.

   8)  If the file name is blank or otherwise inappropriate, an error
       is signaled by a routine in the call tree of this routine.

   9)  If the file was transferred improperly via FTP, an error is
       signaled by a routine in the call tree of this routine.

   10) If the file utilizes a non-native binary file format, an error
       is signaled by a routine in the call tree of this routine.

   11) If the input argument `fname' is undefined, an error is
       signaled by the IDL error handling system.

   12) 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 Icy interface.

   13) If the output argument `handle' is not a named variable, an
       error is signaled by the Icy interface.

Files


   See argument `fname'.

Restrictions


   1)  Only files of the native binary file format may be opened
       with this routine.

   2)  Files opened using this routine must be closed with cspice_dafcls.

Required_Reading


   DAF.REQ
   ICY.REQ

Literature_References


   None.

Author_and_Institution


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

Version


   -Icy Version 1.0.2, 25-NOV-2021 (JDR)

       Edited the header to comply with NAIF standard. Added complete
       code example.

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

       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.1, 13-SEP-2012 (EDW)

       Edits and clean up to header text.

   -Icy Version 1.0.0, 08-DEC-2004 (EDW)

Index_Entries


   open existing DAF for write



Fri Dec 31 18:43:02 2021