; docformat = 'rst' ; ; NAME: ; PDS_WISE_GETCATALOG ; PURPOSE: ; Return the concent of the WISE catalog for a specific target or ; simply dump the catalog into a structure ; ;+ ; :Description: ; Return the concent of the WISE catalog for a specific target or ; simply dump the catalog into a structure ; ; There have been different publication of albedo and diameter ; determination of asteroids based on WISE infrared observation and ; thermal modeling. The present routine access a local version of ; all these catalogs merged into a single file ; ; ; :Categories: ; Database, Asteroid, Diameter, Albedo ; ; :Params: ; ID: in, required, type=integer/string ; Target identifyer ('*', Name, Provisional designation, Number) ; ; :Returns: A structure containing the desired content of the WISE ; catalog, or an error code (-2 file not found, -1 target not found). ; Structure fields are:: ; .NUM: IAU number ; .DES: IAU official designation ; .PACK: WISE packed designation ; .H: Absolute magnitude ; .G: Slope parameter ; .pV: Visible geometric albedo: ; val: value ; unc: uncertainty ; .pIR: Infrared geometric albedo: ; val: value ; unc: uncertainty ; .eta: Beaming parameter: ; val: value ; unc: uncertainty ; .D: Diameter in km ; val: value ; unc: uncertainty ; .N1: Number of observations in filter W1 used to derive the parameters ; .N2: Number of observations in filter W2 used to derive the parameters ; .N3: Number of observations in filter W3 used to derive the parameters ; .N4: Number of observations in filter W4 used to derive the parameters ; .src: Source of the value ; ; :Keywords: ; WISE: in, optional, type=string ; Path to the WISE catalog file ; ; CONFIG: in, optional, type=string ; Path to the configuration file for catalogs, at the ; minimum this file should contain the 2 following lines to be used ; by current routine:: ; [Tables from Literature] ; wise = PATH_TO_YOUR_WISE_FILE ; DUMP: in, optional, type=boolean, default=0 ; Set this keyword to return the whole PDS file ; VERBOSE: in, optional, type=boolean, default=0 ; Trigger dialog with user ; ; :Examples: ; Search WISE database for Ceres and Pallas:: ; IDL> print, wise_getcatalog(1) ; IDL> print, wise_getcatalog('Pallas') ; ; :Uses: ; initIDL, readfmt, astNameFormat, designation ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in June 2017, B. Carry (OCA) ;- function PDS_WISE_getCatalog, ID, WISE=WISE, CONFIG=CONFIG, DUMP=DUMP, VERBOSE=VERBOSE COMPILE_OPT hidden, idl2 ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--I.1-- Set IDL to Local Working Environment ----------------------------------------- if not keyword_set(CONFIG) then config = initIDL(/CATALOG) $ else config = initIDL(config, /CATALOG) if not keyword_set(WISE) then WISE = config.bib.wise ;--I.2-- Output Structure Definition -------------------------------------------- empty={num:0L,des:'',pack:'',JD:0.d,H:0.,G:0.,N1:0,N2:0,N3:0,N4:0,fitCode:'',src:'',stack:'',$ pV:{val:0.,unc:0.},pIR:{val:0.,unc:0.},eta:{val:0.,unc:0.},D:{val:0.,unc:0.}} ;--I.3-- Check Existance of the File -------------------------------------------- if not file_test(WISE,/Directory) then begin message, /INFO, 'WISE file not found: '+strtrim(WISE,2) return, -2 endif wiseAll = WISE+'*tab' ;--I.4-- Dump mode Exception ---------------------------------------------------- if keyword_set(DUMP) then ID='*' ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Asteroid Designation Interpretation -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Complete Dump of the Catalog ------------------------------------------ if keyword_set(DUMP) or strcmp(ID,'*',1) then begin spawn, 'cat '+wiseAll, wiseExcerpt, count=nbSel ;--II.2-- Specific Target Requested --------------------------------------------- endif else begin ;--II.2.1- Identify Input Type ----------------------------------------------- ssoName = astNameFormat(ID, TYPE=idType, /WISE ) ;--II.2.2-- Set Asteroid IAU Number ------------------------------------------ if idType eq 1 then begin num = round(float(ssoName)) des = designation(ssoName) endif else begin num = round(designation(ID)) des = strtrim(ID,2) endelse ;--II.2.3-- Set up Search String --------------------------------------------- nbSel=0 if num gt 0 then begin spawn, 'grep -h "'+ssoName+'," '+wiseAll, wiseExcerpt, count=nbSel endif if num le 0 or nbSel eq 0 then begin spawn, "grep -h '"+',"'+ssoName+'",'+"' "+wiseAll, wiseExcerpt, count=nbSel endif ;--II.2.4-- Target not Found Exception -------------------------------------- if nbSel eq 0 then begin if keyword_set(VERBOSE) then message, /INFO, 'Target not found: '+strtrim(string(ID,format='(A)'),2) return, -1 endif endelse ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Result Concatenation and Output -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--III.1-- Create the Output Structure -------------------------------------------- if nbSel eq 1 then result = empty $ else result = replicate(empty,nbSel) ;--III.2-- Fill the Structure ----------------------------------------------------- for kSel=0, nbSel-1 do begin split = strSplit( wiseExcerpt[kSel], ',', /Extract ) result[kSel].num = round(float(split[0])) sub=strSplit(split[1],'"', /Extract) & result[kSel].des = sub[0] sub=strSplit(split[2],'"', /Extract) & result[kSel].pack = sub[0] result[kSel].H = float(split[3]) result[kSel].G = float(split[4]) result[kSel].JD = double(split[5]) result[kSel].N1 = round(float(split[6])) result[kSel].N2 = round(float(split[7])) result[kSel].N3 = round(float(split[8])) result[kSel].N4 = round(float(split[9])) sub=strSplit(split[10],'"', /Extract) & result[kSel].fitCode = sub[0] result[kSel].D = {val:float(split[11]), unc:float(split[12]) } result[kSel].pV = {val:float(split[13]), unc:float(split[14]) } result[kSel].pIR = {val:float(split[15]), unc:float(split[16]) } result[kSel].eta = {val:float(split[17]), unc:float(split[18]) } result[kSel].stack = split[19] sub=strSplit(split[20],'"', /Extract) & result[kSel].src = sub[0] endfor ;--III.3-- Return the Result ------------------------------------------------------ return, result end