2013-04-02 14:02:10 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
< html > < head > < meta http-equiv = "Content-Type" content = "text/html;charset=UTF-8" >
< title > grib_api: multi_fortran.F< / title >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" >
< / head > < body >
<!-- Generated by Doxygen 1.5.3 -->
< div class = "tabs" >
< ul >
< li > < a href = "index.html" > < span > Main Page< / span > < / a > < / li >
< li > < a href = "modules.html" > < span > Modules< / span > < / a > < / li >
< li > < a href = "files.html" > < span > Files< / span > < / a > < / li >
< li > < a href = "pages.html" > < span > Related Pages< / span > < / a > < / li >
< li > < a href = "examples.html" > < span > Examples< / span > < / a > < / li >
< / ul >
< / div >
< h1 > multi_fortran.F< / h1 > multi_fortran.F How to decode a grib message containing many fields.< p >
2015-01-05 15:45:46 +00:00
< div class = "fragment" > < pre class = "fragment" > < a name = "l00001" > < / a > 00001 C Copyright 2005-2015 ECMWF
2013-04-02 14:02:10 +00:00
< a name = "l00002" > < / a > 00002 C This software is licensed under the terms of the Apache Licence Version 2.0
< a name = "l00003" > < / a > 00003 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
< a name = "l00004" > < / a > 00004 C
< a name = "l00005" > < / a > 00005 C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
< a name = "l00006" > < / a > 00006 C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
< a name = "l00007" > < / a > 00007 C
< a name = "l00008" > < / a > 00008 C
< a name = "l00009" > < / a > 00009 C Fortran 77 Implementation: multi_fortran
< a name = "l00010" > < / a > 00010 C
< a name = "l00011" > < / a > 00011 C Description: How to decode grib messages containing multiple
< a name = "l00012" > < / a > 00012 C fields. Try to turn on and off multi support to
< a name = "l00013" > < / a > 00013 C see the difference. Default is OFF.
< a name = "l00014" > < / a > 00014 C For all the tools defalut is multi support ON.
< a name = "l00015" > < / a > 00015 C
< a name = "l00016" > < / a > 00016 C
< a name = "l00017" > < / a > 00017 C Author: Enrico Fucile
< a name = "l00018" > < / a > 00018 C
< a name = "l00019" > < / a > 00019 C
< a name = "l00020" > < / a > 00020 C
< a name = "l00021" > < / a > 00021 program multi
< a name = "l00022" > < / a > 00022 implicit none
< a name = "l00023" > < / a > 00023 include 'grib_api_f77.h'
< a name = "l00024" > < / a > 00024 integer iret
< a name = "l00025" > < / a > 00025 character*256 error
< a name = "l00026" > < / a > 00026 integer*4 parameterCategory,parameterNumber,discipline
< a name = "l00027" > < / a > 00027 integer ifile,igrib
< a name = "l00028" > < / a > 00028
< a name = "l00029" > < / a > 00029 call grib_check( grib_open_file(ifile
< a name = "l00030" > < / a > 00030 X,'../../data/multi.grib2< span class = "charliteral" > ','< / span > r'))
< a name = "l00031" > < / a > 00031
< a name = "l00032" > < / a > 00032 C turn on support for multi fields messages */
< a name = "l00033" > < / a > 00033 call grib_check(< a name = "a0" > < / a > < a class = "code" href = "group__context.html#g3266536e68ebb6d4bbc4a22b29f0e8ea" title = "Turn on support for multiple fields in single grib messages." > grib_multi_support_on< / a > ())
< a name = "l00034" > < / a > 00034
< a name = "l00035" > < / a > 00035 C turn off support for multi fields messages */
< a name = "l00036" > < / a > 00036 C call grib_check(< a name = "a1" > < / a > < a class = "code" href = "group__context.html#gc022270a99922ccc57147670ed2a58d4" title = "Turn off support for multiple fields in single grib messages." > grib_multi_support_off< / a > ())
< a name = "l00037" > < / a > 00037
< a name = "l00038" > < / a > 00038 C Loop on all the messages in a file.
< a name = "l00039" > < / a > 00039 10 iret=grib_new_from_file(ifile,igrib)
< a name = "l00040" > < / a > 00040 if (igrib .eq. -1 ) then
< a name = "l00041" > < / a > 00041 if (iret .ne.0) then
< a name = "l00042" > < / a > 00042 call grib_check(iret)
< a name = "l00043" > < / a > 00043 endif
< a name = "l00044" > < / a > 00044 stop
< a name = "l00045" > < / a > 00045 endif
< a name = "l00046" > < / a > 00046
< a name = "l00047" > < / a > 00047 C get as a integer*4
< a name = "l00048" > < / a > 00048 call grib_check(grib_get_int(igrib,'discipline',discipline))
< a name = "l00049" > < / a > 00049 write(*,*) 'discipline=',discipline
< a name = "l00050" > < / a > 00050
< a name = "l00051" > < / a > 00051 C get as a integer*4
< a name = "l00052" > < / a > 00052 call grib_check(grib_get_int(igrib,'parameterCategory'
< a name = "l00053" > < / a > 00053 X,parameterCategory))
< a name = "l00054" > < / a > 00054 write(*,*) 'parameterCategory=',parameterCategory
< a name = "l00055" > < / a > 00055
< a name = "l00056" > < / a > 00056 C get as a integer*4
< a name = "l00057" > < / a > 00057 call grib_check(grib_get_int(igrib,'parameterNumber'
< a name = "l00058" > < / a > 00058 X,parameterNumber))
< a name = "l00059" > < / a > 00059 write(*,*) 'parameterNumber=',parameterNumber
< a name = "l00060" > < / a > 00060
< a name = "l00061" > < / a > 00061 if ( discipline .eq. 0 .and. parameterCategory .eq. 2) then
< a name = "l00062" > < / a > 00062 if (parameterNumber .eq. 2) then
< a name = "l00063" > < / a > 00063 write(*,*) "-------- u -------"
< a name = "l00064" > < / a > 00064 endif
< a name = "l00065" > < / a > 00065 if (parameterNumber .eq. 3) then
< a name = "l00066" > < / a > 00066 write(*,*) "-------- v -------"
< a name = "l00067" > < / a > 00067 endif
< a name = "l00068" > < / a > 00068 endif
< a name = "l00069" > < / a > 00069
< a name = "l00070" > < / a > 00070 goto 10
< a name = "l00071" > < / a > 00071
< a name = "l00072" > < / a > 00072 call grib_check(grib_release(igrib))
< a name = "l00073" > < / a > 00073
< a name = "l00074" > < / a > 00074 call grib_check(grib_close_file(ifile))
< a name = "l00075" > < / a > 00075
< a name = "l00076" > < / a > 00076 end
< a name = "l00077" > < / a > 00077
< / pre > < / div > < hr size = "1" > < address style = "text-align: right;" > < small > Generated on Tue Sep 22 15:18:21 2009 for grib_api by
< a href = "http://www.doxygen.org/index.html" >
< img src = "doxygen.png" alt = "doxygen" align = "middle" border = "0" > < / a > 1.5.3 < / small > < / address >
< / body >
< / html >