def _get_message_keys(self): """Creates a generator of all the keys in the message.""" keys_itr = gribapi.grib_keys_iterator_new(self._message_id) gribapi.grib_skip_computed(keys_itr) while gribapi.grib_keys_iterator_next(keys_itr): yield gribapi.grib_keys_iterator_get_name(keys_itr) gribapi.grib_keys_iterator_delete(keys_itr)
def keys(self, namespace=None): """Get available keys in message.""" iterator = gribapi.grib_keys_iterator_new(self.gid, namespace=namespace) keys = [] while gribapi.grib_keys_iterator_next(iterator): key = gribapi.grib_keys_iterator_get_name(iterator) keys.append(key) gribapi.grib_keys_iterator_delete(iterator) return keys
def get_keys(self, namespace=None): """Get available keys in message.""" iterator = gribapi.grib_keys_iterator_new(self.gid, namespace=namespace) keys = [] while gribapi.grib_keys_iterator_next(iterator): key = gribapi.grib_keys_iterator_get_name(iterator) keys.append(key) gribapi.grib_keys_iterator_delete(iterator) return keys