File: getflag.F

package info (click to toggle)
emoslib 000382%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 49,276 kB
  • sloc: fortran: 90,253; ansic: 26,730; makefile: 417; sh: 388; f90: 276
file content (133 lines) | stat: -rwxr-xr-x 2,418 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
C Copyright 1981-2007 ECMWF
C 
C Licensed under the GNU Lesser General Public License which
C incorporates the terms and conditions of version 3 of the GNU
C General Public License.
C See LICENSE and gpl-3.0.txt for details.
C

      SUBROUTINE GETFLAG(KREF,KCODE,KFLAG,YFLAG,KERR)
C
C**** *GETFLAG*
C
C
C     PURPOSE.
C     --------
C
C          The main purpose of the subroutine is to get text 
C          associated with code number 
C
C**   INTERFACE.
C     ----------
C          NONE.
C
C
C
C
C     *METHOD.
C      -------
C          NONE.
C
C
C
C     EXTERNALS.
C     ----------
C          NONE.
C
C
C
C
C     REFERENCE.
C     ----------
C
C
C     AUTHOR.
C     -------
C
C          M. DRAGOSAVAC       *ECMWF*       JANUARY 2008.
C
C
C     MODIFICATIONS.
C     --------------
C
C          NONE.
C
C
      IMPLICIT LOGICAL(L,O,G), CHARACTER*8(C,H,Y)
C
#     include "parameter.F"
#     include "bcomwork.F"
#     include "bcomtab.F"
#     include "bcomtabc.F"
#     include "bcomct.F"
#     include "bcomctc.F"
#     include "bcomroot.F"
C#     include "bcomtabload.F"
C#     include "bcomtabloadc.F"


C
      CHARACTER*64  CTEXT
      CHARACTER*64  CTABBEN
      CHARACTER*24  CTABBU
      CHARACTER*64  YFLAG(32)
C
C
C     ------------------------------------------------------------------
C*          1.   SET INITIAL CONSTANTS AND POINTERS
C                ----------------------------------
 100  CONTINUE
C
      J=0
      do i=1,32
      YFLAG(i)=' '
      end do
C
      do i=1,JCTAB
      if(nref(i).eq.kref) go to 200
      end do
      print*,'Could not find ',kref
      ierr=2
      return      
c
 200  continue
C
      ictab=i
C
C     Find data width for kref
C
      do i=1,JTAB
      if(NTABBTR(I).eq.kref) go to 201
      end do

      print*,'Could not find ',kref
      ierr=2
      return
 201  continue
c
      ibtab=i
c
      iwidth=NTABBDW(ibtab)
c
      if(KCODE.eq.NMASK(iwidth)) then
         KFLAG=1
         YFLAG(1)='MISSING VALUE'         
         return
      else
         ipt=nstart(ictab)
         iptc=nstartc(ipt)
         KFLAG=0
         do i=ipt,ipt+nlen(ictab)-1
            ibitnumber=ncodnum(i)
c           test bit 
            ipos=iwidth-ibitnumber
            if(btest(KCODE,ipos)) then
               ic=iptc+ibitnumber-1
               KFLAG=KFLAG+1
               YFLAG(KFLAG)=ctext(ic)
            end if
         end do
      end if

      return
      END