Dump instructions to decode the input

Step-by-step guide

There is a "-D" option in the bufr_dump tool to generate instructions to read (decode) the input BUFR message.  Its argument can be one of:

  • -Dfilter  This generates the set of rules to be passed to the bufr_filter tool
  • -Dfortran This generates a Fortran 90 program
  • -Dpython  This generates a Python script
  • -DC       This generates a C program
  1. For compiled languages like C and Fortran, the user can then compile/link the generated program and run it to decode the input message. For filter and Python, the generated code can be used directly (either passed to bufr_filter or the Python interpreter)
  2. The user can then edit the generated code to tailor it to his/her own needs.

    Note: The generated code for bufr_filter only applies to a single BUFR message. The other languages support decoding of multiple BUFR messages in a file.

  3. Example

    This is an example of decoding BUFR synoptic surface observation (SYNOP) : synop.bufr


    !  This program was automatically generated with bufr_dump -Dfortran
    !  Using ecCodes version: 2.0.0
    
    program bufr_decode
      use eccodes
      implicit none
      integer, parameter                                      :: max_strsize = 200
      integer                                                 :: iret
      integer                                                 :: ifile
      integer                                                 :: ibufr
      integer(kind=4)                                         :: iVal
      real(kind=8)                                            :: rVal
      character(len=max_strsize)                              :: sVal
      integer(kind=4), dimension(:), allocatable              :: iValues
      character(len=max_strsize) , dimension(:),allocatable   :: sValues
      real(kind=8), dimension(:), allocatable                 :: rValues
    
      character(len=max_strsize)                              :: infile_name
      call getarg(1, infile_name)
      call codes_open_file(ifile, infile_name, 'r')
    
      ! Message number 1
      ! -----------------
      write(*,*) 'Decoding message number 1'
      call codes_bufr_new_from_file(ifile, ibufr)
      call codes_set(ibufr, 'unpack', 1)
      call codes_get(ibufr, 'delayedDescriptorReplicationFactor', iValues)
      call codes_get(ibufr, 'edition', iVal)
      call codes_get(ibufr, 'masterTableNumber', iVal)
      call codes_get(ibufr, 'bufrHeaderCentre', iVal)
      call codes_get(ibufr, 'bufrHeaderSubCentre', iVal)
      call codes_get(ibufr, 'updateSequenceNumber', iVal)
      call codes_get(ibufr, 'dataCategory', iVal)
      call codes_get(ibufr, 'internationalDataSubCategory', iVal)
      call codes_get(ibufr, 'dataSubCategory', iVal)
      call codes_get(ibufr, 'masterTablesVersionNumber', iVal)
      call codes_get(ibufr, 'localTablesVersionNumber', iVal)
      call codes_get(ibufr, 'typicalYear', iVal)
      call codes_get(ibufr, 'typicalMonth', iVal)
      call codes_get(ibufr, 'typicalDay', iVal)
      call codes_get(ibufr, 'typicalHour', iVal)
      call codes_get(ibufr, 'typicalMinute', iVal)
      call codes_get(ibufr, 'typicalSecond', iVal)
      call codes_get(ibufr, 'numberOfSubsets', iVal)
      call codes_get(ibufr, 'observedData', iVal)
      call codes_get(ibufr, 'compressedData', iVal)
      call codes_get(ibufr, 'unexpandedDescriptors', iVal)
      call codes_get(ibufr, '#1#blockNumber', iVal)
      call codes_get(ibufr, '#1#stationNumber', iVal)
      call codes_get(ibufr, '#1#stationOrSiteName', sVal)
      call codes_get(ibufr, '#1#stationType', iVal)
      call codes_get(ibufr, '#1#year', iVal)
      call codes_get(ibufr, '#1#month', iVal)
      call codes_get(ibufr, '#1#day', iVal)
      call codes_get(ibufr, '#1#hour', iVal)
      call codes_get(ibufr, '#1#minute', iVal)
      call codes_get(ibufr, '#1#latitude', rVal)
      call codes_get(ibufr, '#1#longitude', rVal)
      call codes_get(ibufr, '#1#heightOfStationGroundAboveMeanSeaLevel', rVal)
      call codes_get(ibufr, '#1#heightOfBarometerAboveMeanSeaLevel', rVal)
      call codes_get(ibufr, '#1#nonCoordinatePressure', rVal)
      call codes_get(ibufr, '#1#pressureReducedToMeanSeaLevel', rVal)
      call codes_get(ibufr, '#1#3HourPressureChange', rVal)
      call codes_get(ibufr, '#1#characteristicOfPressureTendency', iVal)
      call codes_get(ibufr, '#1#airTemperature', rVal)
      call codes_get(ibufr, '#1#dewpointTemperature', rVal)
      call codes_get(ibufr, '#1#horizontalVisibility', rVal)
      call codes_get(ibufr, '#1#cloudCoverTotal', iVal)
      call codes_get(ibufr, '#1#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#1#cloudAmount', iVal)
      call codes_get(ibufr, '#1#cloudType', iVal)
      call codes_get(ibufr, '#2#cloudType', iVal)
      call codes_get(ibufr, '#3#cloudType', iVal)
      call codes_get(ibufr, '#2#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#3#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#4#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#1#presentWeather', iVal)
      call codes_get(ibufr, '#1#timePeriod', iVal)
      call codes_get(ibufr, '#1#pastWeather1', iVal)
      call codes_get(ibufr, '#1#pastWeather2', iVal)
      call codes_get(ibufr, '#2#timePeriod', iVal)
      call codes_get(ibufr, '#3#timePeriod', iVal)
      call codes_get(ibufr, '#4#timePeriod', iVal)
      call codes_get(ibufr, '#5#timePeriod', iVal)
      call codes_get(ibufr, '#6#timePeriod', iVal)
      call codes_get(ibufr, '#7#timePeriod', iVal)
      call codes_get(ibufr, '#1#maximumTemperatureAtHeightAndOverPeriodSpecified', rVal)
      call codes_get(ibufr, '#8#timePeriod', iVal)
      call codes_get(ibufr, '#9#timePeriod', iVal)
      call codes_get(ibufr, '#1#minimumTemperatureAtHeightAndOverPeriodSpecified', rVal)
      call codes_get(ibufr, '#1#instrumentationForWindMeasurement', iVal)
      call codes_get(ibufr, '#1#timeSignificance', iVal)
      call codes_get(ibufr, '#10#timePeriod', iVal)
      call codes_get(ibufr, '#1#windDirection', iVal)
      call codes_get(ibufr, '#1#windSpeed', rVal)
      call codes_get(ibufr, '#11#timePeriod', iVal)
      call codes_get(ibufr, '#12#timePeriod', iVal)
      call codes_get(ibufr, '#13#timePeriod', iVal)
      call codes_get(ibufr, '#14#timePeriod', iVal)
      call codes_get(ibufr, '#15#timePeriod', iVal)
      call codes_get(ibufr, '#2#blockNumber', iVal)
      call codes_get(ibufr, '#2#stationNumber', iVal)
      call codes_get(ibufr, '#2#stationOrSiteName', sVal)
      call codes_get(ibufr, '#2#stationType', iVal)
      call codes_get(ibufr, '#2#year', iVal)
      call codes_get(ibufr, '#2#month', iVal)
      call codes_get(ibufr, '#2#day', iVal)
      call codes_get(ibufr, '#2#hour', iVal)
      call codes_get(ibufr, '#2#minute', iVal)
      call codes_get(ibufr, '#2#latitude', rVal)
      call codes_get(ibufr, '#2#longitude', rVal)
      call codes_get(ibufr, '#2#heightOfStationGroundAboveMeanSeaLevel', rVal)
      call codes_get(ibufr, '#2#heightOfBarometerAboveMeanSeaLevel', rVal)
      call codes_get(ibufr, '#2#nonCoordinatePressure', rVal)
      call codes_get(ibufr, '#2#pressureReducedToMeanSeaLevel', rVal)
      call codes_get(ibufr, '#2#3HourPressureChange', rVal)
      call codes_get(ibufr, '#2#characteristicOfPressureTendency', iVal)
      call codes_get(ibufr, '#2#airTemperature', rVal)
      call codes_get(ibufr, '#2#dewpointTemperature', rVal)
      call codes_get(ibufr, '#2#horizontalVisibility', rVal)
      call codes_get(ibufr, '#2#cloudCoverTotal', iVal)
      call codes_get(ibufr, '#6#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#2#cloudAmount', iVal)
      call codes_get(ibufr, '#2#heightOfBaseOfCloud', rVal)
      call codes_get(ibufr, '#5#cloudType', iVal)
      call codes_get(ibufr, '#6#cloudType', iVal)
      call codes_get(ibufr, '#7#cloudType', iVal)
      call codes_get(ibufr, '#7#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#3#cloudAmount', iVal)
      call codes_get(ibufr, '#8#cloudType', iVal)
      call codes_get(ibufr, '#3#heightOfBaseOfCloud', rVal)
      call codes_get(ibufr, '#8#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#9#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#10#verticalSignificanceSurfaceObservations', iVal)
      call codes_get(ibufr, '#2#presentWeather', iVal)
      call codes_get(ibufr, '#18#timePeriod', iVal)
      call codes_get(ibufr, '#2#pastWeather1', iVal)
      call codes_get(ibufr, '#2#pastWeather2', iVal)
      call codes_get(ibufr, '#19#timePeriod', iVal)
      call codes_get(ibufr, '#20#timePeriod', iVal)
      call codes_get(ibufr, '#21#timePeriod', iVal)
      call codes_get(ibufr, '#22#timePeriod', iVal)
      call codes_get(ibufr, '#23#timePeriod', iVal)
      call codes_get(ibufr, '#24#timePeriod', iVal)
      call codes_get(ibufr, '#2#maximumTemperatureAtHeightAndOverPeriodSpecified', rVal)
      call codes_get(ibufr, '#25#timePeriod', iVal)
      call codes_get(ibufr, '#26#timePeriod', iVal)
      call codes_get(ibufr, '#2#minimumTemperatureAtHeightAndOverPeriodSpecified', rVal)
      call codes_get(ibufr, '#2#instrumentationForWindMeasurement', iVal)
      call codes_get(ibufr, '#3#timeSignificance', iVal)
      call codes_get(ibufr, '#27#timePeriod', iVal)
      call codes_get(ibufr, '#2#windDirection', iVal)
      call codes_get(ibufr, '#2#windSpeed', rVal)
      call codes_get(ibufr, '#28#timePeriod', iVal)
      call codes_get(ibufr, '#29#timePeriod', iVal)
      call codes_get(ibufr, '#30#timePeriod', iVal)
      call codes_get(ibufr, '#31#timePeriod', iVal)
      call codes_get(ibufr, '#32#timePeriod', iVal)
      call codes_release(ibufr)
    
      call codes_close_file(ifile)
    end program bufr_decode
    #  This program was automatically generated with bufr_dump -Dpython
    #  Using ecCodes version: 2.0.0
    
    import traceback
    import sys
    from eccodes import *
    
    
    def bufr_decode(input_file):
        f = open(input_file)
        # Message number 1
        # -----------------
        print 'Decoding message number 1'
        ibufr = codes_bufr_new_from_file(f)
        codes_set(ibufr, 'unpack', 1)
        iVals = codes_get_array(ibufr, 'delayedDescriptorReplicationFactor')
        iVal = codes_get(ibufr, 'edition')
        iVal = codes_get(ibufr, 'masterTableNumber')
        iVal = codes_get(ibufr, 'bufrHeaderCentre')
        iVal = codes_get(ibufr, 'bufrHeaderSubCentre')
        iVal = codes_get(ibufr, 'updateSequenceNumber')
        iVal = codes_get(ibufr, 'dataCategory')
        iVal = codes_get(ibufr, 'internationalDataSubCategory')
        iVal = codes_get(ibufr, 'dataSubCategory')
        iVal = codes_get(ibufr, 'masterTablesVersionNumber')
        iVal = codes_get(ibufr, 'localTablesVersionNumber')
        iVal = codes_get(ibufr, 'typicalYear')
        iVal = codes_get(ibufr, 'typicalMonth')
        iVal = codes_get(ibufr, 'typicalDay')
        iVal = codes_get(ibufr, 'typicalHour')
        iVal = codes_get(ibufr, 'typicalMinute')
        iVal = codes_get(ibufr, 'typicalSecond')
        iVal = codes_get(ibufr, 'numberOfSubsets')
        iVal = codes_get(ibufr, 'observedData')
        iVal = codes_get(ibufr, 'compressedData')
        iVal = codes_get(ibufr, 'unexpandedDescriptors')
        iVal = codes_get(ibufr, '#1#blockNumber')
        iVal = codes_get(ibufr, '#1#stationNumber')
        sVal = codes_get(ibufr, '#1#stationOrSiteName')
        iVal = codes_get(ibufr, '#1#stationType')
        iVal = codes_get(ibufr, '#1#year')
        iVal = codes_get(ibufr, '#1#month')
        iVal = codes_get(ibufr, '#1#day')
        iVal = codes_get(ibufr, '#1#hour')
        iVal = codes_get(ibufr, '#1#minute')
        dVal = codes_get(ibufr, '#1#latitude')
        dVal = codes_get(ibufr, '#1#longitude')
        dVal = codes_get(ibufr, '#1#heightOfStationGroundAboveMeanSeaLevel')
        dVal = codes_get(ibufr, '#1#heightOfBarometerAboveMeanSeaLevel')
        dVal = codes_get(ibufr, '#1#nonCoordinatePressure')
        dVal = codes_get(ibufr, '#1#pressureReducedToMeanSeaLevel')
        dVal = codes_get(ibufr, '#1#3HourPressureChange')
        iVal = codes_get(ibufr, '#1#characteristicOfPressureTendency')
        dVal = codes_get(ibufr, '#1#airTemperature')
        dVal = codes_get(ibufr, '#1#dewpointTemperature')
        dVal = codes_get(ibufr, '#1#horizontalVisibility')
        iVal = codes_get(ibufr, '#1#cloudCoverTotal')
        iVal = codes_get(ibufr, '#1#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#1#cloudAmount')
        iVal = codes_get(ibufr, '#1#cloudType')
        iVal = codes_get(ibufr, '#2#cloudType')
        iVal = codes_get(ibufr, '#3#cloudType')
        iVal = codes_get(ibufr, '#2#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#3#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#4#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#1#presentWeather')
        iVal = codes_get(ibufr, '#1#timePeriod')
        iVal = codes_get(ibufr, '#1#pastWeather1')
        iVal = codes_get(ibufr, '#1#pastWeather2')
        iVal = codes_get(ibufr, '#2#timePeriod')
        iVal = codes_get(ibufr, '#3#timePeriod')
        iVal = codes_get(ibufr, '#4#timePeriod')
        iVal = codes_get(ibufr, '#5#timePeriod')
        iVal = codes_get(ibufr, '#6#timePeriod')
        iVal = codes_get(ibufr, '#7#timePeriod')
        dVal = codes_get(ibufr, '#1#maximumTemperatureAtHeightAndOverPeriodSpecified')
        iVal = codes_get(ibufr, '#8#timePeriod')
        iVal = codes_get(ibufr, '#9#timePeriod')
        dVal = codes_get(ibufr, '#1#minimumTemperatureAtHeightAndOverPeriodSpecified')
        iVal = codes_get(ibufr, '#1#instrumentationForWindMeasurement')
        iVal = codes_get(ibufr, '#1#timeSignificance')
        iVal = codes_get(ibufr, '#10#timePeriod')
        iVal = codes_get(ibufr, '#1#windDirection')
        dVal = codes_get(ibufr, '#1#windSpeed')
        iVal = codes_get(ibufr, '#11#timePeriod')
        iVal = codes_get(ibufr, '#12#timePeriod')
        iVal = codes_get(ibufr, '#13#timePeriod')
        iVal = codes_get(ibufr, '#14#timePeriod')
        iVal = codes_get(ibufr, '#15#timePeriod')
        iVal = codes_get(ibufr, '#2#blockNumber')
        iVal = codes_get(ibufr, '#2#stationNumber')
        sVal = codes_get(ibufr, '#2#stationOrSiteName')
        iVal = codes_get(ibufr, '#2#stationType')
        iVal = codes_get(ibufr, '#2#year')
        iVal = codes_get(ibufr, '#2#month')
        iVal = codes_get(ibufr, '#2#day')
        iVal = codes_get(ibufr, '#2#hour')
        iVal = codes_get(ibufr, '#2#minute')
        dVal = codes_get(ibufr, '#2#latitude')
        dVal = codes_get(ibufr, '#2#longitude')
        dVal = codes_get(ibufr, '#2#heightOfStationGroundAboveMeanSeaLevel')
        dVal = codes_get(ibufr, '#2#heightOfBarometerAboveMeanSeaLevel')
        dVal = codes_get(ibufr, '#2#nonCoordinatePressure')
        dVal = codes_get(ibufr, '#2#pressureReducedToMeanSeaLevel')
        dVal = codes_get(ibufr, '#2#3HourPressureChange')
        iVal = codes_get(ibufr, '#2#characteristicOfPressureTendency')
        dVal = codes_get(ibufr, '#2#airTemperature')
        dVal = codes_get(ibufr, '#2#dewpointTemperature')
        dVal = codes_get(ibufr, '#2#horizontalVisibility')
        iVal = codes_get(ibufr, '#2#cloudCoverTotal')
        iVal = codes_get(ibufr, '#6#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#2#cloudAmount')
        dVal = codes_get(ibufr, '#2#heightOfBaseOfCloud')
        iVal = codes_get(ibufr, '#5#cloudType')
        iVal = codes_get(ibufr, '#6#cloudType')
        iVal = codes_get(ibufr, '#7#cloudType')
        iVal = codes_get(ibufr, '#7#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#3#cloudAmount')
        iVal = codes_get(ibufr, '#8#cloudType')
        dVal = codes_get(ibufr, '#3#heightOfBaseOfCloud')
        iVal = codes_get(ibufr, '#8#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#9#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#10#verticalSignificanceSurfaceObservations')
        iVal = codes_get(ibufr, '#2#presentWeather')
        iVal = codes_get(ibufr, '#18#timePeriod')
        iVal = codes_get(ibufr, '#2#pastWeather1')
        iVal = codes_get(ibufr, '#2#pastWeather2')
        iVal = codes_get(ibufr, '#19#timePeriod')
        iVal = codes_get(ibufr, '#20#timePeriod')
        iVal = codes_get(ibufr, '#21#timePeriod')
        iVal = codes_get(ibufr, '#22#timePeriod')
        iVal = codes_get(ibufr, '#23#timePeriod')
        iVal = codes_get(ibufr, '#24#timePeriod')
        dVal = codes_get(ibufr, '#2#maximumTemperatureAtHeightAndOverPeriodSpecified')
        iVal = codes_get(ibufr, '#25#timePeriod')
        iVal = codes_get(ibufr, '#26#timePeriod')
        dVal = codes_get(ibufr, '#2#minimumTemperatureAtHeightAndOverPeriodSpecified')
        iVal = codes_get(ibufr, '#2#instrumentationForWindMeasurement')
        iVal = codes_get(ibufr, '#3#timeSignificance')
        iVal = codes_get(ibufr, '#27#timePeriod')
        iVal = codes_get(ibufr, '#2#windDirection')
        dVal = codes_get(ibufr, '#2#windSpeed')
        iVal = codes_get(ibufr, '#28#timePeriod')
        iVal = codes_get(ibufr, '#29#timePeriod')
        iVal = codes_get(ibufr, '#30#timePeriod')
        iVal = codes_get(ibufr, '#31#timePeriod')
        iVal = codes_get(ibufr, '#32#timePeriod')
        codes_release(ibufr)
    
    
        f.close()
    
    def main():
        if len(sys.argv) < 2:
            print >>sys.stderr, 'Usage: ', sys.argv[0], ' BUFR_file'
            sys.exit(1)
    
        try:
            bufr_decode(sys.argv[1])
        except CodesInternalError as err:
            traceback.print_exc(file=sys.stderr)
            return 1
    
    
    if __name__ == "__main__":
        sys.exit(main())
    /* This program was automatically generated with bufr_dump -DC */
    /* Using ecCodes version: 2.0.0 */
    
    #include "eccodes.h"
    int main(int argc, char* argv[])
    {
      size_t         size = 0;
      int            err = 0;
      FILE*          fin = NULL;
      codes_handle*  h = NULL;
      long           iVal = 0;
      double         dVal = 0.0;
      char           sVal[1024] = {0,};
      long*          iValues = NULL;
      char**         sValues = NULL;
      double*        dValues = NULL;
      const char*    infile_name = NULL;
    
      if (argc != 2) {
        fprintf(stderr, "Usage: %s BUFR_file\n", argv[0]);
        return 1;
      }
      infile_name = argv[1];
      fin = fopen(infile_name, "r");
      if (!fin) {
        fprintf(stderr,"ERROR: Unable to open input BUFR file %s\n", infile_name);
        return 1;
      }
    
      h = codes_handle_new_from_file(NULL, fin, PRODUCT_BUFR, &err);
      if (h == NULL) {
        fprintf(stderr, "ERROR: cannot create BUFR handle\n");
        return 1;
      }
      CODES_CHECK(codes_set_long(h, "unpack", 1),0);
    
      free(iValues);
      iValues = (long*)malloc(4*sizeof(long));
      if (!iValues) { fprintf(stderr, "Failed to allocate memory (iValues).\n"); return 1; }
      size = 4;  CODES_CHECK(codes_get_long_array(h, "delayedDescriptorReplicationFactor", iValues, &size), 0);
      CODES_CHECK(codes_get_long(h, "edition", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "masterTableNumber", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "bufrHeaderCentre", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "bufrHeaderSubCentre", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "updateSequenceNumber", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "dataCategory", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "internationalDataSubCategory", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "dataSubCategory", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "masterTablesVersionNumber", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "localTablesVersionNumber", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "typicalYear", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "typicalMonth", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "typicalDay", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "typicalHour", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "typicalMinute", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "typicalSecond", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "numberOfSubsets", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "observedData", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "compressedData", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "unexpandedDescriptors", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#blockNumber", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#stationNumber", &iVal), 0);
      size = 1024;
      CODES_CHECK(codes_get_string(h, "#1#stationOrSiteName", sVal, &size), 0);
      CODES_CHECK(codes_get_long(h, "#1#stationType", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#year", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#month", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#day", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#hour", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#minute", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#latitude", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#longitude", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#heightOfStationGroundAboveMeanSeaLevel", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#heightOfBarometerAboveMeanSeaLevel", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#nonCoordinatePressure", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#pressureReducedToMeanSeaLevel", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#3HourPressureChange", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#characteristicOfPressureTendency", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#airTemperature", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#dewpointTemperature", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#horizontalVisibility", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#cloudCoverTotal", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#cloudAmount", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#cloudType", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#cloudType", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#3#cloudType", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#3#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#4#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#presentWeather", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#pastWeather1", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#pastWeather2", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#3#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#4#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#5#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#6#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#7#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#maximumTemperatureAtHeightAndOverPeriodSpecified", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#8#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#9#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#minimumTemperatureAtHeightAndOverPeriodSpecified", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#instrumentationForWindMeasurement", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#timeSignificance", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#10#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#1#windDirection", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#1#windSpeed", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#11#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#12#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#13#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#14#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#15#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#blockNumber", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#stationNumber", &iVal), 0);
      size = 1024;
      CODES_CHECK(codes_get_string(h, "#2#stationOrSiteName", sVal, &size), 0);
      CODES_CHECK(codes_get_long(h, "#2#stationType", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#year", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#month", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#day", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#hour", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#minute", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#latitude", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#longitude", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#heightOfStationGroundAboveMeanSeaLevel", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#heightOfBarometerAboveMeanSeaLevel", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#nonCoordinatePressure", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#pressureReducedToMeanSeaLevel", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#3HourPressureChange", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#characteristicOfPressureTendency", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#airTemperature", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#dewpointTemperature", &dVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#horizontalVisibility", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#cloudCoverTotal", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#6#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#cloudAmount", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#heightOfBaseOfCloud", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#5#cloudType", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#6#cloudType", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#7#cloudType", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#7#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#3#cloudAmount", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#8#cloudType", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#3#heightOfBaseOfCloud", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#8#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#9#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#10#verticalSignificanceSurfaceObservations", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#presentWeather", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#18#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#pastWeather1", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#pastWeather2", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#19#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#20#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#21#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#22#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#23#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#24#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#maximumTemperatureAtHeightAndOverPeriodSpecified", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#25#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#26#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#minimumTemperatureAtHeightAndOverPeriodSpecified", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#instrumentationForWindMeasurement", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#3#timeSignificance", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#27#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#2#windDirection", &iVal), 0);
      CODES_CHECK(codes_get_double(h, "#2#windSpeed", &dVal), 0);
      CODES_CHECK(codes_get_long(h, "#28#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#29#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#30#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#31#timePeriod", &iVal), 0);
      CODES_CHECK(codes_get_long(h, "#32#timePeriod", &iVal), 0);
    
      codes_handle_delete(h);
      free(iValues); iValues = NULL;
      free(dValues); dValues = NULL;
      free(sValues); sValues = NULL;
    
      if (fclose(fin)!=0) {
        fprintf(stderr, "Failed to close file handle.\n");
        return 1;
      }
      return 0;
    }
    #  This filter was automatically generated with bufr_dump -Dfilter
    #  Using ecCodes version: 2.0.0
    
    set unpack=1;
    print "delayedDescriptorReplicationFactor=[delayedDescriptorReplicationFactor]";
    print "edition=[edition]";
    print "masterTableNumber=[masterTableNumber]";
    print "bufrHeaderCentre=[bufrHeaderCentre]";
    print "bufrHeaderSubCentre=[bufrHeaderSubCentre]";
    print "updateSequenceNumber=[updateSequenceNumber]";
    print "dataCategory=[dataCategory]";
    print "internationalDataSubCategory=[internationalDataSubCategory]";
    print "dataSubCategory=[dataSubCategory]";
    print "masterTablesVersionNumber=[masterTablesVersionNumber]";
    print "localTablesVersionNumber=[localTablesVersionNumber]";
    print "typicalYear=[typicalYear]";
    print "typicalMonth=[typicalMonth]";
    print "typicalDay=[typicalDay]";
    print "typicalHour=[typicalHour]";
    print "typicalMinute=[typicalMinute]";
    print "typicalSecond=[typicalSecond]";
    print "numberOfSubsets=[numberOfSubsets]";
    print "observedData=[observedData]";
    print "compressedData=[compressedData]";
    print "unexpandedDescriptors=[unexpandedDescriptors]";
    print "#1#blockNumber=[#1#blockNumber]";
    print "#1#stationNumber=[#1#stationNumber]";
    print "#1#stationOrSiteName=[#1#stationOrSiteName]";
    print "#1#stationType=[#1#stationType]";
    print "#1#year=[#1#year]";
    print "#1#month=[#1#month]";
    print "#1#day=[#1#day]";
    print "#1#hour=[#1#hour]";
    print "#1#minute=[#1#minute]";
    print "#1#latitude=[#1#latitude]";
    print "#1#longitude=[#1#longitude]";
    print "#1#heightOfStationGroundAboveMeanSeaLevel=[#1#heightOfStationGroundAboveMeanSeaLevel]";
    print "#1#heightOfBarometerAboveMeanSeaLevel=[#1#heightOfBarometerAboveMeanSeaLevel]";
    print "#1#nonCoordinatePressure=[#1#nonCoordinatePressure]";
    print "#1#pressureReducedToMeanSeaLevel=[#1#pressureReducedToMeanSeaLevel]";
    print "#1#3HourPressureChange=[#1#3HourPressureChange]";
    print "#1#characteristicOfPressureTendency=[#1#characteristicOfPressureTendency]";
    print "#1#airTemperature=[#1#airTemperature]";
    print "#1#dewpointTemperature=[#1#dewpointTemperature]";
    print "#1#horizontalVisibility=[#1#horizontalVisibility]";
    print "#1#cloudCoverTotal=[#1#cloudCoverTotal]";
    print "#1#verticalSignificanceSurfaceObservations=[#1#verticalSignificanceSurfaceObservations]";
    print "#1#cloudAmount=[#1#cloudAmount]";
    print "#1#cloudType=[#1#cloudType]";
    print "#2#cloudType=[#2#cloudType]";
    print "#3#cloudType=[#3#cloudType]";
    print "#2#verticalSignificanceSurfaceObservations=[#2#verticalSignificanceSurfaceObservations]";
    print "#3#verticalSignificanceSurfaceObservations=[#3#verticalSignificanceSurfaceObservations]";
    print "#4#verticalSignificanceSurfaceObservations=[#4#verticalSignificanceSurfaceObservations]";
    print "#1#presentWeather=[#1#presentWeather]";
    print "#1#timePeriod=[#1#timePeriod]";
    print "#1#pastWeather1=[#1#pastWeather1]";
    print "#1#pastWeather2=[#1#pastWeather2]";
    print "#2#timePeriod=[#2#timePeriod]";
    print "#3#timePeriod=[#3#timePeriod]";
    print "#4#timePeriod=[#4#timePeriod]";
    print "#5#timePeriod=[#5#timePeriod]";
    print "#6#timePeriod=[#6#timePeriod]";
    print "#7#timePeriod=[#7#timePeriod]";
    print "#1#maximumTemperatureAtHeightAndOverPeriodSpecified=[#1#maximumTemperatureAtHeightAndOverPeriodSpecified]";
    print "#8#timePeriod=[#8#timePeriod]";
    print "#9#timePeriod=[#9#timePeriod]";
    print "#1#minimumTemperatureAtHeightAndOverPeriodSpecified=[#1#minimumTemperatureAtHeightAndOverPeriodSpecified]";
    print "#1#instrumentationForWindMeasurement=[#1#instrumentationForWindMeasurement]";
    print "#1#timeSignificance=[#1#timeSignificance]";
    print "#10#timePeriod=[#10#timePeriod]";
    print "#1#windDirection=[#1#windDirection]";
    print "#1#windSpeed=[#1#windSpeed]";
    print "#11#timePeriod=[#11#timePeriod]";
    print "#12#timePeriod=[#12#timePeriod]";
    print "#13#timePeriod=[#13#timePeriod]";
    print "#14#timePeriod=[#14#timePeriod]";
    print "#15#timePeriod=[#15#timePeriod]";
    print "#2#blockNumber=[#2#blockNumber]";
    print "#2#stationNumber=[#2#stationNumber]";
    print "#2#stationOrSiteName=[#2#stationOrSiteName]";
    print "#2#stationType=[#2#stationType]";
    print "#2#year=[#2#year]";
    print "#2#month=[#2#month]";
    print "#2#day=[#2#day]";
    print "#2#hour=[#2#hour]";
    print "#2#minute=[#2#minute]";
    print "#2#latitude=[#2#latitude]";
    print "#2#longitude=[#2#longitude]";
    print "#2#heightOfStationGroundAboveMeanSeaLevel=[#2#heightOfStationGroundAboveMeanSeaLevel]";
    print "#2#heightOfBarometerAboveMeanSeaLevel=[#2#heightOfBarometerAboveMeanSeaLevel]";
    print "#2#nonCoordinatePressure=[#2#nonCoordinatePressure]";
    print "#2#pressureReducedToMeanSeaLevel=[#2#pressureReducedToMeanSeaLevel]";
    print "#2#3HourPressureChange=[#2#3HourPressureChange]";
    print "#2#characteristicOfPressureTendency=[#2#characteristicOfPressureTendency]";
    print "#2#airTemperature=[#2#airTemperature]";
    print "#2#dewpointTemperature=[#2#dewpointTemperature]";
    print "#2#horizontalVisibility=[#2#horizontalVisibility]";
    print "#2#cloudCoverTotal=[#2#cloudCoverTotal]";
    print "#6#verticalSignificanceSurfaceObservations=[#6#verticalSignificanceSurfaceObservations]";
    print "#2#cloudAmount=[#2#cloudAmount]";
    print "#2#heightOfBaseOfCloud=[#2#heightOfBaseOfCloud]";
    print "#5#cloudType=[#5#cloudType]";
    print "#6#cloudType=[#6#cloudType]";
    print "#7#cloudType=[#7#cloudType]";
    print "#7#verticalSignificanceSurfaceObservations=[#7#verticalSignificanceSurfaceObservations]";
    print "#3#cloudAmount=[#3#cloudAmount]";
    print "#8#cloudType=[#8#cloudType]";
    print "#3#heightOfBaseOfCloud=[#3#heightOfBaseOfCloud]";
    print "#8#verticalSignificanceSurfaceObservations=[#8#verticalSignificanceSurfaceObservations]";
    print "#9#verticalSignificanceSurfaceObservations=[#9#verticalSignificanceSurfaceObservations]";
    print "#10#verticalSignificanceSurfaceObservations=[#10#verticalSignificanceSurfaceObservations]";
    print "#2#presentWeather=[#2#presentWeather]";
    print "#18#timePeriod=[#18#timePeriod]";
    print "#2#pastWeather1=[#2#pastWeather1]";
    print "#2#pastWeather2=[#2#pastWeather2]";
    print "#19#timePeriod=[#19#timePeriod]";
    print "#20#timePeriod=[#20#timePeriod]";
    print "#21#timePeriod=[#21#timePeriod]";
    print "#22#timePeriod=[#22#timePeriod]";
    print "#23#timePeriod=[#23#timePeriod]";
    print "#24#timePeriod=[#24#timePeriod]";
    print "#2#maximumTemperatureAtHeightAndOverPeriodSpecified=[#2#maximumTemperatureAtHeightAndOverPeriodSpecified]";
    print "#25#timePeriod=[#25#timePeriod]";
    print "#26#timePeriod=[#26#timePeriod]";
    print "#2#minimumTemperatureAtHeightAndOverPeriodSpecified=[#2#minimumTemperatureAtHeightAndOverPeriodSpecified]";
    print "#2#instrumentationForWindMeasurement=[#2#instrumentationForWindMeasurement]";
    print "#3#timeSignificance=[#3#timeSignificance]";
    print "#27#timePeriod=[#27#timePeriod]";
    print "#2#windDirection=[#2#windDirection]";
    print "#2#windSpeed=[#2#windSpeed]";
    print "#28#timePeriod=[#28#timePeriod]";
    print "#29#timePeriod=[#29#timePeriod]";
    print "#30#timePeriod=[#30#timePeriod]";
    print "#31#timePeriod=[#31#timePeriod]";
    print "#32#timePeriod=[#32#timePeriod]";