- 积分
- 2203
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-11-20
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 张__QI 于 2015-11-12 22:09 编辑
- #! /bin/sh
- #
- #extract necp bufr information and data
- #
- bufr_path="/home/qzhang/2011_07_18/gdas.airsev.t00z.20110718.bufr"
- exe_path="/home/qzhang/airsev"
- include_path="/home/qzhang/GSI/comGSI_v3.3/include"
- bufr_lib_path="/home/qzhang/GSI/comGSI_v3.3/lib"
- mkdir $exe_path
- cat << EOF > $exe_path/extract.f90
- program bufr_decode_radiance
- !
- ! read all radaince observations out from bufr.
- ! read bufr table from prepbufr file
- !
- implicit none
- integer, parameter :: mxmn=35, mxlv=250
- character(80):: hdstr= &
- 'SAID FOVN YEAR MNTH DAYS HOUR MINU SECO CLAT CLON CLATH CLONH HOLS'
- character(80):: hdr2b='SAZA SOZA BEARAZ SOLAZI'
- character(80):: obstr='TMBR'
- ! character(80):: obstr='TMBRST'
- real(8) :: hdr(mxmn),hdr2(mxmn),obs(mxlv)
- INTEGER :: ireadmg,ireadsb
- character(8) :: subset
- integer :: unit_in=10,idate,nmsg,ntb
- integer,parameter:: max_sat_type=20
- integer :: nsat_type(max_sat_type),nsat_num(max_sat_type)
- integer :: i,k,iret,ksatid,nchanl,num_sat_type,ii
- !
- nchanl=15
- nsat_num=0
- nsat_type=0
- !
- open(24,file='bufr.table')
- open(unit_in,file='$bufr_path',form='unformatted',status='old')
- call openbf(unit_in,'IN',unit_in)
- call dxdump(unit_in,24)
- call datelen(10)
- nmsg=0
- ntb = 0
- num_sat_type = 0
- msg_report: do while (ireadmg(unit_in,subset,idate) == 0)
- nmsg=nmsg+1
- write(*,*)
- write(*,'(3a,i10)') 'subset=',subset,' cycle time =',idate
- sb_report: do while (ireadsb(unit_in) == 0)
- ntb = ntb+1
- call ufbint(unit_in,hdr ,mxmn,1 ,iret,hdstr)
- call ufbint(unit_in,hdr2,mxmn,1 ,iret,hdr2b)
- call ufbrep(unit_in,obs ,1 ,nchanl,iret,obstr)
- ksatid=nint(hdr(1))
- write(*,*) ntb,iret,ksatid
- write(*,*),(hdr(i),i=3,5)
- write(*,*),(hdr(i),i=6,8)
- write(*,*),(hdr(i),i=9,10)
- !write(*,'(a10,15f7.1)') 'obs=',(obs(i),i=1,iret)
- ! satellite type inventory
- if(num_sat_type == 0 ) then
- num_sat_type=1
- nsat_type(num_sat_type)=ksatid
- nsat_num(num_sat_type)= 1
- else
- ii=0
- DO i=1,num_sat_type
- if(nsat_type(i) == ksatid) ii=i
- ENDDO
- if( ii > 0 .and. ii <=num_sat_type) then
- nsat_num(ii)=nsat_num(ii) + 1
- else
- num_sat_type=num_sat_type+1
- if(num_sat_type > max_sat_type) then
- write(*,*) 'Error: too many satellite types'
- write(*,*) 'Need to increase max_sat_type'
- stop 1234
- endif
- nsat_type(num_sat_type)=ksatid
- nsat_num(num_sat_type)=1
- endif
- endif
- enddo sb_report
- enddo msg_report
- call closbf(unit_in)
- write(*,*) 'message=',nmsg,' subset=',ntb
- DO i=1,num_sat_type
- write(*,'(i4,2i10)') i,nsat_type(i),nsat_num(i)
- ENDDO
- end program
- EOF
- cd $exe_path
- ifort -O2 -I $include_path -c extract.f90
- ifort -o extract.exe -O2 extract.o -L $bufr_lib_path -lbufr_i4r8
- ./extract.exe &> info.data
复制代码
老板脑洞开的有点大,让我把卫星辐射数据每条记录的经纬度信息画出来看看。没办法只能照做。
献上bash脚本一个,为大家提供灌水的素材。
如果要把bufr文件里的辐射数据输出出来,只需要在脚本最内层循环里面加上这句话:write(*,*) 'obs=',(obs(i),i=1,iret)即可。
脚本地址献上:
https://github.com/smft/ncep_bufr_reader_based_on_gsi
截个图,证明 it really works!
|
|