; docformat = 'rst' ; ; NAME: ; 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 (IMCCE) ; ; :History: ; Change History:: ; Written in November 2013, B. Carry (IMCCE) ; 2015 Jan. - B. Carry (OCA) - idl2 added - Bug corrected for dumping ;- function WISE_getCatalog, ID, WISE=WISE, CONFIG=CONFIG, DUMP=DUMP, VERBOSE=VERBOSE ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 ;--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:'', H: 0., G:0., N1: 0, N2: 0, N3: 0, N4: 0, src: '', $ 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_exist(WISE) then begin message, /INFO, 'WISE file not found: '+strtrim(WISE,2) return, -2 endif ;--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 '+WISE, wiseExcerpt, count=nbSel ;--II.2-- Specific Target Requested --------------------------------------------- endif else begin ;--II.2.1- Identify Input Type ----------------------------------------------- trash = astNameFormat(ID, TYPE=idType ) ;--II.2.2-- Set Asteroid IAU Number ------------------------------------------ if idType eq 1 then begin num = round(float(ID)) des = designation(ID) 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 numTest = strTrim(astNameFormat(num),2) ; print, 'grep "'+numTest+'," '+WISE spawn, 'grep "'+numTest+'," '+WISE, wiseExcerpt, count=nbSel endif if num le 0 or nbSel eq 0 then begin desTest = strTrim(astNameformat(des),2) ; print, 'grep ",'+desTest+'," '+WISE spawn, 'grep ",'+desTest+'," '+WISE, 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 wDes = '' src = '' ;-old non-CSV reads, wiseExcerpt[kSel], wPack, wNum, wDes, wH, wG, wD, wDD, wPV, wDPV, wETA, wDETA, wPIR, wDPIR, wN1, wN2, wN3, wN4, src, $ ;-old non-CSV format='(A7,2x,I6,1x,A-15,1x,'+$ ;-old non-CSV 'F6.3,1x,F4.2,2x,'+$ ;-old non-CSV 'F7.3,2x,F7.3,3x,F6.4,3x,F6.4,4x,'+$ ;-old non-CSV 'F5.3,4x,F5.3,3x,F6.4,3x,F6.4,4x,'+$ ;-old non-CSV 'I3,1x,I3,1x,I3,1x,I3,1x,A-24)' ;-old non-CSV result[kSel].num = wNum ;-old non-CSV result[kSel].des = strtrim(wDes,2) ;-old non-CSV result[kSel].pack= strtrim(wPack,2) ;-old non-CSV result[kSel].H = wH ;-old non-CSV result[kSel].G = wG ;-old non-CSV result[kSel].pV = {val: wPV , unc: wDPV } ;-old non-CSV result[kSel].pIR = {val: wPIR, unc: wDPIR} ;-old non-CSV result[kSel].eta = {val: wETA, unc: wDETA} ;-old non-CSV result[kSel].D = {val: wD , unc: wDD } ;-old non-CSV result[kSel].N1 = wN1 ;-old non-CSV result[kSel].N2 = wN2 ;-old non-CSV result[kSel].N3 = wN3 ;-old non-CSV result[kSel].N4 = wN4 ;-old non-CSV result[kSel].src = strtrim(src,2) split = strSplit( wiseExcerpt[kSel], ',', /Extract ) result[kSel].num = split[1] result[kSel].des = split[2] result[kSel].D = {val:float(split[3]), unc:float(split[4]) } result[kSel].pV = {val:float(split[5]), unc:float(split[6]) } result[kSel].eta = {val:float(split[7]), unc:float(split[8])} result[kSel].src = split[12] result[kSel].N1 = round(float(split[-2])) endfor ;--III.3-- Return the Result ------------------------------------------------------ return, result end