def _pq_native_transform(xx: xr.Dataset) -> xr.Dataset: """ config: bad_pixel_classes cloud_classes """ valid = enum_to_bool(xx.SCL, bad_pixel_classes, invert=True, value_true=255, dtype='uint8') clear = enum_to_bool(xx.SCL, bad_pixel_classes+cloud_classes, invert=True, value_true=255, dtype='uint8') return xr.Dataset(dict(valid=valid, clear=clear))
def _native_op_data_band(self, xx): from odc.algo import enum_to_bool, keep_good_only if not self._mask_band in xx.data_vars: return xx # Erase Data Pixels for which mask == nodata # # xx[mask == nodata] = nodata mask = xx[self._mask_band] xx = xx.drop_vars([self._mask_band]) keeps = enum_to_bool(mask, self._nodata_classes, invert=True) xx = keep_good_only(xx, keeps) return xx
def _pq_native_transform(xx: xr.Dataset) -> xr.Dataset: """ config: cloud_classes .SCL -> .valid (anything but nodata) .erased (cloud pixels only) """ scl = xx.SCL valid = scl != scl.nodata erased = enum_to_bool(scl, cloud_classes) return xr.Dataset( dict(valid=valid, erased=erased), attrs={"native": True}, # <- native flag needed for fuser )
def native_op(xx: xr.Dataset) -> xr.Dataset: _xx = enum_to_bool(xx[band], categories) return xr.Dataset( {band: _xx}, attrs={"native": True}, # <- native flag needed for fuser )