function adjust_iphex_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) ; ; *** Based on elevation, separate out the dbz and zdr masks. ; a_elev = where(m.elev eq elev,c_elev) if(c_elev eq 0) then begin flag = 'No elevation found for blockage!' return,flag endif dbz_adjust = m.dbz_corr[iazm,a_elev[0]] zdr_adjust = m.zdr_corr[iazm,a_elev[0]] perc_blocked = m.perc_blocked[iazm,a_elev[0]] if(perc_blocked eq 0) then goto,next_ray dbz_ray = rsl_get_ray_from_sweep(dbz_sweep,azm) zdr_ray = rsl_get_ray_from_sweep(zdr_sweep,azm) if(perc_blocked gt 90) then begin dbz_ray.range = -32768. zdr_ray.range = -32768 goto,next_ray endif ; ; *** 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 next_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