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      INTEGER FUNCTION HNTFAU(INGRIB,INLEN)
12C
13C---->
14C**** HNTFAU
15C
16C     Purpose
17C     -------
18C
19C     Prepare to interpolate input field...
20C
21C
22C     Interface
23C     ---------
24C
25C     IRET = HNTFAU(INGRIB,INLEN)
26C
27C     Input
28C     -----
29C
30C     INGRIB - Input field (unpacked).
31C     INLEN  - Input field length (words).
32C
33C
34C     Output
35C     ------
36C
37C     Field unpacked values are in ZNFELDI, rotated if necessary.
38C
39C     Returns: 0, if OK. Otherwise, an error occured in interpolation.
40C
41C
42C     Method
43C     ------
44C
45C     Calls HNTFAUS to handle rotation when input and output fields
46C     are both spectral.
47C
48C     Calls HNTFAUH in all other cases.
49C
50C
51C     Externals
52C     ---------
53C
54C     HNTFAUS - Handle rotation when input and output fields
55C               are both spectral.
56C     HNTFAUH - Handle rotation in all other cases.
57C
58C
59C     Author
60C     ------
61C
62C     J.D.Chambers     ECMWF     January 31, 2001
63C
64C
65C----<
66C
67C     -----------------------------------------------------------------|
68C*    Section 0.   Variables
69C     -----------------------------------------------------------------|
70C
71      IMPLICIT NONE
72C
73#include "parim.h"
74#include "nifld.common"
75#include "nofld.common"
76C
77C     Parameters
78C
79      INTEGER JPROUTINE
80      PARAMETER (JPROUTINE = 40130 )
81C
82C     Function arguments
83C
84      INTEGER INGRIB(*),INLEN
85C
86C     Externals
87C
88      INTEGER  HNTFAUS, HNTFAUH
89      EXTERNAL HNTFAUS, HNTFAUH
90C
91C     -----------------------------------------------------------------|
92C*    Section 1.   Split handling in case there are rotations to do.
93C     -----------------------------------------------------------------|
94C
95  100 CONTINUE
96C
97C     Is the interpolation from SH to SH?
98C
99      IF( ((NIREPR.EQ.JPSPHERE).OR.(NIREPR.EQ.JPSPHROT)) .AND.
100     X    ((NOREPR.EQ.JPSPHERE).OR.(NOREPR.EQ.JPSPHROT)) ) THEN
101C
102        HNTFAU = HNTFAUS(INGRIB,INLEN)
103C
104      ELSE
105C
106        HNTFAU = HNTFAUH(INGRIB,INLEN)
107C
108      ENDIF
109C
110C     -----------------------------------------------------------------|
111C*    Section 9.   Closedown.
112C     -----------------------------------------------------------------|
113C
114  900 CONTINUE
115C
116      RETURN
117      END
118