def walk_filtered(filesystem, patch_location, features):
Based on EOPatch.walk generator, but applies feature filtering based on the `features` argument
itr = EOPatch.walk(filesystem, patch_location)
itr = ((FeatureType(ftype), fname, path) for ftype, fname, path in itr)
features = FeatureParser(features).feature_collection
for ftype, fname, path in itr:
if ftype in [FeatureType.BBOX, FeatureType.TIMESTAMP, FeatureType.META_INFO]:
yield ftype, fname, path
if ftype not in features.keys():
continue
ftrs = features[ftype]
if ftrs == Ellipsis or fname in ftrs:
yield ftype, fname, path
After Change
Based on EOPatch.walk generator, but applies feature filtering based on the `features` argument
features = FeatureParser(features).feature_collection
for ftype, fname, path in EOPatch.walk(filesystem, patch_location):
if ftype.is_meta():
yield ftype, fname, path
if ftype not in features:
continue
ftrs = features[ftype]
if ftrs is Ellipsis or fname in ftrs:
yield ftype, fname, path