pro split_rhi_sweeps,year,month,day,file COMMON misc,TRUE,FALSE TRUE=1 & FALSE=0 !QUIET=TRUE ; ; *** Set date to starings ; year = string(year,format='(I4.4)') syear = strmid(year,2,2) month = string(month,format='(I2.2)') day = string(day,format='(I2.2)') print,month + '/' + day + '/' + year print ; ; *** Locate the data ; in_dir = '/gvs2/gpmgv_data/gpmgv/NPOL/1CUF/' + year + '/' + month + day + '/calibrated/' ; in_dir = '/gvs2/gpmgv_data/gpmgv/NPOL/raw/' + year + '/' + month + day + '/' ; in_dir = '/data/Radar/NPOL/Olympex/8bit_rhi_a/' ; wc = in_dir + 'np1' + syear + month + day + '*.RAW*' wc = in_dir + file ; out_dir = '/data/Radar/NPOL/Olympex/rhi_a_split_UF/' + year + '/' + month + day + '/' out_dir = '/gvs2/gpmgv_data/gpmgv/NPOL/1CUF/' + year + '/' + month + day + '/calibrated/' ; out_dir = '/gvs2/gpmgv_data/gpmgv/NPOL/raw/' + year + '/' + month + day + '/' print,'OUT: ' + out_dir spawn,'mkdir -p ' + out_dir ; ; *** Force error here. Need hour from filename to calculate ZTIME ; *** for sounding. ; files = file_search(wc,COUNT=nf) if(nf eq 0) then begin print,'No files found in ' + wc return endif ; ; *** Determine which files to process. If files_to_process < 0, then ; *** process them all, from oldest to latest. Otherwise, process the ; *** amount specified of the latest files only. ; nsweeps = 20 for i=0,nf-1 do begin file = files[i] print,'<-- ' + file radar = rsl_anyformat_to_radar(file) nvolumes = radar.h.nvolumes ; print,nvolumes ; nrays = radar.volume[0].sweep[0].h.nrays ; print,nrays ; nbins = radar.volume[0].sweep[0].ray[0].h.nbins ; print,nbins dims = size(radar.volume.sweep.ray.range,/dimensions) nbins = dims[0] nrays = dims[1] ; ; *** Split radar structure into two sets with 20 sweeps each. ; for isplit=0,1 do begin r1 = rsl_new_radar(nvolumes,nsweeps,nrays,nbins) r1.h = radar.h r1.h.sched_sweeps = nsweeps for ivol=0,nvolumes-1 do begin v1 = rsl_new_volume(nsweeps,nrays,nbins) i1 = isplit*20 i2 = (isplit+1)*nsweeps-1 ; print,i1,i2 v1.sweep = radar.volume[ivol].sweep[i1:i2] v1.sweep.h = radar.volume[ivol].sweep[i1:i2].h v1.h = radar.volume[ivol].h v1.h.nsweeps = nsweeps r1.volume[ivol] = v1 r1.volume[ivol].h = v1.h endfor ; Volumes ; ; *** Save the file ; fileb = file_basename(file) a = strsplit(fileb,'.',/extract) fileb = a[0] s1 = string(isplit*20,format='(I2.2)') s2 = string((isplit+1)*20,format='(I2.2)') uf_file = out_dir + fileb + '_' + s1 + '-' + s2 + '.uf.gz' print,' --> ' + uf_file rsl_radar_to_uf,r1,uf_file,/compress,/force endfor ; Split print endfor ; files c = 'rm ' + file SPAWN, c print,'Done!' stop end