Each element in the data section of a BUFR can be missing.  ecCodes provides a simple way for the user to check if the value of an element is missing by comparing with two constants

Step-by-step guide

Each element in the data section of a BUFR can be missing.  ecCodes provides a simple way for the user to check if the value of an element is missing by comparing with two constants:

CODES_MISSING_LONG
CODES_MISSING_DOUBLE

These constants are available in Python, Fortran 90 and C and the user needs to compare with the appropriate constant depending on the type of the variable used. This is an example of Fortran 90 code:

<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #888888">!declare backscatter as double precision</span>
<span style="color: #333399; font-weight: bold">real</span>(<span style="color: #007020">kind</span><span style="color: #333333">=</span><span style="color: #0000DD; font-weight: bold">8</span>), <span style="color: #008800; font-weight: bold">dimension</span>(:), <span style="color: #008800; font-weight: bold">allocatable</span> <span style="color: #008800; font-weight: bold">::</span> <span style="color: #996633">backscatter</span>
  
<span style="color: #888888">!get the values</span>
<span style="color: #008800; font-weight: bold">call </span><span style="color: #996633">codes_get</span>(<span style="color: #996633">ibufr</span>,<span style="background-color: #fff0f0">'/beamIdentifier=2/backscatter'</span>,<span style="color: #996633">backscatter</span>);
<span style="color: #008800; font-weight: bold">do </span><span style="color: #996633">i</span><span style="color: #333333">=</span><span style="color: #0000DD; font-weight: bold">1</span>,<span style="color: #996633">size</span>(<span style="color: #996633">backscatter</span>)
    <span style="color: #888888">!compare with double precision missing</span>
    <span style="color: #008800; font-weight: bold">if</span> (<span style="color: #996633">backscatter</span>(<span style="color: #996633">i</span>)<span style="color: #333333">/=</span><span style="color: #996633">CODES_MISSING_DOUBLE</span>) <span style="color: #008800; font-weight: bold">then</span>
        <span style="color: #888888">!process non missing values</span>
    <span style="color: #008800; font-weight: bold">else</span>
        <span style="color: #888888">!process missing values</span>
    <span style="color: #008800; font-weight: bold">endif</span>
<span style="color: #008800; font-weight: bold">end do</span>
</pre></div>


Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.