Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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))
values = eccodes.codes_get_array(self._bufr, key)