How to use the eccodes.codes_keys_iterator_next function in eccodes

To help you get started, we’ve selected a few eccodes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jdkloe / pybufr-ecmwf / pybufr_ecmwf / bufr.py View on Github external
print('done with unpacking')

        self.num_subsets = eccodes.codes_get(self._bufr, "numberOfSubsets")
        print('num_subsets = ', self.num_subsets)
        
        # define the attributes to be printed (see BUFR code table B)
        attrs = [
            'code',
            'units',
            'scale',
            'reference',
            'width'
            ]
        
        iterid = eccodes.codes_keys_iterator_new(self._bufr, 'ls')
        while eccodes.codes_keys_iterator_next(iterid):
            keyname = eccodes.codes_keys_iterator_get_name(iterid)
            print('  %s: %s' %
                  (keyname, eccodes.codes_get(self._bufr, keyname)))

        # get unexpanded descriptors
        key = 'unexpandedDescriptors'
        num = eccodes.codes_get_size(self._bufr, key)
        print('  size of %s is: %s' % (key, num))
        values = eccodes.codes_get_array(self._bufr, key)
        for i in xrange(len(values)):
            print("   %d %06d" % (i + 1, values[i]))
        
        # get the expanded descriptors
        key = 'bufrdcExpandedDescriptors'
        num = eccodes.codes_get_size(self._bufr, key)
        print('  size of %s is: %s' % (key, num))