Program nvap_read_ds c c---------------------------------------------------------------------- c c This routine will read in a NVAP (1/2 degree only) Data Source Bit (DS) c file and convert it to a CCDA data file with 16 grids of 'data source' c as shown below (tlabel(1-16). The routine is written for an c example of the DS reading capability. c c written by Dave Randel STC/METSAT c in February 2003 c c---------------------------------------------------------------------- c character*50 flname, flout character*40 tlabel(16) integer*2 dsb(720,360),istat c c--------COMMON BLOCK WHICH HOLDS THE DATA AND HEADER INFORMATION--------- c real nvdata(720,360), headr(4), zindef cmy fix integer*2 headi(11), igrd cend fix character label*40 common /nvapdata/ nvdata, headr, zindef, headi, label c c------------------------------------------------------------------------- c tlabel(1) = 'DSB SSM/I Leftovers' tlabel(2) = 'DSB SSM/I Sat 1' tlabel(3) = 'DSB SSM/I Sat 2' tlabel(4) = 'DSB SSM/I Sat 3' tlabel(5) = 'DSB Pathfinder Path A TOVS' tlabel(6) = 'DSB ATOVS N15' tlabel(7) = 'DSB ATOVS N16' tlabel(8) = 'DSB SSM/T2 Sat 1' tlabel(9) = 'DSB SSM/T2 Sat 2' tlabel(10) = 'DSB AMSUB N15' tlabel(11) = 'DSB AMSUB N16' tlabel(12) = 'DSB TMI TRMM' tlabel(13) = 'TOPOGRAPHICALLY REMOVED' tlabel(14) = 'SPATIAL INTERPOLATED' tlabel(15) = 'TEMPORAL INTERPOLATED' tlabel(16) = 'MISSING' nbits = 16 c c--set generic format statements 1 format(a,$) 2 format(a50) 3 format(a) c c--get input/output filenames ------------------------- c write(6,1)' NVAP-NG Data Source Bitmap filename? : ' read(5,2) flname write(6,1)' Output CCDA formatted filename? : ' read(5,2) flout c c--loop over fields in file and output a nvap grid file c nout = 0 cmy fix do igrd = 1,1000 cend fix call nvap_read_dsb(flname, igrd, dsb, istat) if(istat .ne. 0) then write(6,*)'**ERROR** reading dsb field',ifld, istat write(6,*)' might just be end of file' stop 100 endif c c----------------------------------------------------------------------- c c BTEST used below is a non-standard function to test for bit condition c being "ON". This test if bit 0 - 15 are on, and sets gridded value c to 100 if true. c c----------------------------------------------------------------------- c do ibit = 1,nbits do iy = 1,360 do ix = 1,720 if(BTEST(dsb(ix,iy),ibit-1)) then nvdata(ix,iy) = 100.0 else nvdata(ix,iy) = zindef endif enddo enddo nout = nout + 1 label = tlabel(ibit) call nvap_write(flout,nout,istat) if(istat .ne. 0) then write(6,*)'**ERROR** writing nvap field = ',nout stop 200 endif do iy = 1,360 !clear out array do ix = 1,720 nvdata(ix,iy) = zindef enddo enddo enddo write(6,*)' finished writing 16 grids for field : ',igrd enddo write(6,*)' normal completion ' stop end