program bufr_encode_amsua ! ! Encode AMSUA TMBR(brightness temperature) to bufr file. ! implicit none integer, parameter :: mxmn=35, mxlv=250 ! define mnemonic of AMSUB (Coming from GSI read_bufrtovs.f90) character(80):: hdstr= & 'SAID FOVN YEAR MNTH DAYS HOUR MINU SECO CLAT CLON CLATH CLONH HOLS' ! header record character(80):: hdr2b='SAZA SOZA BEARAZ SOLAZI' ! header record character(80):: obstr='TMBR' ! Brightness temperature character(8) msgtype real(8) :: hdr(mxmn),hdr2(mxmn),obs(mxlv) integer :: unit_in=10,unit_table=24,idate,iret,nchanl ! set data values hdr(1)=4; hdr(2)=19. hdr(3)=2012; hdr(4)=5; hdr(5)=1; hdr(6)=21; hdr(7)=0; hdr(8)=0 hdr(9)=-34.5; hdr(10)=15.5; hdr(13)=0 hdr2(1)=13.2; hdr2(2)=147.9; hdr2(3)=254.6; hdr2(4)=240.8 obs(1)=158.0; obs(2)=151.8; obs(3)=219.5; obs(4)=254.8 obs(5)=252.1; obs(6)=236.8; obs(8)=217.5; obs(9)=213.1 obs(10)=216.7; obs(11)=221.7; obs(12)=228.7; obs(13)=237.1 obs(14)=248.3; obs(15)=210.5 idate=2012050121 ! YYYYMMDDHH msgtype='NC021023' ! AMSUB message type nchanl=15 ! TMBR has fixed 15 replication in AMSUA type open(unit_table,file='radiance.bufrtable') ! Open radiance bufrtable open(unit_in,file='amsua.bufr',action='write',form='unformatted') call datelen(10) ! specify date format: YYYYMMDDHH call openbf(unit_in,'OUT',unit_table) ! Connect bufrtable, bufr file to bufr lib call openmb(unit_in,msgtype,idate) ! Open the new message type call ufbint(unit_in,hdr,mxmn,1,iret,hdstr) ! Write header info to internal array call ufbint(unit_in,hdr2,mxmn,1,iret,hdr2b) call ufbrep(unit_in,obs,1,nchanl,iret,obstr) ! Write brightness temperature to internal array call writsb(unit_in) ! write the above data subset to the current message type. call closmg(unit_in) call closbf(unit_in) end program