;+
; NAME:
;       ENVIRONMENT
;
; PURPOSE:
;       Sets up default directories to search locally for Solar-B EIS data. Used ;       by the EIS QL front end: XFILES. It searches for environment valiables, 
;       which should be set up in the users system startup file (e.g. a .cshrc 
;       file, .bashrc file etc. on unix systems). If these environment varables 
;       have not been defined, a default of HOME/solarb/eis/data/ is assumed, 
;       where HOME is the users home directory.
;
;
; CATEGORY:
;       Hansteen/Wikstol Data analysis SW
;
; CALLING SEQUENCE:
;       @environment (called by XFILES)
;
; INPUTS:
;       None
;
; KEYWORD PARAMETERS:
;
;
; OUTPUTS:
;        No output, but these variables are set in the procedure:
;
;        dsource_dir:    For each source of data (e.g. 'CCSDS', 'FITS', 'HK'), 
;                        this variable tells the analysis SW (XFILES) the default
;                        directory to search for data.
;        scfac: 	 Screen size factor. Used by the QL to set default sizes
;                        of display windows. Currently set default 
;                        to 60% of screen size.
;
; CALLS:
;	IS_DIR
;	LOCAL_NAME
;	GETENV
;	GET_DELIM
;
; COMMON BLOCKS:
;
;
; PROCEDURE:
;
;
; RESTRICTIONS:
;
;
; MODIFICATION HISTORY:
;       01-Sep-2001: Oivind Wikstol
;       03-Oct-2001: Oivind Wikstol. Added documentation.
;       11-Apr-2002: Viggo Hansteen. Added scfac variable
;       10-May-2005: Oivind Wikstol. Re-written according to Ron Yurows 
;                    suggestion. Documented.
;       24-Aug-2012: Peter Young. Now uses $HINODE_DATA/eis if
;                    $EIS_FITS_DATA is not defined. See EIS Software
;                    Note #18.
;-


dsource = ['CCSDS', 'FITS', 'HK']
home = getenv ('HOME')
dirsep = get_delim()
eis_inst = getenv('EIS_INST')
eis_data = getenv('EIS_DATA')
eis_ccsds_data = getenv('EIS_CCSDS_DATA')
eis_fits_data = getenv('EIS_FITS_DATA')
eis_hk_data = getenv('EIS_HK_DATA')
eis_cal_data = getenv('EIS_CAL_DATA')

;
; PRY, 24-Aug-2012
;
IF eis_fits_data EQ '' THEN eis_fits_data=concat_dir(getenv('HINODE_DATA'),'eis')


;if eis_data eq "" then eis_data = home+dirsep+'solarb'+dirsep+'eis'+dirsep+$
;                                  'data'+dirsep
;if eis_ccsds_data eq "" then begin
;   eis_ccsds_data = eis_data + 'science'+dirsep+'ccsds'+dirsep
;endif

;if eis_fits_data eq "" then begin
;   eis_fits_data = eis_data + 'science'+dirsep+'fits'+dirsep
;endif

;if eis_hk_data eq "" then begin
;   eis_hk_data = eis_data + 'status'+dirsep
;endif

;if eis_cal_data eq "" then begin
;   eis_cal_data = eis_data + 'cal'+dirsep
;endif

cdir = local_name (eis_ccsds_data)
fdir = local_name (eis_fits_data)
hdir = local_name (eis_hk_data)

if not is_dir (cdir) then cdir = "."
if not is_dir (fdir) then fdir = "."
if not is_dir (hdir) then hdir = "."

dsource_dir =  [cdir, fdir, hdir]

; screensize factor for sizing up xdisplay window

scfac = 0.6

