;+
; NAME:
;	SUMER_FF
;
; PURPOSE:
;	Convert quantities from SI to CGS or the other way around
;	
;
; CATEGORY:
;	Solar-B utilities software
;
; CALLING SEQUENCE:
;	si_to_cgs, inval, outval, unit = unit, quant = quant, reverse = reverse
;
;
; INPUTS:
;	inval:	Input value (default in the SI system)
;       
;
;
; KEYWORD PARAMETERS:
;	unit: String describing unit of output value 
;             (e.g. [W m-2 sr-1] for intensity)
;       quant: String describing what quantity inval/outval is. 
;              Default quantity is intensity. Other allowed quantities: None at the moment.
;       reverse: Set this keyword to convert from CGS to SI
;
; OUTPUTS:
;	outval: Ouput value (e.g intensity in CGS units)
;
; CALLS:
;
; COMMON BLOCKS:
;
; PROCEDURE:
;
; RESTRICTIONS:
;	So far only intensity implemented.
;
; MODIFICATION HISTORY:
;	07-Sep-2005: Written by Oivind Wikstol
;-
pro si_to_cgs, inval, outval, unit = unit, quant = quant, /reverse

  if n_params() lt 2 then begin
    print, 'si_to_cgs, inval, outval, unit = unit, /intensity, /reverse'
    return
  endif

  ; if reverse keyword set, convert from CGS to SI
  if keyword_set(reverse) then ret_system = 'SI' else ret_system = 'CGS'

  ; default assume invalues are intensity
  if not keyword_set(quant) then quant = 'intensity'

; if reverse keyword set - convert from CGS to SI, else convert from SI to CGS
  if quant eq 'intensity' then begin
    if keyword_set(reverse) then begin
      outval = inval*1.e-3
      unit = [W m!u-2!n sr!u-1!n]
    endif else begin
      outval = inval* 1.e3
      unit = [erg cm!u-2!n s!u-1!n sr!u-1!n]
    endelse
  endif

end