dustem_test_model_exists.pro 4.12 KB
function dustem_test_model_exists,model $ 
                                  ,help=help $
                                  ,polarisation=polarisation $
                                  ,silent=silent

;+
; NAME:
;    dustem_test_model_exists
;
; PURPOSE:
;    Test if DustEMWrap user has entered a string that matches a known dust model
;  
; CATEGORY:
;    DustEMWrap, Distributed, Low-Level, helper parse I/O
;
; CALLING SEQUENCE:
;    exist_status=dustem_test_model_exists(model)
;  
; INPUTS:
;    model : string provided by user to indicate an ISM dust model
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;    exist_status : 1 = exists, 0 = does not exists
;
; OPTIONAL OUTPUT PARAMETERS:
;
; ACCEPTED KEY-WORDS:
;    help = print this help
;    silent = determine status, but don't print anything
;    polarisation =  check if model includes polarisation
;  
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;    If dust model is unknown, code will stop unless /silent keyword is set
;
; RESTRICTIONS:
;    The DustEMWrap IDL code must be installed
;
; PROCEDURES AND SUBROUTINES USED:
;
; EXAMPLES
;   dustem_test_model_exists,'DL01'
;   dustem_test_model_exists,'G17_MODELA',/pol,/silent
;  
; MODIFICATION HISTORY:
;    Written by AH Feb 2023
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
;-

  exists=0

  IF keyword_set(help) THEN BEGIN
     doc_library,'dustem_test_model_exists'
     goto,the_end
  END

  known_mdls=['MC10' $
              ,'C10' $ ; for convenience = MC10
              ,'COMPIEGNE_ETAL10' $ ; for backwards compatibility = MC10
              ,'DBP90' $
              ,'DL01' $ ; for backwards compatibility
              ,'LD01' $ ; for backwards compatibility
              ,'DL01_RV3P1_BC6' $
;              ,'DL01_RV5P5B_BC3' $ ; removed from DUSTEM fortran in Feb2023 release
;              ,'DL01_RV5P5B_BC0' $ ; removed from DUSTEM fortran in Feb2023 release
              ,'WD01' $ ; for convenience = WD01_RV5P5B
              ,'WD01_RV5P5B' $ 
              ,'DL07' $
              ,'J13' $
              ,'AJ13' $ ; for backwards compatibility = J13
              ,'K15_AMMI' $
              ,'K15_AMMK' $
              ,'K15_CMM' $
              ,'G17_MODELA' $
              ,'G17_MODELB' $
              ,'G17_MODELC' $
              ,'G17_MODELD' $
              ,'THEMIS' $ ; for convenience = J13
              ,'THEMIS2' $ ; for convenience = Y24
              ,'Y19_TYP1' $
              ,'Y19_TYP2' $
              ,'Y19_TYP3' $
              ,'Y19_TYP4' $
              ,'Y19_TYP5' $
              ,'Y19_TYP6' $
              ,'Y19_TYP7' $
              ,'Y19_TYP8' $
              ,'Y19_TYP9' $
              ,'Y24' $
              ,'HD22' $ 
              ,'ASTRODUST' $  ; for convience = HD22
              ,'USER_MODEL']

  test_model = where(known_mdls eq model,ct)

  if ct eq 0 then begin
     if not keyword_set(silent) then begin
        message,'-----------------------------',/continue
        message,'ISM dust model '+model+' unknown',/continue
        message,'Known models are ',/continue
        for i=0,n_elements(known_mdls)-1 do print,known_mdls[i]
        message,'-----------------------------',/continue
     end
     exists=0
  end else begin
     exists=1
  end
  

  pol_mdls=['G17_MODELA' $
              ,'G17_MODELB' $
              ,'G17_MODELC' $
              ,'G17_MODELD' $
              ,'Y24' $
              ,'ASTRODUST' $
              ,'HD22' $
              ,'THEMIS2' $
              ,'USER_MODEL'] ; we assume the USER knows their own model!

  if keyword_set(polarisation) then begin
     test_model = where(pol_mdls eq model,ct)
     if ct eq 0 then begin
        if not keyword_set(silent) then begin
           message,'-----------------------------',/continue
           message,'ISM dust model '+model+' does not describe polarisation',/continue
           message,'Known polarisation models are ',/continue
           for i=0,n_elements(pol_mdls)-1 do print,pol_mdls[i]
           message,'-----------------------------',/continue
        end
        exists=0
     end else begin
        exists=1
     end
     
  endif

  the_end:
  return,exists
end