Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

...

Source code

Tabs Container
directionhorizontal
Tabs Page
titleFortran 90
Code Block
languagenone
titlebufr_read_tropical_cyclone.f90
linenumbersfalse

HTML
<pre style='color:#000000;background:#ffffff;'><span style='color:#696969; '>!Copyright 2005-20152016 ECMWF.</span>
<span style='color:#696969; '>!</span>
<span style='color:#696969; '>! This software is licensed under the terms of the Apache Licence Version 2.0</span>
<span style='color:#696969; '>0
!which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.</span>
<span style='color:#696969; '>!</span>
<span style='color:#696969; '>! In! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by</span>
<span style='color:#696969; '>by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.</span>
<span style='color:#696969; '>!</span>
<span style='color:#696969; '>!</span>
<span style='color:#696969; '>! FOTRAN 90 Implementation: bufr_read_tropical_cyclone</span>
<span style='color:#696969; '>!</span>
<span style='color:#696969; '>cyclone
!
! Description: how to read data for a tropical cyclone BUFR messagesmessage.</span>
<span style='color:#696969; '>!</span>
 
<span style='color:#800000; font-weight:bold; '>program</span> ! 

program bufr_read_tropical_cyclone
  <span style='color:#800000; font-weight:bold; '>use</span> eccodes
  <span style='color:#800000; font-weight:bold; '>implicit</span> none
  <span style='color:#800000; font-weight:bold; '>integer</span>  use eccodes
  implicit none
  integer            :: ifile
  integer          <span style='color:#808030; '>::</span> ifileiret
  integer <span style='color:#800000; font-weight:bold; '>integer</span>           :: ibufr,skipMember
  integer      <span style='color:#808030; '>::</span> iret
  <span style='color:#800000; font-weight:bold; '>integer</span> significance
  integer          <span style='color:#808030; '>::</span> ibufr<span style='color:#808030; '>,</span>skipMember year,month,day,hour,minute 
  <span style='color:#800000; font-weight:bold; '>integer</span>integer            :: i,j,k,ierr,count=1
  integer  <span style='color:#808030; '>::</span> significance
  <span style='color:#800000; font-weight:bold; '>integer</span>            :: rankPosition,rankSignificance,rankPressure,rankWind
  integer          <span style='color:#808030; '>::</span> year<span style='color:#808030; '>,</span>month<span style='color:#808030; '>,</span>day<span style='color:#808030; '>,</span>hour<span style='color:#808030; '>,</span>minute
  <span style='color:#800000; font-weight:bold; '>integer</span>            <span style='color:#808030; '>::</span> i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>,</span>k<span style='color:#808030; '>,</span>ierr<span style='color:#808030; '>,</span>count<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span>
  <span style='color:#800000; font-weight:bold; '>integer</span>            <span style='color:#808030; '>::</span> rankPosition<span style='color:#808030; '>,</span>rankSignificance<span style='color:#808030; '>,</span>rankPressure<span style='color:#808030; '>,</span>rankWind
  <span style='color:#800000; font-weight:bold; '>integer</span>            <span style='color:#808030; '>::</span> rankPeriod<span style='color:#808030; '>,</span>numberOfPeriods
 
  <span style='color:#800000; font-weight:bold; '>real</span><span style='color:#808030; '>(</span>kind<span style='color:#808030; '>=</span><span style='color:#008c00; '>8</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>::</span> latitudeCentre<span style='color:#808030; '>,</span>longitudeCentre
  <span style='color:#800000; font-weight:bold; '>real</span><span style='color:#808030; '>(</span>kind<span style='color:#808030; '>=</span><span style='color:#008c00; '>8</span><span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>dimension</span><span style='color:#808030; '>(</span>:<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>allocatable</span> <span style='color:#808030; '>::</span> latitudeMaxWind0<span style='color:#808030; '>,</span>longitudeMaxWind0<span style='color:#808030; '>,</span>windMaxWind0
  <span style='color:#800000; font-weight:bold; '>real</span><span style='color:#808030; '>(</span>kind<span style='color:#808030; '>=</span><span style='color:#008c00; '>8</span><span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>dimension</span><span style='color:#808030; '>(</span>:<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>allocatable</span> <span style='color:#808030; '>::</span> latitudeAnalysis<span style='color:#808030; '>,</span>longitudeAnalysis<span style='color:#808030; '>,</span>pressureAnalysis
  <span style='color:#800000; font-weight:bold; '>real</span><span style='color:#808030; '>(</span>kind<span style='color:#808030; '>=</span><span style='color:#008c00; '>8</span><span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>dimension</span><span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span>:<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>allocatable</span> <span style='color:#808030; '>::</span> latitude<span style='color:#808030; '>,</span>longitude<span style='color:#808030; '>,</span>pressure
  <span style='color:#800000; font-weight:bold; '>real</span><span style='color:#808030; '>(</span>kind<span style='color:#808030; '>=</span><span style='color:#008c00; '>8</span><span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>dimension</span><span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span>:<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>allocatable</span> <span style='color:#808030; '>::</span> latitudeWind<span style='color:#808030; '>,</span>longitudeWind<span style='color:#808030; '>,</span>wind
  <span style='color:#800000; font-weight:bold; '>integer</span><span style='color:#808030; '>(</span>kind<span style='color:#808030; '>=</span><span style='color:#008c00; '>4</span><span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>dimension</span><span style='color:#808030; '>(</span>:<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>allocatable</span> <span style='color:#808030; '>::</span> memberNumber<span style='color:#808030; '>,</span>period
  <span style='color:#800000; font-weight:bold; '>real</span><span style='color:#808030; '>(</span>kind<span style='color:#808030; '>=</span><span style='color:#008c00; '>8</span><span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>dimension</span><span style='color:#808030; '>(</span>:<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>allocatable</span> <span style='color:#808030; '>::</span> values
  <span style='color:#800000; font-weight:bold; '>integer</span><span style='color:#808030; '>(</span>kind<span style='color:#808030; '>=</span><span style='color:#008c00; '>4</span><span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>dimension</span><span style='color:#808030; '>(</span>:<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>allocatable</span> <span style='color:#808030; '>::</span> ivalues
 
  <span style='color:#800000; font-weight:bold; '>character</span><span style='color:#808030; '>(</span>len<span style='color:#808030; '>=</span><span style='color:#008c00; '>8</span><span style='color:#808030; '>)</span>   <span style='color:#808030; '>::</span> rankSignificanceStr<span style='color:#808030; '>,</span>rankPositionStr<span style='color:#808030; '>,</span>rankPressureStr<span style='color:#808030; '>,</span>rankWindStr
  <span style='color:#800000; font-weight:bold; '>character</span><span style='color:#808030; '>(</span>len<span style='color:#808030; '>=</span><span style='color:#008c00; '>8</span><span style='color:#808030; '>)</span>   <span style='color:#808030; '>::</span> stormIdentifier<span style='color:#808030; '>,</span>rankPeriodStr
 
  <span style='color:#800000; font-weight:bold; '>call</span> codes_open_file<span style='color:#808030; '>(</span>ifile<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'../../data/bufr/tropical_cyclone.bufr'</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'r'</span><span style='color:#808030; '>)</span>
 
  <span style='color:#696969; '>! the first bufr message is loaded from file</span>
  <span style='color:#696969; '>! ibufr is the bufr id to be used in subsequent calls</span>
  <span style='color:#800000; font-weight:bold; '>call</span> codes_bufr_new_from_file<span style='color:#808030; '>(</span>ifile<span style='color:#808030; '>,</span>ibufr<span style='color:#808030; '>,</span>iret<span style='color:#808030; '>)</span>
 
  <span style='color:#800000; font-weight:bold; '>do</span> <span style='color:#800000; font-weight:bold; '>while</span> <span style='color:#808030; '>(</span>iret<span style='color:#808030; '>/</span><span style='color:#808030; '>=</span>CODES_END_OF_FILE<span style='color:#808030; '>)</span>
 
    <span style='color:#800000; font-weight:bold; '>write</span><span style='color:#808030; '>(</span><span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(A,I3,A)'</span><span style='color:#808030; '>)</span> <span style='color:#0000e6; '>'**************** MESSAGE: '</span><span style='color:#808030; '>,</span>count<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'  *****************'</span>
 
    <span style='color:#696969; '>! we need to instruct ecCodes to unpack the data values</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_set<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>"unpack"</span><span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
 
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'year'</span><span style='color:#808030; '>,</span>year<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'month'</span><span style='color:#808030; '>,</span>month<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'day'</span><span style='color:#808030; '>,</span>day<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'hour'</span><span style='color:#808030; '>,</span>hour<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'minute'</span><span style='color:#808030; '>,</span>minute<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>write</span><span style='color:#808030; '>(</span><span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(A,I0,A,I0,A,I0,A,I0,A,I0,A,I0)'</span><span style='color:#808030; '>)</span><span style='color:#0000e6; '>'Date and time: '</span><span style='color:#808030; '>,</span>day<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'.'</span><span style='color:#808030; '>,</span>month<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'.'</span><span style='color:#808030; '>,</span>year<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'  '</span><span style='color:#808030; '>,</span>hour<span style='color:#808030; '>,</span><span style='color:#0000e6; '>':'</span><span style='color:#808030; '>,</span>minute
 
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'stormIdentifier'</span><span style='color:#808030; '>,</span>stormIdentifier<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>write</span><span style='color:#808030; '>(</span><span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(A,A)'</span><span style='color:#808030; '>)</span><span style='color:#0000e6; '>'Storm identifier: '</span><span style='color:#808030; '>,</span>stormIdentifier
 
    <span style='color:#696969; '>!How many different timePeriod in the data structure?</span>
    rankPeriod<span style='color:#808030; '>=</span><span style='color:#008c00; '>0</span>
    ierr<span style='color:#808030; '>=</span><span style='color:#008c00; '>0</span>
    <span style='color:#800000; font-weight:bold; '>do</span> <span style='color:#800000; font-weight:bold; '>while</span><span style='color:#808030; '>(</span>ierr<span style='color:#808030; '>=</span><span style='color:#808030; '>=</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>)</span>
      rankPeriod<span style='color:#808030; '>=</span>rankPeriod<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>write</span> <span style='color:#808030; '>(</span>rankPeriodStr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(I0)'</span><span style='color:#808030; '>)</span>rankPeriod
      <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankPeriodStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#timePeriod'</span><span style='color:#808030; '>,</span>period<span style='color:#808030; '>,</span>ierr<span style='color:#808030; '>)</span>
      <span style='color:#800000; font-weight:bold; '>if</span><span style='color:#808030; '>(</span>allocated<span style='color:#808030; '>(</span>period<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>period<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>enddo</span>
    <span style='color:#696969; '>!the numberOfPeriods includes the analysis (period=0)</span>
    numberOfPeriods<span style='color:#808030; '>=</span>rankPeriod
 
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'ensembleMemberNumber'</span><span style='color:#808030; '>,</span>memberNumber<span style='color:#808030; '>)</span>
 
    <span style='color:#800000; font-weight:bold; '>allocate</span><span style='color:#808030; '>(</span>latitude<span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>numberOfPeriods<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>allocate</span><span style='color:#808030; '>(</span>longitude<span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>numberOfPeriods<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>allocate</span><span style='color:#808030; '>(</span>pressure<span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>numberOfPeriods<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>allocate</span><span style='color:#808030; '>(</span>latitudeWind<span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>numberOfPeriods<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>allocate</span><span style='color:#808030; '>(</span>longitudeWind<span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>numberOfPeriods<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>allocate</span><span style='color:#808030; '>(</span>wind<span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>numberOfPeriods<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>allocate</span><span style='color:#808030; '>(</span>values<span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>allocate</span><span style='color:#808030; '>(</span>period<span style='color:#808030; '>(</span>numberOfPeriods<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
    period<span style='color:#808030; '>(</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span><span style='color:#008c00; '>0</span>
 
    <span style='color:#696969; '>! Observed Storm Centre</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#1#meteorologicalAttributeSignificance'</span><span style='color:#808030; '>,</span>significance<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#1#latitude'</span><span style='color:#808030; '>,</span>latitudeCentre<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#1#longitude'</span><span style='color:#808030; '>,</span>longitudeCentre<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>significance<span style='color:#808030; '>/</span><span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
      <span style='color:#800000; font-weight:bold; '>print</span> <span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'ERROR: unexpected #1#meteorologicalAttributeSignificance'</span>
      <span style='color:#800000; font-weight:bold; '>stop</span> <span style='color:#008c00; '>1</span>
    <span style='color:#800000; font-weight:bold; '>endif</span>
    <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>latitudeCentre<span style='color:#808030; '>=</span><span style='color:#808030; '>=</span>CODES_MISSING_DOUBLE <span style='color:#808030; '>.and.</span> longitudeCentre<span style='color:#808030; '>=</span><span style='color:#808030; '>=</span>CODES_MISSING_DOUBLE<span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
      <span style='color:#800000; font-weight:bold; '>write</span><span style='color:#808030; '>(</span><span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(a)'</span><span style='color:#808030; '>)</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'Observed storm centre position missing'</span>
    <span style='color:#800000; font-weight:bold; '>else</span>
      <span style='color:#800000; font-weight:bold; '>write</span><span style='color:#808030; '>(</span><span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(A,F8.2,A,F8.2)'</span><span style='color:#808030; '>)</span><span style='color:#0000e6; '>'Observed storm centre: latitude='</span><span style='color:#808030; '>,</span>latitudeCentre<span style='color:#808030; '>,</span><span style='color:#0000e6; '>' longitude='</span><span style='color:#808030; '>,</span>longitudeCentre
    <span style='color:#800000; font-weight:bold; '>endif</span>
 
    <span style='color:#696969; '>! Location of storm in perturbed analysis</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#2#meteorologicalAttributeSignificance'</span><span style='color:#808030; '>,</span>significance<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#2#latitude'</span><span style='color:#808030; '>,</span>latitudeAnalysis<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#2#longitude'</span><span style='color:#808030; '>,</span>longitudeAnalysis<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#1#pressureReducedToMeanSeaLevel'</span><span style='color:#808030; '>,</span>pressureAnalysis<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>significance<span style='color:#808030; '>/</span><span style='color:#808030; '>=</span><span style='color:#008c00; '>4</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
      <span style='color:#800000; font-weight:bold; '>print</span> <span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'ERROR: unexpected #2#meteorologicalAttributeSignificance'</span>
      <span style='color:#800000; font-weight:bold; '>stop</span> <span style='color:#008c00; '>1</span>
    <span style='color:#800000; font-weight:bold; '>endif</span>
    <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>latitudeAnalysis<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span><span style='color:#808030; '>=</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
      latitude<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>latitudeAnalysis
      longitude<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>longitudeAnalysis
      pressure<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>pressureAnalysis
    <span style='color:#800000; font-weight:bold; '>else</span>
      latitude<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>latitudeAnalysis<span style='color:#808030; '>(</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span>
      longitude<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>longitudeAnalysis<span style='color:#808030; '>(</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span>
      pressure<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>pressureAnalysis<span style='color:#808030; '>(</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>endif</span>
 
    <span style='color:#696969; '>! Location of Maximum Wind</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#3#meteorologicalAttributeSignificance'</span><span style='color:#808030; '>,</span>significance<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#3#latitude'</span><span style='color:#808030; '>,</span>latitudeMaxWind0<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#3#longitude'</span><span style='color:#808030; '>,</span>longitudeMaxWind0<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>significance<span style='color:#808030; '>/</span><span style='color:#808030; '>=</span><span style='color:#008c00; '>3</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
      <span style='color:#800000; font-weight:bold; '>print</span> <span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'ERROR: unexpected #3#meteorologicalAttributeSignificance='</span><span style='color:#808030; '>,</span>significance
      <span style='color:#800000; font-weight:bold; '>stop</span> <span style='color:#008c00; '>1</span>
    <span style='color:#800000; font-weight:bold; '>endif</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#1#windSpeedAt10M'</span><span style='color:#808030; '>,</span>windMaxWind0<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
    <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>size<span style='color:#808030; '>(</span>latitudeMaxWind0<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span><span style='color:#808030; '>=</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
      latitudeWind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>latitudeMaxWind0
      longitudeWind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>longitudeMaxWind0
      wind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>windMaxWind0
    <span style='color:#800000; font-weight:bold; '>else</span>
      latitudeWind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>latitudeMaxWind0<span style='color:#808030; '>(</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span>
      longitudeWind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>longitudeMaxWind0<span style='color:#808030; '>(</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span>
      wind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>windMaxWind0<span style='color:#808030; '>(</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>endif</span>
 
    rankSignificance<span style='color:#808030; '>=</span><span style='color:#008c00; '>3</span>
    rankPosition<span style='color:#808030; '>=</span><span style='color:#008c00; '>3</span>
    rankPressure<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span>
    rankWind<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span>
    rankPeriod<span style='color:#808030; '>=</span><span style='color:#008c00; '>0</span>
 
    <span style='color:#696969; '>!loop on all periods excluding analysis period(1)=0</span>
    <span style='color:#800000; font-weight:bold; '>do</span> i<span style='color:#808030; '>=</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>,</span>numberOfPeriods
 
      rankPeriod<span style='color:#808030; '>=</span>rankPeriod<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>write</span> <span style='color:#808030; '>(</span>rankPeriodStr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(I0)'</span><span style='color:#808030; '>)</span>rankPeriod
      <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankPeriodStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#timePeriod'</span><span style='color:#808030; '>,</span>ivalues<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
      <span style='color:#800000; font-weight:bold; '>do</span> k<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span>size<span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>(</span>k<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>=</span>CODES_MISSING_LONG<span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
          period<span style='color:#808030; '>(</span>i<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>ivalues<span style='color:#808030; '>(</span>k<span style='color:#808030; '>)</span>
          <span style='color:#800000; font-weight:bold; '>exit</span>
        <span style='color:#800000; font-weight:bold; '>endif</span>
      <span style='color:#800000; font-weight:bold; '>enddo</span>
      <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>)</span>
       
      <span style='color:#696969; '>!Location of the storm</span>
      rankSignificance<span style='color:#808030; '>=</span>rankSignificance<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>write</span> <span style='color:#808030; '>(</span>rankSignificanceStr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(I0)'</span><span style='color:#808030; '>)</span>rankSignificance
      <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankSignificanceStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#meteorologicalAttributeSignificance'</span><span style='color:#808030; '>,</span>ivalues<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
      <span style='color:#800000; font-weight:bold; '>do</span> k<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span>size<span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>(</span>k<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>=</span>CODES_MISSING_LONG<span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
          significance<span style='color:#808030; '>=</span>ivalues<span style='color:#808030; '>(</span>k<span style='color:#808030; '>)</span>
          <span style='color:#800000; font-weight:bold; '>exit</span>
        <span style='color:#800000; font-weight:bold; '>endif</span>
      <span style='color:#800000; font-weight:bold; '>enddo</span>
      <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>)</span>
 
      rankPosition<span style='color:#808030; '>=</span>rankPosition<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>write</span> <span style='color:#808030; '>(</span>rankPositionStr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(I0)'</span><span style='color:#808030; '>)</span>rankPosition
      <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankPositionStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#latitude'</span><span style='color:#808030; '>,</span>values<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
      latitude<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span>i<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>values
      <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankPositionStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#longitude'</span><span style='color:#808030; '>,</span>values<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
      longitude<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span>i<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>values
 
      <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>significance<span style='color:#808030; '>=</span><span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
        rankPressure<span style='color:#808030; '>=</span>rankPressure<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
        <span style='color:#800000; font-weight:bold; '>write</span> <span style='color:#808030; '>(</span>rankPressureStr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(I0)'</span><span style='color:#808030; '>)</span>rankPressure
        <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankPressureStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#pressureReducedToMeanSeaLevel'</span><span style='color:#808030; '>,</span>values<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
        pressure<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span>i<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>values
      <span style='color:#800000; font-weight:bold; '>else</span>
        <span style='color:#800000; font-weight:bold; '>print</span> <span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'ERROR: unexpected meteorologicalAttributeSignificance='</span><span style='color:#808030; '>,</span>significance
        <span style='color:#800000; font-weight:bold; '>stop</span> <span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>endif</span>
 
      <span style='color:#696969; '>!Location of maximum wind</span>
      rankSignificance<span style='color:#808030; '>=</span>rankSignificance<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>write</span> <span style='color:#808030; '>(</span>rankSignificanceStr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(I0)'</span><span style='color:#808030; '>)</span>rankSignificance
      <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankSignificanceStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#meteorologicalAttributeSignificance'</span><span style='color:#808030; '>,</span>ivalues<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
      <span style='color:#800000; font-weight:bold; '>do</span> k<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span>size<span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>(</span>k<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>=</span>CODES_MISSING_LONG<span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
          significance<span style='color:#808030; '>=</span>ivalues<span style='color:#808030; '>(</span>k<span style='color:#808030; '>)</span>
          <span style='color:#800000; font-weight:bold; '>exit</span>
        <span style='color:#800000; font-weight:bold; '>endif</span>
      <span style='color:#800000; font-weight:bold; '>enddo</span>
      <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>ivalues<span style='color:#808030; '>)</span>
 
      rankPosition<span style='color:#808030; '>=</span>rankPosition<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>write</span> <span style='color:#808030; '>(</span>rankPositionStr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(I0)'</span><span style='color:#808030; '>)</span>rankPosition
      <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankPositionStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#latitude'</span><span style='color:#808030; '>,</span>values<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
      latitudeWind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span>i<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>values
      <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankPositionStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#longitude'</span><span style='color:#808030; '>,</span>values<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
      longitudeWind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span>i<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>values
 
      <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>significance<span style='color:#808030; '>=</span><span style='color:#808030; '>=</span><span style='color:#008c00; '>3</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
        rankWind<span style='color:#808030; '>=</span>rankWind<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
        <span style='color:#800000; font-weight:bold; '>write</span> <span style='color:#808030; '>(</span>rankWindStr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(I0)'</span><span style='color:#808030; '>)</span>rankWind
        <span style='color:#800000; font-weight:bold; '>call</span> codes_get<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>,</span><span style='color:#0000e6; '>'#'</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span>trim<span style='color:#808030; '>(</span>rankWindStr<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>/</span><span style='color:#0000e6; '>'#windSpeedAt10M'</span><span style='color:#808030; '>,</span>values<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
        wind<span style='color:#808030; '>(</span>:<span style='color:#808030; '>,</span>i<span style='color:#808030; '>)</span><span style='color:#808030; '>=</span>values
      <span style='color:#800000; font-weight:bold; '>else</span>
        <span style='color:#800000; font-weight:bold; '>print</span> <span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'ERROR: unexpected meteorologicalAttributeSignificance=,'</span><span style='color:#808030; '>,</span>significance
        <span style='color:#800000; font-weight:bold; '>stop</span> <span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>endif</span>
 
    <span style='color:#800000; font-weight:bold; '>enddo</span>
 
    <span style='color:#696969; '>! ---- Print the values --------------------------------</span>
    <span style='color:#800000; font-weight:bold; '>do</span> i<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span>size<span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span>
      skipMember<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span>
      <span style='color:#800000; font-weight:bold; '>do</span> j<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span>size<span style='color:#808030; '>(</span>period<span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>latitude<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>=</span>CODES_MISSING_DOUBLE <span style='color:#808030; '>.OR.</span> latitudeWind<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>=</span>CODES_MISSING_DOUBLE<span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
          skipMember<span style='color:#808030; '>=</span><span style='color:#008c00; '>0</span>
          <span style='color:#800000; font-weight:bold; '>exit</span>
        <span style='color:#800000; font-weight:bold; '>endif</span>
      <span style='color:#800000; font-weight:bold; '>enddo</span>
      <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>skipMember<span style='color:#808030; '>/</span><span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
 
        <span style='color:#800000; font-weight:bold; '>write</span><span style='color:#808030; '>(</span><span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'(A,I3)'</span><span style='color:#808030; '>)</span> <span style='color:#0000e6; '>'== Member '</span><span style='color:#808030; '>,</span>memberNumber<span style='color:#808030; '>(</span>i<span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>write</span><span style='color:#808030; '>(</span><span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#808030; '>*</span><span style='color:#808030; '>)</span> <span style='color:#0000e6; '>'step  latitude   longitude   pressure    latitude   longitude   wind'</span>
        <span style='color:#800000; font-weight:bold; '>do</span> j<span style='color:#808030; '>=</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span>size<span style='color:#808030; '>(</span>period<span style='color:#808030; '>)</span>
          <span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>latitude<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>=</span>CODES_MISSING_DOUBLE <span style='color:#808030; '>.OR.</span> latitudeWind<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>/</span><span style='color:#808030; '>=</span>CODES_MISSING_DOUBLE<span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>then</span>
          <span style='color:#800000; font-weight:bold; '>write</span><span style='color:#808030; '>(</span><span style='color:#808030; '>*</span><span style='color:#808030; '>,</span><span style='color:#0000e6; '>'( I4,2X,F8.2,4X,F8.2,3X,F9.1,2X,F8.2,4X,F8.2,2X,F8.2)'</span><span style='color:#808030; '>)</span> period<span style='color:#808030; '>(</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>latitude<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>longitude<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>pressure<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>&amp;
          &amp;latitudeWind<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>longitudeWind<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span><span style='color:#808030; '>,</span>wind<span style='color:#808030; '>(</span>i<span style='color:#808030; '>,</span>j<span style='color:#808030; '>)</span>
          <span style='color:#800000; font-weight:bold; '>endif</span>
        <span style='color:#800000; font-weight:bold; '>enddo</span>
 
      <span style='color:#800000; font-weight:bold; '>endif</span>
    <span style='color:#800000; font-weight:bold; '>enddo</span>
 
    <span style='color:#696969; '>! free arrays is very important</span>
    <span style='color:#696969; '>! because the behaviour of the codes_get functions is as follows</span>
    <span style='color:#696969; '>! if the array is not allocated then allocate</span>
    <span style='color:#696969; '>! if the array is already allocated only copy the values</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>values<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>latitude<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>longitude<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>pressure<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>latitudeWind<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>longitudeWind<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>wind<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>period<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>latitudeAnalysis<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>longitudeAnalysis<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>pressureAnalysis<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>memberNumber<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>latitudeMaxWind0<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>longitudeMaxWind0<span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>deallocate</span><span style='color:#808030; '>(</span>windMaxWind0<span style='color:#808030; '>)</span>
 
    <span style='color:#696969; '>! release the bufr message</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_release<span style='color:#808030; '>(</span>ibufr<span style='color:#808030; '>)</span>
 
    <span style='color:#696969; '>! load the next bufr message</span>
    <span style='color:#800000; font-weight:bold; '>call</span> codes_bufr_new_from_file<span style='color:#808030; '>(</span>ifile<span style='color:#808030; '>,</span>ibufr<span style='color:#808030; '>,</span>iret<span style='color:#808030; '>)</span>
 
    count<span style='color:#808030; '>=</span>count<span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span>
 
  <span style='color:#800000; font-weight:bold; '>end</span> <span style='color:#800000; font-weight:bold; '>do</span> 
 
  <span style='color:#696969; '>! close file </span>
  <span style='color:#800000; font-weight:bold; '>call</span> codes_close_file<span style='color:#808030; '>(</span>ifile<span style='color:#808030; '>)</span>
  
<span style='color:#800000; font-weight:bold; '>end</span> <span style='color:#800000; font-weight:bold; '>program</span> bufr_read_tropical_cyclone
</pre>

 

 
 rankPeriod,numberOfPeriods

  real(kind=8) :: latitudeCentre,longitudeCentre
  real(kind=8), dimension(:), allocatable :: latitudeMaxWind0,longitudeMaxWind0,windMaxWind0
  real(kind=8), dimension(:), allocatable :: latitudeAnalysis,longitudeAnalysis,pressureAnalysis
  real(kind=8), dimension(:,:), allocatable :: latitude,longitude,pressure
  real(kind=8), dimension(:,:), allocatable :: latitudeWind,longitudeWind,wind
  integer(kind=4), dimension(:), allocatable :: memberNumber,period
  real(kind=8), dimension(:), allocatable :: values
  integer(kind=4), dimension(:), allocatable :: ivalues

  character(len=8)   :: rankSignificanceStr,rankPositionStr,rankPressureStr,rankWindStr
  character(len=8)   :: stormIdentifier,rankPeriodStr

  call codes_open_file(ifile,'../../data/bufr/tropical_cyclone.bufr','r')

  ! the first BUFR message is loaded from file.
  ! ibufr is the BUFR id to be used in subsequent calls
  call codes_bufr_new_from_file(ifile,ibufr,iret)

  do while (iret/=CODES_END_OF_FILE)

    write(*,'(A,I3,A)') '**************** MESSAGE: ',count,'  *****************'

    ! we need to instruct ecCodes to unpack the data values
    call codes_set(ibufr,"unpack",1);

    call codes_get(ibufr,'year',year);
    call codes_get(ibufr,'month',month);
    call codes_get(ibufr,'day',day);
    call codes_get(ibufr,'hour',hour);
    call codes_get(ibufr,'minute',minute);
    write(*,'(A,I0,A,I0,A,I0,A,I0,A,I0,A,I0)')'Date and time: ',day,'.',month,'.',year,'  ',hour,':',minute

    call codes_get(ibufr,'stormIdentifier',stormIdentifier)
    write(*,'(A,A)')'Storm identifier: ',stormIdentifier

    !How many different timePeriod in the data structure?
    rankPeriod=0
    ierr=0
    do while(ierr==0) 
      rankPeriod=rankPeriod+1
      write (rankPeriodStr,'(I0)')rankPeriod 
      call codes_get(ibufr,'#'//trim(rankPeriodStr)//'#timePeriod',period,ierr)
      if(allocated(period)) deallocate(period)
    enddo
    !the numberOfPeriods includes the analysis (period=0)
    numberOfPeriods=rankPeriod

    call codes_get(ibufr,'ensembleMemberNumber',memberNumber)

    allocate(latitude(size(memberNumber),numberOfPeriods))
    allocate(longitude(size(memberNumber),numberOfPeriods))
    allocate(pressure(size(memberNumber),numberOfPeriods))
    allocate(latitudeWind(size(memberNumber),numberOfPeriods))
    allocate(longitudeWind(size(memberNumber),numberOfPeriods))
    allocate(wind(size(memberNumber),numberOfPeriods))
    allocate(values(size(memberNumber)))
    allocate(period(numberOfPeriods))
    period(1)=0

    ! Observed Storm Centre
    call codes_get(ibufr,'#1#meteorologicalAttributeSignificance',significance);
    call codes_get(ibufr,'#1#latitude',latitudeCentre);
    call codes_get(ibufr,'#1#longitude',longitudeCentre);
    if (significance/=1) then
      print *,'ERROR: unexpected #1#meteorologicalAttributeSignificance'
      stop 1
    endif
    if (latitudeCentre==CODES_MISSING_DOUBLE .and. longitudeCentre==CODES_MISSING_DOUBLE) then
      write(*,'(a)')'Observed storm centre position missing'
    else
      write(*,'(A,F8.2,A,F8.2)')'Observed storm centre: latitude=',latitudeCentre,' longitude=',longitudeCentre
    endif 

    ! Location of storm in perturbed analysis
    call codes_get(ibufr,'#2#meteorologicalAttributeSignificance',significance);
    call codes_get(ibufr,'#2#latitude',latitudeAnalysis);
    call codes_get(ibufr,'#2#longitude',longitudeAnalysis);
    call codes_get(ibufr,'#1#pressureReducedToMeanSeaLevel',pressureAnalysis);
    if (significance/=4) then
      print *,'ERROR: unexpected #2#meteorologicalAttributeSignificance'
      stop 1
    endif
    if (size(latitudeAnalysis)==size(memberNumber)) then
      latitude(:,1)=latitudeAnalysis
      longitude(:,1)=longitudeAnalysis
      pressure(:,1)=pressureAnalysis
    else
      latitude(:,1)=latitudeAnalysis(1)
      longitude(:,1)=longitudeAnalysis(1)
      pressure(:,1)=pressureAnalysis(1)
    endif

    ! Location of Maximum Wind
    call codes_get(ibufr,'#3#meteorologicalAttributeSignificance',significance);
    call codes_get(ibufr,'#3#latitude',latitudeMaxWind0);
    call codes_get(ibufr,'#3#longitude',longitudeMaxWind0);
    if (significance/=3) then
      print *,'ERROR: unexpected #3#meteorologicalAttributeSignificance=',significance
      stop 1
    endif
    call codes_get(ibufr,'#1#windSpeedAt10M',windMaxWind0);
    if (size(latitudeMaxWind0)==size(memberNumber)) then
      latitudeWind(:,1)=latitudeMaxWind0
      longitudeWind(:,1)=longitudeMaxWind0
      wind(:,1)=windMaxWind0
    else
      latitudeWind(:,1)=latitudeMaxWind0(1)
      longitudeWind(:,1)=longitudeMaxWind0(1)
      wind(:,1)=windMaxWind0(1)
    endif

    rankSignificance=3
    rankPosition=3
    rankPressure=1
    rankWind=1
    rankPeriod=0

    !loop on all periods excluding analysis period(1)=0
    do i=2,numberOfPeriods

      rankPeriod=rankPeriod+1
      write (rankPeriodStr,'(I0)')rankPeriod 
      call codes_get(ibufr,'#'//trim(rankPeriodStr)//'#timePeriod',ivalues);
      do k=1,size(ivalues)
        if (ivalues(k)/=CODES_MISSING_LONG) then
          period(i)=ivalues(k)
          exit
        endif
      enddo
      deallocate(ivalues)
      
      !Location of the storm
      rankSignificance=rankSignificance+1
      write (rankSignificanceStr,'(I0)')rankSignificance 
      call codes_get(ibufr,'#'//trim(rankSignificanceStr)//'#meteorologicalAttributeSignificance',ivalues);
      do k=1,size(ivalues)
        if (ivalues(k)/=CODES_MISSING_LONG) then
          significance=ivalues(k)
          exit
        endif
      enddo
      deallocate(ivalues)

      rankPosition=rankPosition+1
      write (rankPositionStr,'(I0)')rankPosition 
      call codes_get(ibufr,'#'//trim(rankPositionStr)//'#latitude',values);
      latitude(:,i)=values
      call codes_get(ibufr,'#'//trim(rankPositionStr)//'#longitude',values);
      longitude(:,i)=values

      if (significance==1) then
        rankPressure=rankPressure+1
        write (rankPressureStr,'(I0)')rankPressure 
        call codes_get(ibufr,'#'//trim(rankPressureStr)//'#pressureReducedToMeanSeaLevel',values);
        pressure(:,i)=values
      else
        print *,'ERROR: unexpected meteorologicalAttributeSignificance=',significance
        stop 1
      endif

      !Location of maximum wind
      rankSignificance=rankSignificance+1
      write (rankSignificanceStr,'(I0)')rankSignificance 
      call codes_get(ibufr,'#'//trim(rankSignificanceStr)//'#meteorologicalAttributeSignificance',ivalues);
      do k=1,size(ivalues)
        if (ivalues(k)/=CODES_MISSING_LONG) then
          significance=ivalues(k)
          exit
        endif
      enddo
      deallocate(ivalues)

      rankPosition=rankPosition+1
      write (rankPositionStr,'(I0)')rankPosition 
      call codes_get(ibufr,'#'//trim(rankPositionStr)//'#latitude',values);
      latitudeWind(:,i)=values
      call codes_get(ibufr,'#'//trim(rankPositionStr)//'#longitude',values);
      longitudeWind(:,i)=values

      if (significance==3) then
        rankWind=rankWind+1
        write (rankWindStr,'(I0)')rankWind 
        call codes_get(ibufr,'#'//trim(rankWindStr)//'#windSpeedAt10M',values);
        wind(:,i)=values
      else
        print *,'ERROR: unexpected meteorologicalAttributeSignificance=,',significance
        stop 1
      endif

    enddo

    ! ---- Print the values --------------------------------
    do i=1,size(memberNumber)
      skipMember=1
      do j=1,size(period)
        if (latitude(i,j)/=CODES_MISSING_DOUBLE .OR. latitudeWind(i,j)/=CODES_MISSING_DOUBLE) then
          skipMember=0
          exit
        endif
      enddo
      if (skipMember/=1) then

        write(*,'(A,I3)') '== Member ',memberNumber(i)
        write(*,*) 'step  latitude   longitude   pressure    latitude   longitude   wind'
        do j=1,size(period)
          if (latitude(i,j)/=CODES_MISSING_DOUBLE .OR. latitudeWind(i,j)/=CODES_MISSING_DOUBLE) then
          write(*,'( I4,2X,F8.2,4X,F8.2,3X,F9.1,2X,F8.2,4X,F8.2,2X,F8.2)') period(j),latitude(i,j),longitude(i,j),pressure(i,j),&
          &latitudeWind(i,j),longitudeWind(i,j),wind(i,j)
          endif
        enddo

      endif
    enddo

    ! deallocating the arrays is very important
    ! because the behaviour of the codes_get functions is as follows:
    ! if the array is not allocated then allocate
    ! if the array is already allocated only copy the values
    deallocate(values)
    deallocate(latitude)
    deallocate(longitude)
    deallocate(pressure)
    deallocate(latitudeWind)
    deallocate(longitudeWind)
    deallocate(wind)
    deallocate(period)
    deallocate(latitudeAnalysis)
    deallocate(longitudeAnalysis)
    deallocate(pressureAnalysis)
    deallocate(memberNumber)
    deallocate(latitudeMaxWind0)
    deallocate(longitudeMaxWind0)
    deallocate(windMaxWind0)

    ! release the BUFR message
    call codes_release(ibufr)

    ! load the next BUFR message
    call codes_bufr_new_from_file(ifile,ibufr,iret)

    count=count+1

  end do  

  ! close file  
  call codes_close_file(ifile)
 
end program bufr_read_tropical_cyclone
Tabs Page
titlePython
Code Block
languagepython
titlebufr_read_tropical_cyclone.py
linenumbersfalse
# Copyright 2005-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
# Python implementation:  bufr_read_tropical_cyclone
#
# Description: how to read data of the ECMWF EPS tropical cyclone tracks encoded in BUFR format.
#

import traceback
import sys
import collections

from eccodes import *

INPUT = '../../data/bufr/tropical_cyclone.bufr'
VERBOSE = 1  # verbose error reporting


data=collections.defaultdict(dict)


def example():

    # open bufr file
    f = open(INPUT)

    cnt = 0

    # loop for the messages in the file
    while 1:
        # get handle for message
        gid = codes_bufr_new_from_file(f)
        if gid is None:
            break

        print '**************** MESSAGE: ',cnt+1,'  *****************'

        # we need to instruct ecCodes to expand all the descriptors
        # i.e. unpack the data values
        codes_set(gid, 'unpack', 1)

        numObs= codes_get(gid,"numberOfSubsets")
        year  = codes_get(gid, "year")
        month = codes_get(gid, "month")
        day   = codes_get(gid, "day")
        hour  = codes_get(gid, "hour")
        minute= codes_get(gid, "minute")

        print 'Date and time: ',  day,'.',month,'.',year,'  ',hour,':',minute

        stormIdentifier =  codes_get(gid,"stormIdentifier")
        print  'Storm identifier: ', stormIdentifier

        #How many different timePeriod in the data structure?
        numberOfPeriods=0
        while True:
            numberOfPeriods=numberOfPeriods+1
            try:
                codes_get_array(gid,"#%d#timePeriod" %numberOfPeriods)
            except CodesInternalError, err:
                break
            #the numberOfPeriods includes the analysis (period=0)

        # Get ensembleMemberNumber
        memberNumber = codes_get_array(gid, "ensembleMemberNumber")
        memberNumberLen=len(memberNumber)

        # Observed Storm Centre
        significance    = codes_get(gid,'#1#meteorologicalAttributeSignificance')
        latitudeCentre  = codes_get(gid,'#1#latitude')
        longitudeCentre = codes_get(gid,'#1#longitude')

        if significance!=1:
            print 'ERROR: unexpected #1#meteorologicalAttributeSignificance'
            return 1

        if (latitudeCentre==CODES_MISSING_DOUBLE) and (longitudeCentre==CODES_MISSING_DOUBLE):
            print 'Observed storm centre position missing'
        else:
            print 'Observed storm centre: latitude=',latitudeCentre,' longitude=',longitudeCentre

        # Location of storm in perturbed analysis
        significance = codes_get(gid,'#2#meteorologicalAttributeSignificance')

        if significance!=4:
            print 'ERROR: unexpected #2#meteorologicalAttributeSignificance'
            return 1

        latitudeAnalysis = codes_get_array(gid,'#2#latitude')
        longitudeAnalysis = codes_get_array(gid,'#2#longitude')
        pressureAnalysis = codes_get_array(gid,'#1#pressureReducedToMeanSeaLevel')

        # Location of Maximum Wind
        significance=codes_get(gid,'#3#meteorologicalAttributeSignificance')

        if significance!=3:
            print 'ERROR: unexpected #3#meteorologicalAttributeSignificance=', significance
            return 1

        latitudeMaxWind0=codes_get_array(gid,'#3#latitude')
        longitudeMaxWind0= codes_get_array(gid,'#3#longitude')
        windMaxWind0= codes_get_array(gid,'#1#windSpeedAt10M')

        if len(latitudeAnalysis)==len(memberNumber) and len(latitudeMaxWind0)==len(memberNumber):
            for k in range(len(memberNumber)):
                data[k][0]=[latitudeAnalysis[k],longitudeAnalysis[k],pressureAnalysis[k],latitudeMaxWind0[k],longitudeMaxWind0[k],windMaxWind0[k]]

        else:
            for k in range(len(memberNumber)):
                data[k][0]=[latitudeAnalysis[0],longitudeAnalysis[0],pressureAnalysis[k],latitudeMaxWind0[0],longitudeMaxWind0[0],windMaxWind0[k]]


        timePeriod=[0 for x in range(numberOfPeriods)]
        for i in range(1,numberOfPeriods):
            rank1 = i * 2 + 2
            rank3 = i * 2 + 3

            ivalues= codes_get_array(gid,"#%d#timePeriod" %(i))

            if len(ivalues)==1:
                timePeriod[i]=ivalues[0]
            else:
                for j in range(len (ivalues)):
                    if ivalues[j]!=CODES_MISSING_LONG:
                        timePeriod[i]=ivalues[j]
                        break

            #Location of the storm
            values = codes_get_array(gid, "#%d#meteorologicalAttributeSignificance" % rank1)
            if len(values)==1:
                significance=values[0]
            else:
                for j in range(len (values)):
                    if values[j]!=CODES_MISSING_LONG:
                        significance=values[j]
                        break

            if significance==1:
                lat = codes_get_array(gid, "#%d#latitude" % rank1)
                lon = codes_get_array(gid, "#%d#longitude" % rank1)
                press = codes_get_array(gid, "#%d#pressureReducedToMeanSeaLevel" % (i + 1))
            else:
                print 'ERROR: unexpected meteorologicalAttributeSignificance=',significance

            #Location of maximum wind
            values = codes_get_array(gid, "#%d#meteorologicalAttributeSignificance" % rank3)
            if len(values)==1:
                significanceWind=values[0]
            else:
                for j in range(len (values)):
                    if values[j]!=CODES_MISSING_LONG:
                        significanceWind=values[j]
                        break

            if significanceWind==3:
                latWind = codes_get_array(gid, "#%d#latitude" % rank3)
                lonWind = codes_get_array(gid, "#%d#longitude" % rank3)
                wind10m = codes_get_array(gid, "#%d#windSpeedAt10M" % (i + 1))
            else:
                print 'ERROR: unexpected meteorologicalAttributeSignificance=',significanceWind

            for k in range(len(memberNumber)):
                data[k][i]=[lat[k],lon[k],press[k],latWind[k],lonWind[k],wind10m[k]]


# ---------------------------------------- Print the values -------------

        for m in range(len(memberNumber)):
            print "== Member  %d" %memberNumber[m]
            print "step  latitude  longitude   pressure  latitude   longitude    wind"
            for s in range(len(timePeriod)):
                if data[m][s][0]!=CODES_MISSING_DOUBLE and data[m][s][1]!=CODES_MISSING_DOUBLE:
                    print " {:>3d}{}{:>6.1f}{}{:>6.1f}{}{:>8.1f}{}{:>6.1f}{}{:>6.1f}{}{:>6.1f}".format(\
                          timePeriod[s],'  ',data[m][s][0],'     ',data[m][s][1],'     ',data[m][s][2],'  ',
                          data[m][s][3],'     ',data[m][s][4],'     ',data[m][s][5])

# -----------------------------------------------------------------------
        cnt += 1

        # release the BUFR message
        codes_release(gid)

    # close the file
    f.close()


def main():
    try:
        example()
    except CodesInternalError, err:
        if VERBOSE:
            traceback.print_exc(file=sys.stderr)
        else:
            print >>sys.stderr, err.msg

        return 1

if __name__ == "__main__":
    sys.exit(main())