function adjust_blockage_from_radar,radar,m COMMON misc,TRUE,FALSE ; ; *** The structure m contains the mask for adding both dBZ and Zdr to ; *** the respective radar volumes as a function of azimuth and ; *** elevation angle. ; fields = radar.volume.h.field_type ; ; *** Get the DZ volume ; a = where(fields eq 'CZ',c) if(c eq 0) then begin flag = 'No CZ field found!' print,flag stop return,flag endif dbz_index = a[0] dbz_volume = radar.volume(dbz_index) ; ; *** Get the ZDR volume ; a = where(fields eq 'DR',c) if(c eq 0) then begin flag = 'No DR field found!' print,flag stop return,flag endif zdr_index = a[0] zdr_volume = radar.volume(zdr_index) ; ; *** Process one sweep at a time ; nsweeps = dbz_volume.h.nsweeps for isweep=0,nsweeps-1 do begin dbz_sweep = dbz_volume.sweep[isweep] zdr_sweep = zdr_volume.sweep[isweep] ; ; *** The blockage masks are in integer degrees, so we need to make ; *** sure that we get all rays with same floor value. ; elev = fix(dbz_sweep.h.elev*10)/10. ray_azms = dbz_sweep.ray.h.azimuth a_good =where(ray_azms ge 0) ray_azms = ray_azms[a_good] if(elev gt max(m.elev)) then goto,next_sweep for iray=0,n_elements(ray_azms)-1 do begin azm = ray_azms[iray] iazm = fix(azm) flag = m.flag[iazm] ; ; *** Based on elevation, separate out the dbz and zdr masks. ; *** If flag=1, then this is a hybrid ray and we need to use ; *** the 1.4 degree block adjustment for the lower ray. If ; *** we did not call the hybrid or other routines, then ; *** flag == 0 and the point is moot. ; CASE elev of 0.7: BEGIN dbz_adjust = m.mask[iazm,2] zdr_adjust = m.mask[iazm,0] if(flag eq 1) then begin dbz_adjust = m.mask[iazm,3] zdr_adjust = m.mask[iazm,1] endif END 1.4: BEGIN dbz_adjust = m.mask[iazm,3] zdr_adjust = m.mask[iazm,1] END ELSE: BEGIN print,'Invalid elevation to edit: ',elev goto,next_sweep END ENDCASE dbz_ray = rsl_get_ray_from_sweep(dbz_sweep,azm) zdr_ray = rsl_get_ray_from_sweep(zdr_sweep,azm) ; ; *** Make the adjustment ; a_dbz = where(dbz_ray.range gt dbz_volume.h.no_data_flag,c_dbz) if(c_dbz gt 0) then begin for ii=0,c_dbz-1 do dbz_ray.range[ii] += dbz_adjust endif a_zdr = where(zdr_ray.range gt zdr_volume.h.no_data_flag,c_zdr) if(c_zdr gt 0) then begin for ii=0,c_zdr-1 do zdr_ray.range[ii] += zdr_adjust endif ; ; *** Place new ray into new radar space ; dbz_sweep.ray[iray] = dbz_ray zdr_sweep.ray[iray] = zdr_ray endfor dbz_volume.sweep[isweep] = dbz_sweep zdr_volume.sweep[isweep] = zdr_sweep next_sweep: endfor ; ; *** Now place volume back into radar and return ; radar.volume[dbz_index] = dbz_volume radar.volume[zdr_index] = zdr_volume flag = 'OK' return,flag end