Table of contents
CSPICE_DASHFS returns a file summary for a specified DAS file.
Given:
handle the handle of a previously opened DAS file.
help, handle
LONG = Scalar
The file may be open for read or write access.
the call:
cspice_dashfs, handle, nresvr, nresvc, ncomr, ncomc, $
free, lastla, lastrc, lastwd
returns:
nresvr the number of reserved records in a specified DAS file.
help, nresvr
LONG = Scalar
nresvc the number of characters in use in the reserved record area
of a specified DAS file.
help, nresvc
LONG = Scalar
ncomr the number of comment records in a specified DAS file.
help, ncomr
LONG = Scalar
ncomc the number of characters in use in the comment area of a
specified DAS file.
help, ncomc
LONG = Scalar
free the 1-based record number of the first free record in a
specified DAS file.
help, free
LONG = Scalar
lastla an array containing the highest current 1-based logical
addresses, in the specified DAS file, of data of character,
double precision, and integer types, in that order.
help, lastla
LONG = Array[3]
lastrc an array containing the 1-based record numbers, in the
specified DAS file, of the directory records containing the
current last descriptors of clusters of character, double
precision, and integer data records, in that order.
help, lastrc
LONG = Array[3]
lastwd an array containing the 1-based word indices, within the
respective descriptor records identified by the elements of
`lastrc', of the current last descriptors of clusters of
character, double precision, and integer data records, in
that order.
help, lastwd
LONG = Array[3]
See parameter definitions file SpiceDAS.h for declarations and
descriptions of parameters used throughout the DAS system.
SPICE_DAS_CHARDT,
SPICE_DAS_DPDT,
SPICE_DAS_INTDT
are data type specifiers that indicate CHARACTER, DOUBLE,
and LONG respectively. These parameters are used in all DAS
routines that require a data type specifier.
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) Create a DAS file containing 10 integers, 5 double precision
numbers, and 4 characters. Print the summary of the file and
dump its contents.
Example code begins here.
PRO dashfs_ex1
;;
;; IcyUser is a file that makes certain variables global.
;; You must call IcyUser to have access to the parameters used
;; in this example.
;;
;; To use the variables in IcyUser, add the 'src/icy' directory
;; to your IDL path by doing the following in which /path/to is the
;; local path to Icy.
;;
;; pref_set, 'IDL_PATH', '/path/to/icy/src/icy:<IDL_DEFAULT>', $
;; /COMMIT
;;
@IcyUser
;;
;; Local parameters.
;;
FNAME = 'dashfs_ex1.das'
LINLEN = 2L
;;
;; Open a new DAS file. Reserve no records for comments.
;;
type = 'TEST'
ifname = 'TEST.DAS/NAIF/NJB/11-NOV-1992-20:12:20'
cspice_dasonw, FNAME, type, ifname, 0L, handle
;;
;; Obtain the file summary.
;;
cspice_dashfs, handle, nresvr, nresvc, $
ncomr, ncomc, free, $
lastla, lastrc, lastwd
;;
;; Print the summary of the new file.
;;
print, 'Summary before adding data:'
print, ' Number of reserved records :', nresvr
print, ' Characters in reserved records :', nresvc
print, ' Number of comment records :', ncomr
print, ' Characters in comment area :', ncomc
print, ' Number of first free record :', free
print, ' Last logical character address :', lastla[SPICE_DAS_CHARDT]
print, ' Last logical d.p. address :', lastla[SPICE_DAS_DPDT]
print, ' Last logical integer address :', lastla[SPICE_DAS_INTDT]
print, ' Last character descriptor :', lastrc[SPICE_DAS_CHARDT]
print, ' Last d.p descriptor :', lastrc[SPICE_DAS_DPDT]
print, ' Last integer descriptor :', lastrc[SPICE_DAS_INTDT]
print, ' Character word position in desc:', lastwd[SPICE_DAS_CHARDT]
print, ' d.p. word position in desc :', lastwd[SPICE_DAS_DPDT]
print, ' Integer word position in desc :', lastwd[SPICE_DAS_INTDT]
print
;;
;; Add the data.
;;
for i=1L, 10L do begin
cspice_dasadi, handle, [i]
endfor
for i=1L, 5L do begin
cspice_dasadd, handle, [DOUBLE( i )]
endfor
;;
;; Add character data to the file. DAS character data are
;; treated as a character array, not as a string. The
;; following call adds only the first 4 characters to the
;; DAS file.
;;
cspice_dasadc, handle, 4L, 0, 3, BYTE( 'SPUDWXY' )
;;
;; Close the file and open it for reading.
;;
cspice_dascls, handle
cspice_dasopr, FNAME, handle
;;
;; Obtain again the file summary.
;;
cspice_dashfs, handle, nresvr, nresvc, $
ncomr, ncomc, free, $
lastla, lastrc, lastwd
print, 'Summary after adding data:'
print, ' Number of reserved records :', nresvr
print, ' Characters in reserved records :', nresvc
print, ' Number of comment records :', ncomr
print, ' Characters in comment area :', ncomc
print, ' Number of first free record :', free
print, ' Last logical character address :', lastla[SPICE_DAS_CHARDT]
print, ' Last logical d.p. address :', lastla[SPICE_DAS_DPDT]
print, ' Last logical integer address :', lastla[SPICE_DAS_INTDT]
print, ' Last character descriptor :', lastrc[SPICE_DAS_CHARDT]
print, ' Last d.p descriptor :', lastrc[SPICE_DAS_DPDT]
print, ' Last integer descriptor :', lastrc[SPICE_DAS_INTDT]
print, ' Character word position in desc:', lastwd[SPICE_DAS_CHARDT]
print, ' d.p. word position in desc :', lastwd[SPICE_DAS_DPDT]
print, ' Integer word position in desc :', lastwd[SPICE_DAS_INTDT]
print
;;
;; Read the integers and dump them.
;;
print, 'Integer data in the DAS file:'
for i=1L, lastla[SPICE_DAS_INTDT] do begin
cspice_dasrdi, handle, i, i, n
print, ' ', n
endfor
;;
;; Now the d.p. numbers:
;;
print
print, 'Double precision data in the DAS file:'
for i=1L, lastla[SPICE_DAS_DPDT] do begin
cspice_dasrdd, handle, i, i, x
print, ' ', x
endfor
;;
;; Now the characters. In this case, we read the
;; data one line at a time.
;;
first = 0L
last = 0L
remain = lastla[SPICE_DAS_CHARDT]
print
print, 'Character data in the DAS file:'
while ( remain gt 0L ) do begin
line = bytarr( LINLEN )
nread = MIN ( [LINLEN, remain] )
first = last + 1L
last = last + nread
cspice_dasrdc, handle, first, last, 0L, nread-1, line
print, ' ', STRING(line[0:nread-1])
remain = remain - nread
endwhile
;;
;; Close the file.
;;
cspice_dascls, handle
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Summary before adding data:
Number of reserved records : 0
Characters in reserved records : 0
Number of comment records : 0
Characters in comment area : 0
Number of first free record : 3
Last logical character address : 0
Last logical d.p. address : 0
Last logical integer address : 0
Last character descriptor : 0
Last d.p descriptor : 0
Last integer descriptor : 0
Character word position in desc: 0
d.p. word position in desc : 0
Integer word position in desc : 0
Summary after adding data:
Number of reserved records : 0
Characters in reserved records : 0
Number of comment records : 0
Characters in comment area : 0
Number of first free record : 6
Last logical character address : 4
Last logical d.p. address : 5
Last logical integer address : 10
Last character descriptor : 2
Last d.p descriptor : 2
Last integer descriptor : 2
Character word position in desc: 10
d.p. word position in desc : 11
Integer word position in desc : 12
Integer data in the DAS file:
1
2
3
4
5
6
7
8
9
10
Double precision data in the DAS file:
1.0000000
2.0000000
3.0000000
4.0000000
5.0000000
Character data in the DAS file:
SP
UD
Note that after run completion, a new DAS file exists in the
output directory.
The quantities
nresvr
nresvc
ncomr
ncomc
free
lastla
lastrc
lastwd
define the "state" of a DAS file, and in particular the state of
the directory structure of the file. This information is needed by
other DAS routines, but application programs will usually have no
need for it. The one exception is the array of "last" logical
addresses `lastla': these addresses indicate how many words of data
of each type are contained in the specified DAS file. The elements
of `lastla' can be conveniently retrieved by calling cspice_daslla.
1) If the specified handle does not belong to any file that is
currently known to be open, the error SPICE(DASNOSUCHHANDLE)
is signaled by a routine in the call tree of this routine.
2) If the input argument `handle' is undefined, an error is
signaled by the IDL error handling system.
3) If the input argument `handle' is not of the expected type, or
it does not have the expected dimensions and size, an error is
signaled by the Icy interface.
4) If any of the output arguments, `nresvr', `nresvc', `ncomr',
`ncomc', `free', `lastla', `lastrc' or `lastwd', is not a
named variable, an error is signaled by the Icy interface.
None.
None.
DAS.REQ
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
-Icy Version 1.0.0, 16-JUL-2021 (JDR)
return the file summary of a DAS file
find the amount of data in a DAS file
|