NCEPLIBS-bufr 11.7.1
ufbrp.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS SUBROUTINE WRITES OR READS SPECIFIED VALUES TO OR
5C> FROM THE CURRENT BUFR DATA SUBSET WITHIN INTERNAL ARRAYS, WITH THE
6C> DIRECTION OF THE DATA TRANSFER DETERMINED BY THE CONTEXT OF IO
7C> (I.E., IF IO INDICATES LUN POINTS TO A BUFR FILE THAT IS OPEN FOR
8C> INPUT, THEN DATA VALUES ARE READ FROM THE INTERNAL DATA SUBSET;
9C> OTHERWISE, DATA VALUES ARE WRITTEN TO THE INTERNAL DATA SUBSET).
10C> THE DATA VALUES CORRESPOND TO INTERNAL ARRAYS REPRESENTING PARSED
11C> STRINGS OF MNEMONICS WHICH ARE EITHER:
12C> 1) PART OF A REGULAR (I.E., NON-DELAYED) REPLICATION SEQUENCE
13C> OR
14C> 2) REPLICATED BY BEING DIRECTLY LISTED MORE THAN ONCE WITHIN AN
15C> OVERALL SUBSET DEFINITION
16C>
17C> THIS SUBROUTINE SHOULD NEVER BE CALLED BY ANY APPLICATION PROGRAM;
18C> INSTEAD, APPLICATION PROGRAMS SHOULD ALWAYS CALL BUFR ARCHIVE
19C> LIBRARY SUBROUTINE UFBREP.
20C>
21C> PROGRAM HISTORY LOG:
22C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
23C> 1998-07-08 J. WOOLLEN -- IMPROVED MACHINE PORTABILITY
24C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
25C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
26C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
27C> BUFR FILES UNDER THE MPI)
28C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
29C> INTERDEPENDENCIES
30C> 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
31C> INCREASED FROM 15000 TO 16000 (WAS IN
32C> VERIFICATION VERSION); UNIFIED/PORTABLE FOR
33C> WRF; ADDED DOCUMENTATION (INCLUDING
34C> HISTORY)
35C> 2009-03-31 J. WOOLLEN -- ADD DOCUMENTATION
36C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
37C>
38C> USAGE: CALL UFBRP (LUN, USR, I1, I2, IO, IRET)
39C> INPUT ARGUMENT LIST:
40C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
41C> USR - ONLY IF BUFR FILE OPEN FOR OUTPUT:
42C> REAL*8: (I1,I2) STARTING ADDRESS OF DATA VALUES
43C> WRITTEN TO DATA SUBSET
44C> I1 - INTEGER: LENGTH OF FIRST DIMENSION OF USR
45C> I2 - INTEGER: LENGTH OF SECOND DIMENSION OF USR
46C> IO - INTEGER: STATUS INDICATOR FOR BUFR FILE ASSOCIATED
47C> WITH LUN:
48C> 0 = input file
49C> 1 = output file
50C>
51C> OUTPUT ARGUMENT LIST:
52C> USR - ONLY IF BUFR FILE OPEN FOR INPUT:
53C> REAL*8: (I1,I2) STARTING ADDRESS OF DATA VALUES
54C> READ FROM DATA SUBSET
55C> IRET - INTEGER:
56C> - IF BUFR FILE OPEN FOR INPUT: NUMBER OF "LEVELS" OF
57C> DATA VALUES READ FROM DATA SUBSET (MUST BE NO
58C> LARGER THAN I2)
59C> - IF BUFR FILE OPEN FOR OUTPUT: NUMBER OF "LEVELS"
60C> OF DATA VALUES WRITTEN TO DATA SUBSET (SHOULD BE
61C> SAME AS I2)
62C>
63C> REMARKS:
64C> THIS ROUTINE CALLS: INVTAG
65C> THIS ROUTINE IS CALLED BY: UFBREP
66C> Normally not called by any application
67C> programs (they should call UFBREP).
68C>
69 SUBROUTINE ufbrp(LUN,USR,I1,I2,IO,IRET)
70
71 USE moda_usrint
72
73 COMMON /usrstr/ nnod,ncon,nods(20),nodc(10),ivls(10),kons(10)
74
75 real*8 usr(i1,i2)
76
77C----------------------------------------------------------------------
78C----------------------------------------------------------------------
79
80 iret = 0
81 ins1 = 0
82 ins2 = 0
83
84C FIND FIRST NON-ZERO NODE IN STRING
85C ----------------------------------
86
87 DO nz=1,nnod
88 IF(nods(nz).GT.0) GOTO 1
89 ENDDO
90 GOTO 100
91
92C FRAME A SECTION OF THE BUFFER - RETURN WHEN NO FRAME
93C ----------------------------------------------------
94
951 IF(ins1+1.GT.nval(lun)) GOTO 100
96 IF(io.EQ.1 .AND. iret.EQ.i2) GOTO 100
97 ins1 = invtag(nods(nz),lun,ins1+1,nval(lun))
98 IF(ins1.EQ.0) GOTO 100
99
100 ins2 = invtag(nods(nz),lun,ins1+1,nval(lun))
101 IF(ins2.EQ.0) ins2 = nval(lun)
102 iret = iret+1
103
104C READ USER VALUES
105C ----------------
106
107 IF(io.EQ.0 .AND. iret.LE.i2) THEN
108 DO i=1,nnod
109 IF(nods(i).GT.0) THEN
110 invn = invtag(nods(i),lun,ins1,ins2)
111 IF(invn.GT.0) usr(i,iret) = val(invn,lun)
112 ENDIF
113 ENDDO
114 ENDIF
115
116C WRITE USER VALUES
117C -----------------
118
119 IF(io.EQ.1 .AND. iret.LE.i2) THEN
120 DO i=1,nnod
121 IF(nods(i).GT.0) THEN
122 invn = invtag(nods(i),lun,ins1,ins2)
123 IF(invn.GT.0) val(invn,lun) = usr(i,iret)
124 ENDIF
125 ENDDO
126 ENDIF
127
128C GO FOR NEXT FRAME
129C -----------------
130
131 GOTO 1
132
133C EXIT
134C ----
135
136100 RETURN
137 END
function invtag(NODE, LUN, INV1, INV2)
THIS FUNCTION LOOKS FOR A SPECIFIED MNEMONIC WITHIN THE PORTION OF THE CURRENT SUBSET BUFFER BOUNDED ...
Definition: invtag.f:50
subroutine ufbrp(LUN, USR, I1, I2, IO, IRET)
THIS SUBROUTINE WRITES OR READS SPECIFIED VALUES TO OR FROM THE CURRENT BUFR DATA SUBSET WITHIN INTER...
Definition: ufbrp.f:70