1C Copyright 1981-2016 ECMWF.
2C
3C This software is licensed under the terms of the Apache Licence
4C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5C
6C In applying this licence, ECMWF does not waive the privileges and immunities
7C granted to it by virtue of its status as an intergovernmental organisation
8C nor does it submit to any jurisdiction.
9C
10
11      LOGICAL FUNCTION PRECIP()
12C
13C---->
14C**** PRECIP
15C
16C     Purpose
17C     -------
18C
19C     Determines whether or not the current field is to be
20C     considered for 'precipitation' treatment.
21C
22C
23C     Interface
24C     ---------
25C
26C     LPRECIP = PRECIP()
27C
28C     Input
29C     -----
30C
31C     None
32C
33C
34C     Output
35C     ------
36C
37C     Function returns .TRUE. if the field is to be treated as
38C     precipitation.
39C
40C
41C     Method
42C     ------
43C
44C     Uses a set of hardcoded rules.
45C
46C
47C     Externals
48C     ---------
49C
50C     INTLOG  - Logs messages
51C
52C     Uses common blocks nifld.common and nofld.common.
53C
54C
55C     Author
56C     ------
57C
58C     J.D.Chambers     ECMWF     April 2001
59C
60C----<
61C
62      IMPLICIT NONE
63C
64#include "parim.h"
65#include "nifld.common"
66#include "nofld.common"
67C
68C     Local variables
69C
70      LOGICAL LIKELY
71C
72C     -----------------------------------------------------------------|
73C*    Section 1. Initialise
74C     -----------------------------------------------------------------|
75C
76  100 CONTINUE
77C
78C     If 'useprecip' has been forced to 'yes' ...
79C
80      IF( LPRECSET ) THEN
81        PRECIP = LPREC
82        GOTO 900
83      ENDIF
84C
85C     WMO International table 001 for meteorological parameters
86C
87      IF ( NITABLE.EQ.1 ) THEN
88        LIKELY = ( NIPARAM.EQ.61 ).OR.
89     X           ( NIPARAM.EQ.62 ).OR.
90     X           ( NIPARAM.EQ.63 ).OR.
91     X           ( NIPARAM.EQ.64 ).OR.
92     X           ( NIPARAM.EQ.65)
93C
94C     ECMWF local code table 128 for meteorological parameters
95C
96      ELSEIF ( (NITABLE.EQ.128).OR.(NITABLE.EQ.129) ) THEN
97        LIKELY = ( NIPARAM.EQ.142 ).OR.
98     X           ( NIPARAM.EQ.143 ).OR.
99     X           ( NIPARAM.EQ.144 ).OR.
100     X           ( NIPARAM.EQ.228 ).OR.
101     X           ( NIPARAM.EQ.239 ).OR.
102     X           ( NIPARAM.EQ.240 )
103      ELSE
104        LIKELY = .FALSE.
105      ENDIF
106C
107      IF( .NOT.LIKELY ) THEN
108        PRECIP = .FALSE.
109        GOTO 900
110      ENDIF
111C
112C     -----------------------------------------------------------------|
113C*    Section 2. Work through the special cases
114C     -----------------------------------------------------------------|
115C
116  200 CONTINUE
117C
118C     Monthly forecast means using ECMWF local definition 16
119C
120      IF( NILOCAL.EQ.16 ) THEN
121        PRECIP = .FALSE.
122        GOTO 900
123      ENDIF
124C
125C     Extreme forecast index using ECMWF local definition 19
126C
127      IF( NILOCAL.EQ.19 ) THEN
128        PRECIP = .FALSE.
129        GOTO 900
130      ENDIF
131C
132C     Coupled Atmospheric, Wave and Ocean models (with hindcast support)
133C     using ECMWF local definition 23
134C
135      IF( NILOCAL.EQ.23 ) THEN
136        PRECIP = .FALSE.
137        GOTO 900
138      ENDIF
139C
140C     ERA fields using code table 160
141C
142      IF( NITABLE.EQ.160 ) THEN
143        PRECIP = .FALSE.
144        GOTO 900
145      ENDIF
146C
147      PRECIP = .TRUE.
148C
149C     -----------------------------------------------------------------|
150C*    Section 9.   Return
151C     -----------------------------------------------------------------|
152C
153  900 CONTINUE
154C
155      IF( .NOT.PRECIP ) THEN
156        CALL INTLOG(JP_DEBUG,
157     X    'PRECIP: Do not handle field as precipitation', JPQUIET)
158      ELSE
159        CALL INTLOG(JP_DEBUG,
160     X    'PRECIP: Handle field as precipitation', JPQUIET)
161      ENDIF
162C
163      RETURN
164      END
165