Note this version of the IDL tools are designed to be run standalone
only. If you have SSW installed and you have run the SSW startup, then
the codes here will likely not work. A version of READ_DKIST.PRO to
run under SSW is being created.

Any questions should be sent to Alisdair Davey (adavey@nso.edu)
-------------------------------------------------------------------------------
READ_DKIST.PRO will work with both ViSP and VBI data 

To make this work you will need to first set one environment variable

Either

tcsh
# setenv SSW_ONTOLOGY PATH_TO_THIS_DIRECTORY

or bash
# export SSW_ONTOLOGY="PATH_TO_THIS_DIRECTORY"

e.g. in tcsh

# setenv SSW_ONTOLOGY /Users/ard/DKIST/dkist_idl

Then 

# idl

IDL> file = 'VISP_2022_07_09T19_32_33_519_00630205_I_AGNPG_L1.fits'
IDL> read_dkist, file, index, data, /uncomp_delete                 
VISP_2022_07_09T19_32_33_519_00630205_I_AGNPG_L1.fits
 ---------------------------------------------------------------------
| Uncompressing to> /var/folders/jr/8cm_h72d0y3857d9hhgbrvrr0000gn/T/ |
 ---------------------------------------------------------------------
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| VISP_2022_07_09T19_32_33_519_00630205_I_AGNPG_L1.fits -> /var/folders/jr/8cm_h72d0y3857d9hhgbrvrr0000gn/T/VISP_2022_07_09T19_32_33_519_00630205_I_AGNPG_L1_uncomp.fits |
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/var/folders/jr/8cm_h72d0y3857d9hhgbrvrr0000gn/T/VISP_2022_07_09T19_32_33_519_00630205_I_AGNPG_L1_uncomp.fits
 -------------------------------------------
| Removing uncompressed versions on request |
 -------------------------------------------                   

IDL> help, index, data
INDEX           STRUCT    = -> <Anonymous> Array[1]
DATA            DOUBLE    = Array[2556, 977]

IDL> help, index, /str
** Structure <6a071e08>, 262 tags, length=6128, data length=6036, refs=1:
   SIMPLE          INT              1
   BITPIX          LONG               -64
   NAXIS           LONG                 3
   NAXIS1          LONG              2556
   NAXIS2          LONG               977
   NAXIS3          LONG                 1
   EXTEND          INT              1
   ZQUANTIZ        STRING    'NO_DITHER'
   BUNIT           STRING    'ct'
   DATE            STRING    '2023-03-10T05:51:03.592'
   DATE_D$BEG      STRING    '2022-07-09T19:32:33.519'
   DATE_D$END      STRING    '2022-07-09T19:32:33.851'
   TELAPSE         DOUBLE          0.33200006
   DATE_D$AVG      STRING    '2022-07-09T19:32:33.685000'
   ORIGIN          STRING    'National Solar Observatory'
   TELESCOP        STRING    'Daniel K. Inouye Solar Telescope'
   OBSRVTRY        STRING    'Haleakala High Altitude Observatory Si'...
   NETWORK         STRING    'NSF-DKIST'
   INSTRUME        STRING    'VISP'
   OBJECT          STRING    'unknown'
                   < Press Spacebar to continue, ? for help >
etc...

You are strongly recommended to use the /UNCOMP_DELETE flag when
reading DKIST data.
    
Similarly for VBI data

IDL> read_dkist, file, index, data, /use_shared_lib, /uncomp_Delete
VBI_2022_06_03T20_02_53_753_00430500_I_ADQVB_L1.fits
 --------------------------------------------------------------
| reading VBI_2022_06_03T20_02_53_753_00430500_I_ADQVB_L1.fits |
 --------------------------------------------------------------
% Compiled module: FITSIO_READ_IMAGE.

In order to make READ_DKIST working with the VBI data you will need to
specofy the /USE_SHARED_LIB option.


READ_DKIST is based upon READ_SDO with a number of SDO specific features removed. Additional tidying up and make the code more DKIST instrument specific remains to be done.