File: multi_fortran.F

package info (click to toggle)
grib-api 1.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 217,848 kB
  • ctags: 16,929
  • sloc: ansic: 111,244; sh: 14,785; makefile: 5,307; f90: 3,583; perl: 3,160; python: 2,830; yacc: 712; fortran: 468; lex: 330; cpp: 305; awk: 66
file content (78 lines) | stat: -rw-r--r-- 2,240 bytes parent folder | download
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
C Copyright 2005-2016 ECMWF.
C
C This software is licensed under the terms of the Apache Licence Version 2.0
C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C 
C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
C
C
C
C  Fortran 77 Implementation: multi_fortran
C
C  Description: How to decode grib messages containing multiple
C               fields. Try to turn on and off multi support to
C               see the difference. Default is OFF.
C         For all the tools defalut is multi support ON.
C
C
C
C
C
      program multi
      implicit none
      include 'grib_api_fortran.h'
      integer iret
      character*256 error
      integer*4 parameterCategory,parameterNumber,discipline
      integer ifile,igrib

      call grib_check( grib_open_file(ifile
     X,'../data/multi.grib2','r'))

C     turn on support for multi fields messages */
      call grib_check(grib_multi_support_on())

C     turn off support for multi fields messages */
C     call grib_check(grib_multi_support_off())

C     Loop on all the messages in a file.
  10  iret=grib_new_from_file(ifile,igrib)
      if (igrib .eq. -1 )  then
        if (iret .ne.0) then
       call grib_check(iret)
        endif
        stop
      endif

C     get as a integer*4
      call grib_check(grib_get_int(igrib,'discipline',discipline))
      write(*,*) 'discipline=',discipline

C     get as a integer*4
      call grib_check(grib_get_int(igrib,'parameterCategory'
     X,parameterCategory))
      write(*,*) 'parameterCategory=',parameterCategory

C     get as a integer*4
      call grib_check(grib_get_int(igrib,'parameterNumber'
     X,parameterNumber))
      write(*,*) 'parameterNumber=',parameterNumber

      if ( discipline .eq. 0 .and. parameterCategory .eq. 2) then
        if (parameterNumber .eq. 2) then
           write(*,*) "-------- u -------"
        endif
        if (parameterNumber .eq. 3) then
           write(*,*) "-------- v -------"
        endif
      endif

      goto 10

      call grib_check(grib_release(igrib))

      call grib_check(grib_close_file(ifile))

      end