function rsl_which_struct, struct ;****************************************************************************** ; Returns the name of the rsl structure given as argument. ; If argument isn't an rsl structure, an empty string is returned. ; ; Syntax: ; struct_name = rsl_which_struct(structure) ; ; Return value is one of the following strings: ; 'RADAR' ; 'VOLUME' ; 'SWEEP' ; 'RAY' ; '' (Empty string) ; ; Example: ; The function rsl_vslice.pro can take either a radar structure or volume ; structure as argument. The following condensed section of code illustrates ; the use of rsl_which_struct to determine the structure. ; ; struct = rsl_which_struct(radar_or_vol) ; if struct eq 'RADAR' then begin ; vol = rsl_get_volume(radar_or_vol,field) ; endif else if struct eq 'VOLUME' then begin ; vol = radar_or_vol ; endif else begin ; print,'Arg 1 must be either radar or volume structure.' ; endelse ; ; Written by: Bart Kelley, GMU, May 2007 ;****************************************************************************** ; Check if it's a structure. typecode = size(struct,/type) if typecode ne 8 then begin message, 'Argument must be a structure.',/continue return,'' end names = tag_names(struct) case names[1] of 'VOLUME': struct_name = 'RADAR' 'SWEEP': struct_name = 'VOLUME' 'RAY': struct_name = 'SWEEP' 'RANGE': struct_name = 'RAY' else: begin struct_name = '' message,'Unknown structure name: ' + names[1],/continue end endcase return, struct_name end