I came upon a version issue between different eo-learn versions. The issue was that the _parse_features function that was removed along time ago, does not function the same way as the parse_features function that was added included with the get_feature_parser:
It states that _parse_features was replaced with get feature_parser.
Once again I am trying to repurpose a the CloudMasking class within the tiffs_to_eopatch.py file within the field-delineation Github.
class CloudMasking(EOTask):
""" Compute cloud mask from SH cloud probability CLP data map """
def __init__(self, clp_feature: Tuple = (FeatureType.DATA, 'CLP'), clm_feature: Tuple = (FeatureType.MASK, 'CLM'),
average_over: int = 24, max_clp: float = 255.):
"""
:param clp_feature: Feature type and name of input CLP mask
:param clm_feature: Feature type and name of output CLM mask
:param average_over: Parameter used ot smooth the CLP data map
:param max_clp: Maximum value of CLP map used for normalization
"""
# _parse_features replaced with `get feature parser`
self.clm_feature = next(self._parse_features(iter(clm_feature))())
self.clp_feature = next(self._parse_features(iter(clp_feature))())
self.s2_cd = S2PixelCloudDetector(average_over=average_over)
self.max_clp = max_clp
def execute(self, eopatch: EOPatch) -> EOPatch:
""" Compute and add CLM from CLP """
clc = self.s2_cd.get_mask_from_prob(eopatch[self.clp_feature].squeeze() / self.max_clp)
eopatch[self.clm_feature] = clc[..., np.newaxis]
return eopatch
This code is resulting in the following error:
I am simply trying to understand the differences between the versions.