def _get_value_or_missing(self, key, use_int=False): """ Return value of header element, or None if value is encoded as missing. Implementation of Regulations 92.1.4 and 92.1.5 via ECCodes. """ if gribapi.grib_is_missing(self._message_id, key): result = None else: if use_int: result = gribapi.grib_get(self._message_id, key, int) else: result = gribapi.grib_get(self._message_id, key) return result
def _get_value_or_missing(self, key, use_int=False): """ Return value of header element, or None if value is encoded as missing. Implementation of Regulations 92.1.4 and 92.1.5 via ECCodes. """ if gribapi.grib_is_missing(self._message_id, key): result = None else: if use_int: result = gribapi.grib_get(self._message_id, key, int) else: result = gribapi.grib_get(self._message_id, key) return result
def __init__(self, gid): self._gid = gid self._geo_keys = { key_: getattr(gribapi, 'grib_get_{}'.format(type_))(gid, key_) for key_, type_ in self.keys if gribapi.grib_is_defined(gid, key_) } self._missing_keys = { key_: 'MISSING' for key_ in self.check_for_missing_keys if gribapi.grib_is_missing(gid, key_) } self._grid_type = self._geo_keys.get('gridType') self._points_meridian = self._geo_keys.get('Nj') self._missing_value = self._geo_keys.get('missingValue') self._grid_id = self._build_id() # lazy computation self._lats = None self._longs = None self._grid_details_2nd = None self._change_resolution_step = None
def missing(self, key): """Report if key is missing.""" return bool(gribapi.grib_is_missing(self.gid, key))
def missing(self, key): """Report if key is missing.""" return bool(gribapi.grib_is_missing(self.gid, key))