eccodes/html/get__pv_8f90-example.html

71 lines
4.1 KiB
HTML

<!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: get_pv.f90</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&nbsp;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&nbsp;Pages</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<h1>get_pv.f90</h1>How to get the list of levels.<p>
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ! Copyright 2005-2013 ECMWF
<a name="l00002"></a>00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
<a name="l00003"></a>00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
<a name="l00004"></a>00004 !
<a name="l00005"></a>00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
<a name="l00006"></a>00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
<a name="l00007"></a>00007 !
<a name="l00008"></a>00008 !
<a name="l00009"></a>00009 ! Description: how to <span class="keyword">get</span> PV values.
<a name="l00010"></a>00010 !
<a name="l00011"></a>00011 !
<a name="l00012"></a>00012 ! Author: Anne Fouilloux
<a name="l00013"></a>00013 !
<a name="l00014"></a>00014 !
<a name="l00015"></a>00015 program get_pv
<a name="l00016"></a>00016 use grib_api
<a name="l00017"></a>00017 implicit none
<a name="l00018"></a>00018 integer :: infile
<a name="l00019"></a>00019 integer :: igrib
<a name="l00020"></a>00020 integer :: PVPresent, nb_pv
<a name="l00021"></a>00021 real, dimension(:), allocatable :: pv
<a name="l00022"></a>00022
<a name="l00023"></a>00023
<a name="l00024"></a>00024 call grib_open_file(infile, &amp;
<a name="l00025"></a>00025 '../../data/reduced_gaussian_model_level.grib1<span class="charliteral">','</span>r')
<a name="l00026"></a>00026
<a name="l00027"></a>00027 ! a <span class="keyword">new</span> grib message is loaded from file
<a name="l00028"></a>00028 ! igrib is the grib <span class="keywordtype">id</span> to be used in subsequent calls
<a name="l00029"></a>00029 call grib_new_from_file(infile,igrib)
<a name="l00030"></a>00030
<a name="l00031"></a>00031 ! <span class="keyword">set</span> PVPresent as an integer
<a name="l00032"></a>00032 call grib_get(igrib,'PVPresent',PVPresent)
<a name="l00033"></a>00033 print*, "PVPresent = ", PVPresent
<a name="l00034"></a>00034 if (PVPresent == 1) then
<a name="l00035"></a>00035 call <a name="a0"></a><a class="code" href="group__get__set.html#g18b622ed86b24d5e5fcab70c309fc245" title="Get the number of coded value from a key, if several keys of the same name are present...">grib_get_size</a>(igrib,'pv',nb_pv)
<a name="l00036"></a>00036 print*, "There are ", nb_pv, " PV values"
<a name="l00037"></a>00037 allocate(pv(nb_pv))
<a name="l00038"></a>00038 call grib_get(igrib,'pv',pv)
<a name="l00039"></a>00039 print*, "pv = ", pv
<a name="l00040"></a>00040 deallocate(pv)
<a name="l00041"></a>00041 else
<a name="l00042"></a>00042 print*, "There is no PV values in your GRIB message!"
<a name="l00043"></a>00043 end if
<a name="l00044"></a>00044 call grib_release(igrib)
<a name="l00045"></a>00045
<a name="l00046"></a>00046 call grib_close_file(infile)
<a name="l00047"></a>00047
<a name="l00048"></a>00048 end program get_pv
</pre></div> <hr size="1"><address style="text-align: right;"><small>Generated on Tue Sep 22 15:18:21 2009 for grib_api by&nbsp;
<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>