program bufr_append_sample ! ! sample of appending one observation into bufr file ! implicit none character(80):: hdstr='XOB YOB DHR' character(80):: obstr='TOB' real(8) :: hdr(3),obs(1,1) character(8) subset integer :: unit_out=10,unit_table=20 integer :: idate,iret ! set data values hdr(1)=85.0;hdr(2)=50.0;hdr(3)=0.2 obs(1,1)=300.0 idate=2008120101 ! YYYYMMDDHH subset='ADPSFC' ! surface land reports ! get bufr table from existing bufr file open(unit_table,file='prepobs_prep_app.bufrtable') open(unit_out,file='sample.bufr',status='old',form='unformatted') call openbf(unit_out,'IN',unit_out) call dxdump(unit_out,unit_table) call closbf(unit_out) ! append open(unit_out,file='sample.bufr',status='old',form='unformatted') call datelen(10) call openbf(unit_out,'APN',unit_table) call openmb(unit_out,subset,idate) call ufbint(unit_out,hdr,3,1,iret,hdstr) call ufbint(unit_out,obs,1,1,iret,obstr) call writsb(unit_out) call closmg(unit_out) call closbf(unit_out) end program