Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / external / bufr / nxtwin.f
blobe862c17d152b0dcb2d8cea38f5e54c4224f3772f
1 SUBROUTINE NXTWIN(LUN,IWIN,JWIN)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: NXTWIN
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: GIVEN INDICES WITHIN THE INTERNAL JUMP/LINK TABLE WHICH
9 C POINT TO THE START AND END OF AN "RPC" WINDOW (I.E. ITERATION OF
10 C AN 8-BIT OR 16-BIT DELAYED REPLICATION SEQUENCE), THIS SUBROUTINE
11 C COMPUTES THE START AND END INDICES OF THE NEXT WINDOW.
13 C PROGRAM HISTORY LOG:
14 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
15 C 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
16 C "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
17 C ROUTINE "BORT"
18 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
19 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
20 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
21 C BUFR FILES UNDER THE MPI)
22 C 2002-05-14 J. WOOLLEN -- REMOVED OLD CRAY COMPILER DIRECTIVES
23 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
24 C INTERDEPENDENCIES
25 C 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
26 C INCREASED FROM 15000 TO 16000 (WAS IN
27 C VERIFICATION VERSION); UNIFIED/PORTABLE FOR
28 C WRF; ADDED DOCUMENTATION (INCLUDING
29 C HISTORY) (INCOMPLETE); OUTPUTS MORE
30 C COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
31 C TERMINATES ABNORMALLY
32 C 2009-03-31 J. WOOLLEN -- ADDED ADDITIONAL DOCUMENTATION
33 C 2009-05-07 J. ATOR -- USE LSTJPB INSTEAD OF LSTRPC
35 C USAGE: CALL NXTWIN (LUN, IWIN, JWIN)
36 C INPUT ARGUMENT LIST:
37 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
38 C IWIN - INTEGER: STARTING INDEX OF CURRENT WINDOW ITERATION
39 C JWIN - INTEGER: ENDING INDEX OF CURRENT WINDOW ITERATION
41 C OUTPUT ARGUMENT LIST:
42 C IWIN - INTEGER: STARTING INDEX OF NEXT WINDOW ITERATION
43 C JWIN - INTEGER: ENDING INDEX OF NEXT WINDOW ITERATION
45 C REMARKS:
47 C SEE THE DOCBLOCK IN BUFR ARCHIVE LIBRARY SUBROUTINE GETWIN FOR AN
48 C EXPLANATION OF "WINDOWS" WITHIN THE CONTEXT OF A BUFR DATA SUBSET.
50 C THIS ROUTINE CALLS: BORT LSTJPB
51 C THIS ROUTINE IS CALLED BY: UFBEVN UFBIN3 UFBRW
52 C Normally not called by any application
53 C programs.
55 C ATTRIBUTES:
56 C LANGUAGE: FORTRAN 77
57 C MACHINE: PORTABLE TO ALL PLATFORMS
59 C$$$
61 INCLUDE 'bufrlib.prm'
63 COMMON /USRINT/ NVAL(NFILES),INV(MAXSS,NFILES),VAL(MAXSS,NFILES)
65 CHARACTER*128 BORT_STR
66 REAL*8 VAL
68 C----------------------------------------------------------------------
69 C----------------------------------------------------------------------
71 IF(JWIN.EQ.NVAL(LUN)) THEN
72 IWIN = 0
73 GOTO 100
74 ENDIF
76 C FIND THE NEXT SEQUENTIAL WINDOW
77 C -------------------------------
79 NODE = INV(IWIN,LUN)
80 IF(LSTJPB(NODE,LUN,'RPC').NE.NODE) GOTO 900
81 IF(VAL(JWIN,LUN).EQ.0) THEN
82 IWIN = 0
83 ELSE
84 IWIN = JWIN
85 JWIN = IWIN+VAL(IWIN,LUN)
86 ENDIF
88 C EXITS
89 C -----
91 100 RETURN
92 900 WRITE(BORT_STR,'("BUFRLIB: NXTWIN - LSTJPB FOR NODE",I6," '//
93 . '(LSTJPB=",I5,") DOES NOT EQUAL VALUE OF NODE, NOT RPC (IWIN '//
94 . '=",I8,")")') NODE,LSTJPB(NODE,LUN,'RPC'),IWIN
95 CALL BORT(BORT_STR)
96 END