Document title: IDL program NACS_READ_DE.PRO for NDADS DE datatype NACS
Project: DE
NDADS Datatype: NACS
EID: SOFTWARE
Super-EID: SOFTWARE
There may be other documents also identified by this super-EID.
NDADS filename: NACS_READ_DE.PRO
TRF entry: b48490.pro in NSSDC's controlled digital document library, Mar. 1999.
Document text follows:
----------------------

pro read_nacs

;NAME:
;       READ_NACS
;PURPOSE:
;       To read a VAX unformatted seqential data file of MAF ambient densities
;       from the Dynamics Explorer B, Neutral Atmosphere Composition
;       Spectrometer (NACS).  The file originally had variable length records
;       with a maximum length of 26 bytes.  They were changed to 28 byte fixed
;       length records so that they could be read on UNIX machines.
;INPUT: 
;       The program prompts the user for the name of a DE NACS unformatted
;       data file.  The format of the data file name is Nydddsssc.dat.
;OUTPUT:
;       The program creates an ASCII version of the unformatted data file
;       and calls it Nydddsssc.asc.
;SUBROUTINES CALLED:
;       CON_VAX_UNIX - This routine converts the data, which was written on
;                      a VAX machine, from VAX data types to UNIX data types
;                      when the program is run on UNIX machines.
;RECORD STRUCTURE:
;       1) bytes 1-4  - Bytes 1 and 2 were added when the file was changed from
;                       variable to fixed length records.  Bytes 3 and 4 were
;                       added by FORTRAN when the unformatted file was written.
;                       They are read as a long and ignored.
;       2) bytes 5-8  - These bytes represent the time and are read as a long.
;       3) bytes 9-28 - These bytes represent the five densities.  Each
;                       density contains four bytes that are read as a
;                       floating-point.  The lower 8 bits of each 4-byte
;                       density are read as an integer, converted to a real,
;                       and divided by two.  The resulting value is the percent
;                       error of the density.
;MODIFICATION HISTORY:
;       Karen Horrocks, April, 1995

datafile = ''
outfile = ''
read, datafile, prompt='Enter data file name: '
outfile = datafile
n = strlen(outfile)
strput, outfile, 'asc', (n-3)
openr, 1, datafile
openw, 2, outfile
printf, 2, 'Format'
printf, 2
printf, 2, 'Time(milliseconds)  Density1  Density2  Density3  Density4  Density5 (#/cm*3)'
printf, 2, '                    % error1  % error2  % error3  % error4  % error5'
printf, 2
printf, 2, 'Density1 - Atomic Oxygen'
printf, 2, 'Density2 - Molecular Nitrogen'
printf, 2, 'Density3 - Helium'
printf, 2, 'Density4 - Atomic Nitrogen'
printf, 2, 'Density5 - Argon'
printf, 2 
while(not eof(1)) do begin
  a = {nacs, integ: make_array(2, /long), real: fltarr(5, /nozero)}
  b = bytarr(4, 7)
  readu, 1, a
  a = conv_vax_unix(a)
  point_lun, -1, pos
  point_lun, 1, pos-28
  readu, 1, b
  printf, 2, a.integ(1), a.real
  printf, 2, '            ', float(b(2, 2))/2, float(b(2, 3))/2, float(b(2, 4))/2, float(b(2, 5))/2, float(b(2, 6))/2
end
close, 1
close, 2
end