pro get_mmcr_macemask, fname, start_hr, end_hr, start_z, end_z common mmcr_macemask_data, num_times2, hrfrac2, jday2, dbz, $ height2, num_heights2, vel, width, snr common mmcr_macemask_data2, num_sec, time_offset cdfid=ncdf_open(fname) ; open the netcdf file time_did=ncdf_dimid(cdfid,'time') height_did=ncdf_dimid(cdfid,'nheights') ncdf_diminq, cdfid, time_did, char_strng, num_times ncdf_diminq, cdfid, height_did, char_strng, num_heights ; get the id's of the variables to be read num_sec_id=ncdf_varid(cdfid,'base_time') time_offset_id=ncdf_varid(cdfid,'time_offset') height_id=ncdf_varid(cdfid,'Heights') dbz_id=ncdf_varid(cdfid,'ReflectivityBestEstimate') vel_id=ncdf_varid(cdfid,'MeanDopplerVelocity') width_id=ncdf_varid(cdfid,'SpectralWidth') snr_id=ncdf_varid(cdfid,'SignaltoNoiseRatio') ; get the data ncdf_varget, cdfid, num_sec_id, num_sec ncdf_varget, cdfid, time_offset_id, time_offset2 ncdf_varget, cdfid, height_id, height i=1 ;while (height(i) le 15000.) do i=i+1 num_heights=n_elements(height) ijday_ihrfrac_fm_numsec, num_sec, time_offset2, hrfrac, jday, yy, mm, dd, hh, mi, ss i=2 while (hrfrac[i-1] ne 0 and i le num_times-1) do i=i+1 num_times=i-1 ; determine the start and end time index i=1 while (hrfrac[i] lt start_hr) do i=i+1 start_time_index=i ii=1 while (hrfrac[i] lt end_hr and hrfrac[i] lt hrfrac[num_times-1]) do begin i=i+1 endwhile end_time_index=i ; determine the start and end height index i=0 while (height[i] lt start_z) do i=i+1 start_height_index=i while (height[i] lt end_z and height[i] lt height[num_heights-1]) do begin i=i+1 endwhile end_height_index=i start=indgen(1,1) count=indgen(1,1) dbz=indgen(end_time_index-start_time_index+1,end_height_index-start_height_index+1) vel=indgen(end_time_index-start_time_index+1,end_height_index-start_height_index+1) width=indgen(end_time_index-start_time_index+1,end_height_index-start_height_index+1) snr=indgen(end_time_index-start_time_index+1,end_height_index-start_height_index+1) dbz1=indgen(end_height_index-start_height_index+1) time_offset_out=time_offset2[start_time_index:end_time_index] ii=start_time_index for i=0,end_time_index-start_time_index do begin start=[start_height_index,ii] count=[end_height_index-start_height_index+1,1] ncdf_varget, cdfid, dbz_id, dbz1, offset=start, count=count dbz[i,*]=dbz1[*] ncdf_varget, cdfid, vel_id, dbz1, offset=start, count=count vel[i,*]=dbz1[*] ncdf_varget, cdfid, width_id, dbz1, offset=start, count=count width[i,*]=dbz1[*] ncdf_varget, cdfid, snr_id, dbz1, offset=start, count=count snr[i,*]=dbz1[*] ii=ii+1 endfor ncdf_close, cdfid hrfrac2=findgen(end_time_index-start_time_index+1) time_offset=dblarr(end_time_index-start_time_index+1) jday2=findgen(end_time_index-start_time_index+1) height2=findgen(end_height_index-start_height_index+1) ii=0 for i=start_time_index,end_time_index do begin hrfrac2[ii]=hrfrac[i] time_offset[ii]=time_offset2[i] jday2[ii]=jday[i] ii=ii+1 endfor num_times2=ii ii=0 for i=start_height_index,end_height_index do begin height2[ii]=height[i] ii=ii+1 endfor num_heights2=ii return end