Perform actual GRIB output.
1003 INTEGER,
INTENT(IN) :: NX, NY, NSEA
1008 INTEGER :: J, IXY, NDATA
1011 INTEGER,
SAVE :: IENT = 0
1013 REAL :: X1(NX*NY), X2(NX*NY), XX(NX*NY), &
1014 XY(NX*NY), CABS, UABS, &
1015 YY(NX*NY,0:NOSWLL), KPDS5A, KPDS5B, &
1017 LOGICAL*1 :: BITMAP(NX*NY)
1018 LOGICAL :: FLONE, FLTWO, FLDIR, FLTRI, FLPRT
1023 CALL strace (ient,
'W3EXGB')
1027 WRITE (ndst,9000) ((flreq(ifi,ifj),ifj=1,ngrpp), ifi=1,nogrp)
1028 WRITE (ndst,9001) ndsdat, kpds, kgds
1046 IF ( flreq(ifi,ifj) )
THEN
1059 WRITE (ndst,9020) idout(ifi,ifj)
1066 IF ( ifi .EQ. 1 .AND. ifj .EQ. 1 )
THEN
1072 CALL w3s2xy ( nsea, nsea, nx, ny,
dw(1:nsea) &
1077 ELSE IF ( ifi .EQ. 1 .AND. ifj .EQ. 2 )
THEN
1087 CALL w3s2xy ( nsea, nsea, nx, ny,
cx(1:nsea) &
1089 CALL w3s2xy ( nsea, nsea, nx, ny,
cy(1:nsea) &
1093 cabs = sqrt(
cx(isea)**2+
cy(isea)**2)
1094 IF ( cabs .GT. 0.001 )
THEN
1095 cy(isea) = mod( 630. - &
1096 rade*atan2(
cy(isea),
cx(isea)) , 360. )
1106 CALL w3s2xy ( nsea, nsea, nx, ny,
cx(1:nsea) &
1108 CALL w3s2xy ( nsea, nsea, nx, ny,
cy(1:nsea) &
1113 ELSE IF ( ifi .EQ. 1 .AND. ifj .EQ. 3 )
THEN
1124 CALL w3s2xy ( nsea, nsea, nx, ny,
ua(1:nsea) &
1126 CALL w3s2xy ( nsea, nsea, nx, ny,
ud(1:nsea) &
1130 uabs = sqrt(
ua(isea)**2+
ud(isea)**2)
1131 IF ( uabs .GT. 0.001 )
THEN
1132 ud(isea) = mod( 630. - &
1133 rade*atan2(
ud(isea),
ua(isea)) , 360. )
1143 CALL w3s2xy ( nsea, nsea, nx, ny,
ua(1:nsea) &
1145 CALL w3s2xy ( nsea, nsea, nx, ny,
ud(1:nsea) &
1150 ELSE IF ( ifi .EQ. 1 .AND. ifj .EQ. 4 )
THEN
1156 CALL w3s2xy ( nsea, nsea, nx, ny,
as(1:nsea) &
1161 ELSE IF ( ifi .EQ. 1 .AND. ifj .EQ. 5 )
THEN
1167 CALL w3s2xy ( nsea, nsea, nx, ny,
wlv , mapsf, x1 )
1171 ELSE IF ( ifi .EQ. 1 .AND. ifj .EQ. 6 )
THEN
1177 CALL w3s2xy ( nsea, nsea, nx, ny,
ice , mapsf, x1 )
1181 ELSE IF ( ifi .EQ. 1 .AND. ifj .EQ. 8 )
THEN
1192 CALL w3s2xy ( nsea, nsea, nx, ny,
taua(1:nsea) &
1194 CALL w3s2xy ( nsea, nsea, nx, ny,
tauadir(1:nsea) &
1199 IF ( uabs .GT. 0.001 )
THEN
1211 CALL w3s2xy ( nsea, nsea, nx, ny,
taua(1:nsea) &
1213 CALL w3s2xy ( nsea, nsea, nx, ny,
tauadir(1:nsea) &
1218 ELSE IF ( ifi .EQ. 1 .AND. ifj .EQ. 9 )
THEN
1224 CALL w3s2xy ( nsea, nsea, nx, ny,
rhoair, mapsf, x1 )
1228 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 1 )
THEN
1233 CALL w3s2xy ( nsea, nsea, nx, ny,
hs , mapsf, x1 )
1237 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 2 )
THEN
1242 CALL w3s2xy ( nsea, nsea, nx, ny,
wlm , mapsf, x1 )
1246 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 3 )
THEN
1249 if ((gen_pro.eq.1) .or. (gen_pro.eq.0))
then
1256 CALL w3s2xy ( nsea, nsea, nx, ny,
t02 , mapsf, x1 )
1260 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 4 )
THEN
1265 CALL w3s2xy ( nsea, nsea, nx, ny,
t0m1 , mapsf, x1 )
1269 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 5 )
THEN
1272 if ((gen_pro.eq.1) .or. (gen_pro.eq.0))
then
1278 CALL w3s2xy ( nsea, nsea, nx, ny,
t01 , mapsf, x1 )
1282 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 6 )
THEN
1288 IF (
fp0(isea) .NE.
undef .AND.
fp0(isea) .NE. 0 )
THEN
1289 fp0(isea) = 1. / max(fr1,
fp0(isea))
1292 CALL w3s2xy ( nsea, nsea, nx, ny,
fp0 , mapsf, x1 )
1297 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 7 )
THEN
1304 IF ( flagunr )
CALL w3thrtn(nsea,
thm, angld, .false.)
1308 thm(isea) = mod( 630. -
rade*
thm(isea) , 360. )
1310 CALL w3s2xy ( nsea, nsea, nx, ny,
thm , mapsf, x1 )
1314 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 8 )
THEN
1319 CALL w3s2xy ( nsea, nsea, nx, ny,
ths , mapsf, x1 )
1323 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 9 )
THEN
1326 if ((gen_pro.eq.1) .or. (gen_pro.eq.0))
then
1334 IF ( flagunr )
CALL w3thrtn(nsea,
thp0, angld, .false.)
1341 CALL w3s2xy ( nsea, nsea, nx, ny,
thp0 , mapsf, x1 )
1345 ELSE IF ( ifi .EQ. 2 .AND. ifj .EQ. 19 )
THEN
1350 CALL w3s2xy ( nsea, nsea, nx, ny,
wnmean, mapsf, x1 )
1354 ELSE IF ( ifi .EQ. 4 .AND. ifj .EQ. 1 )
THEN
1359 if ((gen_pro.eq.1) .or. (gen_pro.eq.0))
then
1368 ( nsea, nsea, nx, ny,
phs(:,0), mapsf, yy(:,0) )
1371 ( nsea, nsea, nx, ny,
phs(:,i), mapsf, yy(:,i) )
1376 ELSE IF ( ifi .EQ. 4 .AND. ifj .EQ. 2 )
THEN
1381 if ((gen_pro.eq.1) .or. (gen_pro.eq.0))
then
1390 ( nsea, nsea, nx, ny,
ptp(:,0), mapsf, yy(:,0) )
1393 ( nsea, nsea, nx, ny,
ptp(:,i), mapsf, yy(:,i) )
1398 ELSE IF ( ifi .EQ. 4 .AND. ifj .EQ. 3 )
THEN
1405 ( nsea, nsea, nx, ny,
plp(:,0), mapsf, yy(:,0) )
1408 ( nsea, nsea, nx, ny,
plp(:,i), mapsf, yy(:,i) )
1413 ELSE IF ( ifi .EQ. 4 .AND. ifj .EQ. 4 )
THEN
1418 if ((gen_pro.eq.1) .or. (gen_pro.eq.0))
then
1429 IF ( flagunr )
CALL w3thrtn(nsea,
pdir(:,i), angld, .false.)
1440 ( nsea, nsea, nx, ny,
pdir(:,0), mapsf, yy(:,0) )
1443 ( nsea, nsea, nx, ny,
pdir(:,i), mapsf, yy(:,i) )
1448 ELSE IF ( ifi .EQ. 4 .AND. ifj .EQ. 5 )
THEN
1455 ( nsea, nsea, nx, ny,
psi(:,0), mapsf, yy(:,0) )
1458 ( nsea, nsea, nx, ny,
psi(:,i), mapsf, yy(:,i) )
1463 ELSE IF ( ifi .EQ. 4 .AND. ifj .EQ. 6 )
THEN
1470 ( nsea, nsea, nx, ny,
pws(:,0), mapsf, yy(:,0) )
1473 ( nsea, nsea, nx, ny,
pws(:,i), mapsf, yy(:,i) )
1478 ELSE IF ( ifi .EQ. 4 .AND. ifj .EQ. 16 )
THEN
1483 CALL w3s2xy ( nsea, nsea, nx, ny,
pwst , mapsf, x1 )
1487 ELSE IF ( ifi .EQ. 4 .AND. ifj .EQ. 17 )
THEN
1492 CALL w3s2xy ( nsea, nsea, nx, ny,
pnr , mapsf, x1 )
1496 ELSE IF ( ifi .EQ. 5 .AND. ifj .EQ. 1 )
THEN
1506 CALL w3s2xy ( nsea, nsea, nx, ny,
ust(1:nsea) &
1508 CALL w3s2xy ( nsea, nsea, nx, ny,
ustdir(1:nsea) &
1513 ELSE IF ( ifi .EQ. 9 .AND. ifj .EQ. 1 )
THEN
1522 CALL w3s2xy ( nsea, nsea, nx, ny,
dtdyn , mapsf, x1 )
1526 ELSE IF ( ifi .EQ. 9 .AND. ifj .EQ. 2 )
THEN
1531 CALL w3s2xy ( nsea, nsea, nx, ny,
fcut , mapsf, x1 )
1535 ELSE IF ( ifi .EQ. 9 .AND. ifj .EQ. 3 )
THEN
1540 CALL w3s2xy ( nsea, nsea, nx, ny,
cflxymax , mapsf, x1 )
1544 ELSE IF ( ifi .EQ. 9 .AND. ifj .EQ. 4 )
THEN
1549 CALL w3s2xy ( nsea, nsea, nx, ny,
cflthmax , mapsf, x1 )
1569 bitmap(ixy) = yy(ixy,0) .NE.
undef
1572 CALL gribcreate (cgrib,lcgrib,listsec0,listsec1,io)
1573 IF (io .NE. 0)
GOTO 810
1574 CALL addgrid (cgrib,lcgrib,igds,kgds,200,ideflist, &
1576 IF (io .NE. 0)
GOTO 820
1577 CALL addfield (cgrib,lcgrib,kpdsnum,kpds,200, &
1578 coordlist, numcoord, idrsnum, idrs, &
1579 200,yy(:,0), ndata, ibmp, bitmap, io)
1580 IF (io .NE. 0)
GOTO 820
1581 CALL gribend (cgrib, lcgrib, lengrib, io)
1582 IF (io .NE. 0)
GOTO 830
1583 CALL wryte (ndsdat, lengrib, cgrib)
1587 if ((gen_pro.eq.0) .or. (gen_pro.eq.1))
then
1592 kpds(2) = kpds5a1(i)
1596 bitmap(ixy) = yy(ixy,i) .NE.
undef
1599 CALL gribcreate (cgrib,lcgrib,listsec0,listsec1,io)
1600 IF (io .NE. 0)
GOTO 810
1601 CALL addgrid (cgrib,lcgrib,igds,kgds,200,ideflist, &
1603 IF (io .NE. 0)
GOTO 820
1604 CALL addfield (cgrib,lcgrib,kpdsnum,kpds,200, &
1605 coordlist, numcoord, idrsnum, idrs, &
1606 200,yy(:,i), ndata, ibmp, bitmap, io)
1607 IF (io .NE. 0)
GOTO 820
1608 CALL gribend (cgrib, lcgrib, lengrib, io)
1609 IF (io .NE. 0)
GOTO 830
1610 CALL wryte (ndsdat, lengrib, cgrib)
1623 bitmap(ixy) = yy(ixy,i) .NE.
undef
1626 CALL gribcreate (cgrib,lcgrib,listsec0,listsec1,io)
1627 IF (io .NE. 0)
GOTO 810
1628 CALL addgrid (cgrib,lcgrib,igds,kgds,200,ideflist, &
1630 IF (io .NE. 0)
GOTO 820
1631 CALL addfield (cgrib,lcgrib,kpdsnum,kpds,200, &
1632 coordlist, numcoord, idrsnum, idrs, &
1633 200,yy(:,i), ndata, ibmp, bitmap, io)
1634 IF (io .NE. 0)
GOTO 820
1635 CALL gribend (cgrib, lcgrib, lengrib, io)
1636 IF (io .NE. 0)
GOTO 830
1637 CALL wryte (ndsdat, lengrib, cgrib)
1648 ELSE IF (flone)
THEN
1651 bitmap(ixy) = x1(ixy) .NE.
undef
1655 CALL gribcreate (cgrib,lcgrib,listsec0,listsec1,io)
1656 IF (io .NE. 0)
GOTO 810
1657 CALL addgrid (cgrib,lcgrib,igds,kgds,200,ideflist, &
1659 IF (io .NE. 0)
GOTO 820
1660 CALL addfield (cgrib,lcgrib,kpdsnum,kpds,200, &
1661 coordlist, numcoord, idrsnum, idrs, &
1662 200,x1, ndata, ibmp, bitmap, io)
1663 IF (io .NE. 0)
GOTO 820
1664 CALL gribend (cgrib, lcgrib, lengrib, io)
1665 IF (io .NE. 0)
GOTO 830
1666 CALL wryte (ndsdat, lengrib, cgrib)
1669 ELSE IF ( fltwo )
THEN
1672 bitmap(ixy) = x1(ixy) .NE.
undef
1675 CALL gribcreate (cgrib,lcgrib,listsec0,listsec1,io)
1676 IF (io .NE. 0)
GOTO 810
1677 CALL addgrid (cgrib,lcgrib,igds,kgds,200,ideflist, &
1679 IF (io .NE. 0)
GOTO 820
1680 CALL addfield (cgrib,lcgrib,kpdsnum,kpds,200, &
1681 coordlist, numcoord, idrsnum, idrs, &
1682 200,x1, ndata, ibmp, bitmap, io)
1683 IF (io .NE. 0)
GOTO 820
1684 CALL gribend (cgrib, lcgrib, lengrib, io)
1685 IF (io .NE. 0)
GOTO 830
1686 CALL wryte (ndsdat, lengrib, cgrib)
1691 CALL gribcreate (cgrib,lcgrib,listsec0,listsec1,io)
1692 IF (io .NE. 0)
GOTO 810
1693 CALL addgrid (cgrib,lcgrib,igds,kgds,200,ideflist, &
1695 IF (io .NE. 0)
GOTO 820
1696 CALL addfield (cgrib,lcgrib,kpdsnum,kpds,200, &
1697 coordlist, numcoord, idrsnum, idrs, &
1698 200,x2, ndata, ibmp, bitmap, io)
1699 IF (io .NE. 0)
GOTO 820
1700 CALL gribend (cgrib, lcgrib, lengrib, io)
1701 IF (io .NE. 0)
GOTO 830
1702 CALL wryte (ndsdat, lengrib, cgrib)
1704 CALL gribcreate (cgrib,lcgrib,listsec0,listsec1,io)
1705 IF (io .NE. 0)
GOTO 810
1706 CALL addgrid (cgrib,lcgrib,igds,kgds,200,ideflist, &
1708 IF (io .NE. 0)
GOTO 820
1709 CALL addfield (cgrib,lcgrib,kpdsnum,kpds,200, &
1710 coordlist, numcoord, idrsnum, idrs, &
1711 200,xx, ndata, ibmp, bitmap, io)
1712 IF (io .NE. 0)
GOTO 820
1713 CALL gribend (cgrib, lcgrib, lengrib, io)
1714 IF (io .NE. 0)
GOTO 830
1715 CALL wryte (ndsdat, lengrib, cgrib)
1717 CALL gribcreate (cgrib,lcgrib,listsec0,listsec1,io)
1718 IF (io .NE. 0)
GOTO 810
1719 CALL addgrid (cgrib,lcgrib,igds,kgds,200,ideflist, &
1721 IF (io .NE. 0)
GOTO 820
1722 CALL addfield (cgrib,lcgrib,kpdsnum,kpds,200, &
1723 coordlist, numcoord, idrsnum, idrs, &
1724 200,xy, ndata, ibmp, bitmap, io)
1725 IF (io .NE. 0)
GOTO 820
1726 CALL gribend (cgrib, lcgrib, lengrib, io)
1727 IF (io .NE. 0)
GOTO 830
1728 CALL wryte (ndsdat, lengrib, cgrib)
1749 WRITE (ndse,1010) io
1752 WRITE (ndse,1020) io
1755 WRITE (ndse,1030) io
1761 999
FORMAT (/
' *** WAVEWATCH III ERROR IN W3EXGB :'/ &
1762 ' PLEASE UPDATE FIELDS !!! '/)
1765 1000
FORMAT (/
' *** WAVEWATCH III ERROR IN W3EXGB : '/ &
1766 ' ERROR IN OPENING OUTPUT FILE'/ &
1771 1010
FORMAT (/
' *** WAVEWATCH III ERROR IN W3EXGB : '/ &
1772 ' ERROR CREATING NEW GRIB2 FIELD'/ &
1777 1020
FORMAT (/
' *** WAVEWATCH III ERROR IN W3EXGB : '/ &
1778 ' ERROR ADDING GRIB2 FIELD'/ &
1783 1030
FORMAT (/
' *** WAVEWATCH III ERROR IN W3EXGB : '/ &
1784 ' ERROR ENDING GRIB2 MESSAGE'/ &
1789 9000
FORMAT (
' TEST W3EXGB : FLAGS :',40l2)
1790 9001
FORMAT (
' TEST W3EXGB : NDSDAT :',i4/ &
1799 9012
FORMAT (
' TEST W3EXGB : BLOK PARS : ',3i4)
1800 9014
FORMAT (
' BASE NAME : ',a)
1804 9020
FORMAT (
' TEST W3EXGB : OUTPUT FIELD : ',a)