SUBROUTINE AL_BUFR ( iunbfo, irundt, alpsbn, report, + rptsec, npts, nsmpl, iret ) C************************************************************************ C* AL_BUFR * C* * C* This subroutine retrieves data from the interface arrays, converts * C* it into BUFR output, and then writes the BUFR output to the BUFR * C* output stream. * C* * C* AL_BUFR ( IUNBFO, IRUNDT, ALPSBN, REPORT, IRET ) * C* * C* Input parameters: * C* IUNBFO INTEGER BUFR output file unit number * C* IRUNDT (5) INTEGER Run date-time * C* (YYYY, MM, DD, HH, MM) * C* ALPSBN CHAR* ALPS data file basename * C* REPORT CHAR* Report * C* RPTSEC REAL Report seconds * C* NPTS INTEGER Number of observations * C* NSMPL INTEGER Observation sequence number * C* * C* Output parameters: * C* IRET INTEGER Return code: * C* 0 = normal return * C** * C* Log: * C* R. Hollern/NCEP 07/02 Based on dcnlsa * C* R. Hollern/NCEP 10/02 Replaced 0-01-212 with 0-05-044 * C* R. Hollern/NCEP 12/02 Added JASON-1 bufr subtype * C* C. Caruso Magee/NCEP 05/07 Adding ENVISAT as b031/xx109 * C* S. Guan/NCEP 02/09 Added JASON-2 subtype(xx112 and xx113) * C* S. Guan/NCEP 04/09 Replace js1i with j1ni. * C* J. Ator/NCEP 06/11 Add enli (ENVISAT with new 30-day orbit)* C* J. Ator/NCEP 07/12 Add processing for js1n (new Jason-1) * C* and cryi (Cryosat-2) * C* J. Ator/NCEP 08/13 Add processing for atko and atki * C* J. Ator/NCEP 03/16 Add rptsec, npts, nsmpl to BUFR output * C* J. Ator/NCEP 08/16 Add processing for js3o and js3i * C* J. Ator/NCEP 10/16 Add processing for atno and atni * C* J. Ator+M.Weiss/NCEP 12/16 Add processing for j2no and j2ni * C* J. Ator/NCEP 04/17 Add processing for s3an and s3as * C* J. Ator/NCEP 08/17 Add processing for j2do and j2di * C* J. Ator/NCEP 08/19 Add processing for j2l[oi] and s3b[ns] * C* J. Ator/NCEP 04/22 Add processing for j3ni and j3no * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'alcmn.cmn' C* INTEGER irundt (5) C* CHARACTER*(*) alpsbn, report C* CHARACTER bfstyp*8, rrstg*120 C* INCLUDE 'ERMISS.FNC' C*----------------------------------------------------------------------- iret = 0 C C* Set the BUFR message subtype. C SELECT CASE ( alpsbn (1:4) ) CASE ( 'ers2' ) bfstyp = 'NC031101' CASE ( 'gfoM', 'gfoo' ) bfstyp = 'NC031102' CASE ( 'tpx1', 'tpx2' ) bfstyp = 'NC031103' CASE ( 'j1ni', 'js1n' ) bfstyp = 'NC031104' CASE ( 'envg', 'enli' ) bfstyp = 'NC031109' CASE ( 'js2o', 'j2no', 'j2do', 'j2lo' ) bfstyp = 'NC031112' CASE ( 'js2i', 'j2ni', 'j2di', 'j2li' ) bfstyp = 'NC031113' CASE ( 'cryi' ) bfstyp = 'NC031117' CASE ( 'atko', 'atno' ) bfstyp = 'NC031118' CASE ( 'atki', 'atni' ) bfstyp = 'NC031119' CASE ( 'js3o', 'j3no' ) bfstyp = 'NC031125' CASE ( 'js3i', 'j3ni' ) bfstyp = 'NC031126' CASE ( 's3an' ) bfstyp = 'NC031128' CASE ( 's3as' ) bfstyp = 'NC031129' CASE ( 's3bn' ) bfstyp = 'NC031131' CASE ( 's3bs' ) bfstyp = 'NC031132' CASE DEFAULT logmsg = 'NO BUFR MESSAGE CREATED FOR THIS 031 SUBTYPE' CALL DC_WLOG ( 0, 'DC', 2, logmsg, ierwlg ) RETURN END SELECT C C* Set the BUFR message date-time. C year = rivals ( iryear ) rmth = rivals ( irmnth ) days = rivals ( irdays ) hour = rivals ( irhour ) IF ( ( ERMISS ( year ) ) .or. ( ERMISS ( rmth ) ) .or. + ( ERMISS ( days ) ) .or. ( ERMISS ( hour ) ) ) THEN RETURN END IF ibfdt = ( INT ( year ) * 1000000 ) + ( INT ( rmth ) * 10000 ) + + ( INT ( days ) * 100 ) + INT ( hour ) C C* Open a BUFR message for output. C CALL OPENMB ( iunbfo, bfstyp, ibfdt ) C C* Report date-time. C CALL UT_RIBF ( iunbfo, 'YEAR', rivals ( iryear ), ierrbf ) CALL UT_RIBF ( iunbfo, 'MNTH', rivals ( irmnth ), ierrbf ) CALL UT_RIBF ( iunbfo, 'DAYS', rivals ( irdays ), ierrbf ) CALL UT_RIBF ( iunbfo, 'HOUR', rivals ( irhour ), ierrbf ) CALL UT_RIBF ( iunbfo, 'MINU', rivals ( irminu ), ierrbf ) CALL UT_RIBF ( iunbfo, 'SECO', rptsec, ierrbf ) C C* Receipt date-time. C CALL UT_RIBF ( iunbfo, 'RCYR', FLOAT ( irundt (1) ), ierrbf ) CALL UT_RIBF ( iunbfo, 'RCMO', FLOAT ( irundt (2) ), ierrbf ) CALL UT_RIBF ( iunbfo, 'RCDY', FLOAT ( irundt (3) ), ierrbf ) CALL UT_RIBF ( iunbfo, 'RCHR', FLOAT ( irundt (4) ), ierrbf ) CALL UT_RIBF ( iunbfo, 'RCMI', FLOAT ( irundt (5) ), ierrbf ) CALL UT_RIBF ( iunbfo, 'RCTS', FLOAT ( 0 ), ierrbf ) C C* Satellite cycle number (0 05 044). C CALL UT_RIBF ( iunbfo, 'SACYLN', rivals ( ircyln ), ierrbf ) C C* Orbit number (0 05 040). C CALL UT_RIBF ( iunbfo, 'ORBN', rivals ( irorbn ), ierrbf ) C C* Satellite ID (0 01 007). C CALL UT_RIBF ( iunbfo, 'SAID', rivals ( irsaid ), ierrbf ) C C* Satellite classification (0 02 020). C CALL UT_RIBF ( iunbfo, 'SCLF', rivals ( irsclf ), ierrbf ) C C* Number of observations. C CALL UT_RIBF ( iunbfo, 'NOBS', FLOAT ( npts ), ierrbf ) C C* Observation sequence number. C CALL UT_RIBF ( iunbfo, 'OSQN', FLOAT ( nsmpl ), ierrbf ) C C* Oservation Quality (0 25 053). C CALL UT_RIBF ( iunbfo, 'OBQL', rivals ( irobql ), ierrbf ) C C* Raw report, including file basename. C CALL ST_LSTR ( alpsbn, lenn, ierltr ) CALL ST_LSTR ( report, lenr, ierltr ) rrstg = alpsbn (1:lenn) // ': ' // report (1:lenr) lrrstg = lenn + lenr + 2 CALL UT_CIBF ( iunbfo, 'RRSTG', rrstg, lrrstg, iercbf ) C C* Latitude. C CALL UFBINT ( iunbfo, r8vals ( irslat ),1, 1, ierrbf, 'CLATH' ) C C* Longitude. C CALL UFBINT ( iunbfo, r8vals ( irslon ),1, 1, ierrbf, 'CLONH' ) C C* Sea-level height deviation from the 8-yr mean of 1993-2000. C CALL UFBINT ( iunbfo, r8vals ( irshd1 ),1, 1, ierrbf, 'SLHD1' ) C CALL UT_WBFR ( iunbfo, 'alps', 0, ierdbf ) C* RETURN END