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      SUBROUTINE CHKPREC()
12C
13C---->
14C**** CHKPREC
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     CALL CHKPREC()
27C
28C     Input
29C     -----
30C
31C     None
32C
33C
34C     Output
35C     ------
36C
37C     Sets the precipitation threshold if give by environment variable
38C     PRECIPITATION_THRESHOLD. Otherwise gives it a default value.
39C
40C
41C     Method
42C     ------
43C
44C     See below.
45C
46C
47C     Externals
48C     ---------
49C
50C     INTLOG  - Logs messages
51C
52C     Uses common block nifld.common
53C
54C
55C     Author
56C     ------
57C
58C     J.D.Chambers     ECMWF     December 2003
59C
60C----<
61C
62C
63      IMPLICIT NONE
64C
65#include "parim.h"
66#include "nifld.common"
67C
68C     Local variables
69C
70      CHARACTER*20 PTHRESH
71      INTEGER IBLANK
72      LOGICAL LFIRST
73      DATA LFIRST/.TRUE./
74      SAVE LFIRST
75C
76C     -----------------------------------------------------------------|
77C*    Section 1. Initialise
78C     -----------------------------------------------------------------|
79C
80  100 CONTINUE
81C
82      IF( LFIRST ) THEN
83        LFIRST = .FALSE.
84        CALL GETENV('PRECIPITATION_THRESHOLD',PTHRESH)
85        IBLANK = INDEX(PTHRESH, ' ')
86        IF( IBLANK.GT.1 ) THEN
87          READ(PTHRESH,'(F15.8)') ZPRECIP
88        ELSE
89          ZPRECIP = 0.00005
90        ENDIF
91C
92        CALL INTLOGR(JP_DEBUG,
93     X    'CHKPREC: PRECIPITATION_THRESHOLD = ',ZPRECIP)
94      ENDIF
95C
96C     -----------------------------------------------------------------|
97C*    Section 9.   Return
98C     -----------------------------------------------------------------|
99C
100  900 CONTINUE
101      RETURN
102      END
103