18 parameter(msk1=32000,msk2=4000)
19 CHARACTER cgb*256,cgi*256
20 parameter(mbuf=256*1024)
28 CALL errmsg(
'grbindex: Incorrect usage')
29 CALL errmsg(
'Usage: grbindex gribfile indexfile')
34 CALL baopenr(11,cgb(1:ncgb),ios)
37 lcarg=len(
'grbindex: Error accessing file '//cgb(1:ncgb))
38 carg(1:lcarg)=
'grbindex: Error accessing file '//cgb(1:ncgb)
39 CALL errmsg(carg(1:lcarg))
44 CALL baopen(31,cgi(1:ncgi),ios)
46 lcarg=len(
'grbindex: Error accessing file '//cgi(1:ncgi))
47 carg(1:lcarg)=
'grbindex: Error accessing file '//cgi(1:ncgi)
48 CALL errmsg(carg(1:lcarg))
54 CALL getgir(11,msk1,msk2,mnum,mbuf,cbuf,nlen,nnum,irgi)
55 IF(irgi.GT.1.OR.nnum.EQ.0)
THEN
56 CALL errmsg(
'grbindex: No GRIB messages detected in file '
63 CALL wrgi1h(31,nlen,mnum,cgb(1:ncgb))
65 CALL bawrite(31,iw,nlen*nnum,kw,cbuf)
70 dowhile(irgi.EQ.1.AND.nnum.GT.0)
71 CALL getgir(11,msk1,msk2,mnum,mbuf,cbuf,nlen,nnum,irgi)
72 IF(irgi.LE.1.AND.nnum.GT.0)
THEN
74 CALL bawrite(31,iw,nlen*nnum,kw,cbuf)
78 CALL wrgi1h(31,nlen,mnum,cgb(1:ncgb))
106 CHARACTER CD8*8,CT10*10,HOSTNAME*15
109 CHARACTER CD8*8,CT10*10,HOSTNAM*15
111 CHARACTER CHEAD(2)*81
117 CALL date_and_time(cd8,ct10)
121 WRITE(chead(1)(16:20),
'(I5)') 162
122 chead(1)(22:31)=cd8(1:4)//
'-'//cd8(5:6)//
'-'//cd8(7:8)
123 chead(1)(33:40)=ct10(1:2)//
':'//ct10(3:4)//
':'//ct10(5:6)
124 chead(1)(42:47)=
'GB1IX1'
125 chead(1)(49:54)=cgb(ncgb2:ncgb1-2)
127 istat=hostnm(hostname)
129 chead(1)(56:70)=
'0000'
131 chead(1)(56:70)=
'0001'
134 chead(1)(56:70)=hostnam(hostname)
137 chead(1)(72:80)=
'grbindex '
138 chead(1)(81:81)=char(10)
142 WRITE(chead(2)(9:38),
'(3I10)') 162,nlen,nnum
143 chead(2)(41:80)=cgb(ncgb1:ncgb)
144 chead(2)(81:81)=char(10)
147 CALL bawrite(lugi,0,162,kw,chead)
168 dowhile(k.GE.1.AND.c(k:k).NE.
'/')
subroutine wrgi1h(LUGI, NLEN, NNUM, CGB)
Write index headers.
program grbindex
Create an index file from a grib file.
function ncbase(C, N)
Locate basename of a file.