function rsl_vslice, radar_or_vol, azimuth, field=field ;****************************************************************************** ; Retrieve an RHI-like vertical slice of volume scan at the given azimuth. ; A sweep structure consisting of a ray at the given azimuth at each elevation ; is returned. ; ; Syntax: ; sweep = rsl_vslice(radar, azimuth, field=string) ; sweep = rsl_vslice(volume, azimuth) ; ; Arguments: ; radar: radar structure. ; volume: volume structure. ; azimuth: azimuth at which vertical slice will be taken. ; ; Keywords: ; FIELD: A string identifying the radar field to select, for example, ; 'DZ'. ; Return value: ; A sweep structure containing the rays that make up the vertical slice. ; The ray at index 0 is at lowest elevation. ; ; Written by: Bart Kelley, GMU, May 2007 ;****************************************************************************** usage = string(['Syntax:', $ ' sweep = rsl_vslice(radar, azimuth, field=string)', $ ' sweep = rsl_vslice(volume, azimuth)']) if n_params() lt 2 then begin message,'Not enough arguments.',/continue print, usage, f='(a)' goto, errexit endif struct = rsl_which_struct(radar_or_vol) if struct eq 'RADAR' then begin if n_elements(field) eq 0 then begin message,'FIELD keyword needs a value.',/continue print, usage, f='(a)' goto, errexit endif vol = rsl_get_volume(radar_or_vol,field) endif else if struct eq 'VOLUME' then begin vol = radar_or_vol endif else begin message,'Arg 1 must be either radar or volume structure.',/continue print, usage, f='(a)' goto, errexit endelse nsweeps = vol.h.nsweeps nrays = nsweeps nbins = max(vol.sweep.ray.h.nbins) sweep = rsl_new_sweep(nrays,nbins) iray = 0 for iswp = 0,nsweeps-1 do begin ray = rsl_get_ray_from_sweep(vol.sweep[iswp], azimuth) sweep.ray[iray] = ray iray = iray + 1 endfor ; Update sweep header. sweep.h.field_type = vol.h.field_type sweep.h.sweep_num = 1 sweep.h.beam_width = vol.sweep[0].h.beam_width sweep.h.vert_half_bw = vol.sweep[0].h.vert_half_bw sweep.h.horz_half_bw = vol.sweep[0].h.horz_half_bw sweep.h.nrays = nrays return, sweep errexit: return, -1 end