2.  General Yohkoh Software

2.1  Routines for Reading and Saving Data

2.1.1 RD_XDA, RD_xxx

The RD_xxx routines (RD_BDA, RD_HDA, RD_SDA, RD_WDA, RD_XDA) allow you to read the reformatted data files. Each routine has the same calling sequence, and there is a generic reading routine called RD_XDA which will read data for any of the instruments. After you have established the input file name(s) (infil) and which data sets to extract (dset_arr), you can read the data by a command:
IDL >  rd_sda, infil, dset_arr, index, data

IDL >  rd_sda, infil, dset_arr, index, data, roadmap

IDL >  rd_xda, infil, -1, index, /nodata
index is a structure which describes the data. There is one index structure for each dataset. The roadmap is for all datasets in the files (not just the selected datasets). It is possible to read all datasets in the file by specifying -1 for dset_arr. The /nodata switch tells the routine to only read the index and roadmap, not the data.

2.1.2 RD_ROADMAP

RD_ROADMAP will read the roadmap from a file (or list of files) by typing:
IDL >  rd_roadmap,infil,roadmap,ndset
where infil is a string array of file names. The roadmap variable is the same as you get from YODAT

2.1.3 RD_QS

RD_QS will read the quasi-static portion of a single reformatted file. A sample calling sequence is:
IDL >  rd_qs, infil, qs

2.1.4 SAVEGEN and RESTGEN

Details on SAVEGEN and RESTGEN are given in the SolarSoft Reference Manual. NOTE: It is recommended to use SAV_SDA, SAV_BDA, SAV_BSC, and SAV_HXI whenever possible for standard SXT, BCS, and HXI data sets.

2.1.5 SAV_SDA

SDA_SDA will store an index and data array in an SDA format file. The data array can be byte, integer*2, integer*4 or real*4. The dimensions of the image do not have to be the original dimensions. A sample is:
IDL >  sav_sda, outfil, index, data

IDL >  sav_sda, outfil, index, data, qs
where outfil is the name of the file you wish to store the data in. If you wish to append to an existing file, then you can use the /APPEND switch. For example:
IDL >  sav_sda, outfil, index, data, /append
Use RD_SDA to restore the data.

2.1.6 SAV_BDA and SAV_BSC

SAV_BDA and SAV_BSC work in the same manner as SAV_SDA but for raw BDA data or BSC processed data. Sample calls would be:
IDL >  sav_bda, outfil, index, data, qs, dp_sync

IDL >  sav_bsc, outfil, index, data

2.1.7 SAV_HXI

SAV_HXI allows you to save HXT synthesized images. A sample call would be:
IDL >  sav_hxi, outfil, index, data

2.1.8 SXT2FITS

It is possible to take an SXT data file or an index and data that has already been read in, and write a single FITS file for each image. The FITS header has all of the information on the date and time, the filters used, the exposure duration, the resolution, and the DP mode and rate. The following command will create a file for each image in the data array:
IDL >  sxt2fits, index, data
The default file names are SF_FITSyymmdd.hhmmss and SP_FITSyymmdd.hhmmss for FFI and PFI images, respectively. If a single output file name is passed to the SXT2FITS routine, but there are several images to save, then it will append an image number to the end of the file name. In the following example, the input array is 512×512×3, so it will create the files `flare.0001', `flare.0002' and `flare.0003'.
IDL >  sxt2fits, index, data, outfil='flare'
It is possible to specify an input file name in which case all images in that file will have FITS files created. It is also possible to specify a list of the images to be saved. Some examples of these calls are:
IDL >  sxt2fits, index, data, ss=ss

IDL >  sxt2fits, infil=infil

IDL >  sxt2fits, infil=infil, ss=ss

2.2  Routines for Data Selection

2.2.1 TIM2DSET

TIM2DSET will take the roadmap and return the dataset number which is closest to that time. Examples,
IDL >  dset = tim2dset(roadmap, input_times)

IDL >  dset = tim2dset(roadmap, '23-jun-92 6:00')

2.3  Routines for Making Time Plots

2.3.1 PLOTY

PLOTY plots light curves from all the Yohkoh instruments on the same plot with the same time axis. If you have the observing log on-line and wish to use it to make the plots, you can specify the plot times. It is recommended to plot no more than approximately 24 hours of data at a time. An example is:
IDL >  ploty, '8-may-92 15:00', '8-may-92 18:40'
If you have identified an instrument file for which you want to see the light curve for all the other instruments, you can use the following command (it assumes that the other instrument data files exist on the same directory as the input file):
IDL >  ploty, infil='/yd5/flares/spr911115.2141'
You can read the observing log data, and the use PLOTY with a command like:
IDL >  rd_obs, '8-may-92', '8-may-92 12:00', bcs, sxtf, sxtp, w_h

IDL >  ploty, bcs, w_h, sxtp, w_h

2.3.2 OBS_PlOT

TODO - needs text

2.4  Routines for Data and Information Extraction

2.4.1 The Concept Behind the GT Routines

A series of GT routines was created so that a single piece of information can be extracted from a structure, whether the structure was a `roadmap' or an `index' (the data are saved in a different location). The routines also allow for conversions to a string mnemonic or to physical units. It is possible to get a list of what the different values are by typing a command like:
IDL >  print, gt_filta()
It is also possible to convert the output value to the string mnemonic by using the /STRING switch. For example:
IDL >  print, gt_filta(roadmap, /string)
This command only works for the routines which return a coded value. A list of all of the GT routines currently available are:

GEN BCS HXT SXT WBS
gt_conv2str gt_blockid gt_sum_h gt_adoor gt_grs1
gt_day gt_bsc_bincal gt_sum_l gt_center gt_grs2
gt_dp_mode gt_bsc_chan gt_sum_m1 gt_comp gt_hxs
gt_dp_rate gt_bsc_crate gt_sum_m2 gt_corner gt_rbmsc
gt_hxa gt_bsc_flux   gt_corner_cmd gt_rbmsd
gt_iru gt_bsc_time   gt_dpe gt_sxs1
gt_tfss gt_bsc_wave   gt_entry gt_sxs2
gt_time gt_total_cnts   gt_expdur  
      gt_explat  
      gt_expmode  
      gt_filta  
      gt_filtb  
      gt_mbe  
      gt_obsregion  
      gt_or_expnum  
      gt_percentd  
      gt_percentover  
      gt_pfi_ffi  
      gt_pix_size  
      gt_res  
      gt_seq_num  
      gt_seq_tab  
      gt_shape  
      gt_shape_cmd  
      gt_ssl_explab  
      gt_sxt_axis  
      gt_sxt_cen  
      gt_sxt_roll  
      gt_temp_ccd  
      gt_temp_hk  

2.4.2 GT_DP_RATE

GT_DP_RATE will extract the information on the DP telemetry rate. The values are shown below.

1 Low ( 1 Kbits/sec)
2 Med ( 4 Kbits/sec)
4 High (32 Kbits/sec)
 


IDL >  dprate = gt_dp_rate(index)

IDL >  dprate = gt_dp_rate(roadmap, /string)

2.4.3 DPRATE2SEC

DPRATE2SEC will take a structure (or an integer value 1, 2 or 4 for low, medium, or high) and return the number of seconds that passes for a major frame at that telemetry rate.

1 64 sec (Low)
2 16 sec (Med)
4 2 sec (High)

IDL >  nsec = dprate2sec(index)

2.4.4 GT_DP_MODE

GT_DP_MODE will extract the information on the DP mode. There are several modes, but the most common are:

9 Flare
11 BCS-OUT
12 Night
13 Quiet
 


IDL >  dpmode = gt_dp_mode(index)

IDL >  dpmode = gt_dp_mode(roadmap, /string)

2.4.5 GET_INFO

GET_INFO will take the roadmap or index structure and return a string describing the main observing mode parameters for each dataset.
IDL >  info_array = get_info(roadmap)
An example for a dataset for SXT data is:

   0 15-NOV-91  22:42:24  FL/H  NaBan/Open  Full Norm C  16   238.0   64x 64
The ``0'' is the image number in the index or roadmap which was passed to GET_INFO, ``15-NOV-91 22:42:24'' is the start date and time of the exposure, ``FL/H'' says the DP was in flare mode in high telemetry rate, ``NaBan/Open'' are the filters, ``Full'' is the pixel resolution, ``Norm'' says it was a normal exposure (not a dark frame), ``C'' is compressed data, ``16 238.0'' is the DP exposure level (DPE) and the expected exposure duration in milliseconds, and ``64x 64'' is the image shape.

An example for a dataset for SXT data when using the /LONG option is:

   0 15-NOV-91  22:42:24  FL/H  NaBan/Open  Full Norm C  16   238.0   64x 64  100%  S13W18   0% SAA  2.6
The first 80 columns are the same as above. The ``100%'' says that all of the image was received from the S/C, ``S13W18'' are the heliocentric coordinates of the PFI, ``0%'' of the image was saturated, ``SAA'' signifies that it was during an South Atlantic Anomaly (SAA) passage, and ``2.6'' is the number of minutes before spacecraft night.

For HXT,WBS and BCS data, the routine only returns the date, time, DP mode and DP rate.

2.5  Routines for Calibration and Analysis

2.5.1 FSP_PROC [*]

FSP_PROC is a general routine for doing spectral fits. detector is a string variable containing the detector name, cfile is the input file name, the format for an input file is given in /ys/ucon/soft/mctiernan/spectral_data_format, ofile is an output file name. tyspec denotes the type of spectrum you want to fit (try doc_library, 'fsp_proc' for a complete list). fit_pars is the structure containing the results. Optional parameters: sc_par is a structure containing spectrometer channel info, ch_dta is a structure containing the data for each channel, pfile is the name for an output plot file, sdel is an array of channels you'd like to delete, flux_corr is any correction to the overall flux you might want to make, nsigmas tells you how many sigmas above background a ``good'' channel will be (default is 3.0), noplot suppresses screen plots.
IDL >  FSP_PROC, detector, cfile, ofile, tyspec, fit_pars

2.5.2 FSP_11 [*]

FSP_11 is a general routine for doing spectral fits. inpf is a strarr containing the detector response filenames, tyspec denotes the type of spectrum you want to fit (try doc_library, 'fsp_11' for a complete list). Data must be put in the proper fields of the structures fit_pars, sc_par and ch_dta. fit_pars is the structure containing the results, sc_par is a structure containing spectrometer channel info, ch_dta is a structure containing the data for each channel. Optional parameters: ofile is the name for an output file, pfile is the name for an output plot file, sdel is an array of channels you'd like to delete, flux_corr is any correction to the overall flux you might want to make, nsigmas tells you how many sigmas above background a ``good'' channel will be (default is 3.0), noplot suppresses screen plots.
IDL >  FSP_11, detector, inpf, tyspec, fit_pars, sc_par, ch_dta

2.6  Routines for Image Alignment

The routines described here can generally be used on SXT or ground-based images.

2.6.1 SXT_PREP

See the description of SXT_PREP on page 5.5.1 for details on aligning SXT images.

2.6.2 Other Routines

See the SolarSoft Reference Manual.

2.7  Accessing Secondary Databases

2.7.1 CONTACTS

CONTACTS will give information on when the ground station contacts are for a given day. The output from the command below is shown.
IDL >  contacts,'2-jun-92'

             Kagoshima Space Center Contacts           Minutes of
                  Starts                   Ends       Day  Ngt  Tot
         JST              (UT)             JST
 2-JUN-92 02:56:14 ( 1-JUN-92 17:56:14)   03:07:14    3.5  7.5 11.0
 2-JUN-92 04:39:59 ( 1-JUN-92 19:39:59)   04:48:59    7.8  1.2  9.0

 2-JUN-92 20:27:14 ( 2-JUN-92 11:27:14)   20:37:14    4.0  6.0 10.0
 2-JUN-92 22:09:14 ( 2-JUN-92 13:09:14)   22:21:14    0.0 12.0 12.0
 2-JUN-92 23:52:29 ( 2-JUN-92 14:52:29)   00:04:14    0.0 11.8 11.8

A blank line is inserted to show that the second set of contacts is for a different series of contacts (they come in clusters of five or six per day). It is possible to get the station contacts times for DSN stations by using the /CANBERRA, /GOLDSTONE or /MADRID switches. It is possible to specify an end time and output files in the following example:
IDL >  contacts, '1-jun-92', '10-jun-92', outfil='contacts.txt'

2.7.2 PR_FEM

PR_FEM will print out Yohkoh's day and night events by typing:
IDL >  pr_fem, '1-jan'

2.7.3 PR_EVN

PR_EVN helps you find when there is Yohkoh data available. An event is driven by a change between QUIET and FLARE mode, or when there is a data gap of more than 60 seconds. By typing:
IDL >  pr_evn, '23-jun-92'
a list of the times that Yohkoh data are available and the number of datasets available for each instrument are listed for 24 hours starting at 23-jun-92 00:00. By typing:
IDL >  pr_evn, '15-nov-91 20:00', '17-nov-91 15:00', /flare
all times that Yohkoh was in FLARE mode between those times is listed. By typing:
IDL >  pr_evn, '1-jan-92', '1-jan-93', /flare, /counts, mindur=5, outfil='pr_evn.results'
the FLARE modes for 1992 are listed, and since the /COUNTS option was used, the maximum counting rate for certain WBS, HXT, and BCS channels is printed instead of the number of datasets available. It also prints the GOES classification when it is available. See the User's Guide for a sample output listing.

2.7.4 PLOT_EVN

PLOT_EVN will plot a very basic time line showing when the station contacts are available, when the SAA passages are, when the S/C day and nights are, and the periods when there is Yohkoh data available. It shows when there is FLARE and QUIET data.

2.7.5 RD_FEM

To read the FEM, EVN ,GEV or NAR structures, use a command similar to:
IDL >  rd_fem, sttim, entim, fem

IDL >  rd_evn, index(0), index(n-1), evn

IDL >  rd_nar, '1-nov-91', '2-nov-91', evn
Look at the File Control Document for a description of the structures which are returned.

2.7.6 RD_OBS

A sample standard calling sequence for reading the observing log data files for all instruments is:
IDL >  rd_obs, '8-may-92', '8-may-92 12:00', bcs, sxtf, sxtp, w_h, fid
It is possible to only read SXT full-frame data by using the one of the following command:
IDL >  rd_obs, '8-may-92', '8-may-92 12:00', bcs, sxtf, sxtp, w_h, fid, /sxtf

IDL >  rd_obs, '8-may-92', '8-may-92 12:00', bcs, sxtf, /sxtf

IDL >  rd_obs, '8-may-92', '8-may-92 12:00', bcs, sxtf, /nobcs
To read the WBS data, you can use the command:
IDL >  rd_obs, '8-may-92', '8-may-92 12:00', bcs, sxtf, sxtp, w_h, /w_h
The observing log output structures are positional and are sorted alphabetically. The observing log files must be in the $DIR_GEN_OBD, $DIR_GEN_OSF, $DIR_GEN_OSP, and $DIR_GEN_OWH directories appropriately.

2.8  Reading Exabyte Archive Tapes

See the description of GO_RDTAP in the User's Guide and the description of RDTAP on page A.4.1 in the appendix of the Reference Guide.