|
24 | 24 | )
|
25 | 25 | from pystac.extensions.hooks import ExtensionHooks
|
26 | 26 | import pystac.extensions.item_assets as item_assets
|
27 |
| -from pystac.extensions.raster import RasterBand, RasterExtension |
| 27 | +from pystac.extensions.raster import RasterBand |
28 | 28 | from pystac.serialization.identify import STACJSONDescription, STACVersionID
|
29 | 29 | from pystac.utils import get_required, map_opt
|
30 | 30 |
|
@@ -614,30 +614,30 @@ def __repr__(self) -> str:
|
614 | 614 | return f"<RasterBandClassificationExtension RasterBand={self.raster_band}>"
|
615 | 615 |
|
616 | 616 |
|
617 |
| -# class SummariesClassificationExtension(SummariesExtension): |
618 |
| -# @property |
619 |
| -# def classes(self) -> Optional[List[Classification]]: |
620 |
| -# return map_opt( |
621 |
| -# lambda classes: [Classification(c) for c in classes], |
622 |
| -# self.summaries.get_list(CLASSES_PROP), |
623 |
| -# ) |
624 |
| - |
625 |
| -# @classes.setter |
626 |
| -# def classes(self, v: Optional[List[Classification]]) -> None: |
627 |
| -# self._set_summary(CLASSES_PROP, map_opt(lambda x: [c.to_dict() for c in x], v)) |
628 |
| - |
629 |
| -# @property |
630 |
| -# def bitfields(self) -> Optional[List[Bitfield]]: |
631 |
| -# return map_opt( |
632 |
| -# lambda bitfields: [Bitfield(b) for b in bitfields], |
633 |
| -# self.summaries.get_list(BITFIELDS_PROP), |
634 |
| -# ) |
635 |
| - |
636 |
| -# @bitfields.setter |
637 |
| -# def bitfields(self, v: Optional[List[Bitfield]]) -> None: |
638 |
| -# self._set_summary( |
639 |
| -# BITFIELDS_PROP, map_opt(lambda x: [b.to_dict() for b in x], v) |
640 |
| -# ) |
| 617 | +class SummariesClassificationExtension(SummariesExtension): |
| 618 | + @property |
| 619 | + def classes(self) -> Optional[List[Classification]]: |
| 620 | + return map_opt( |
| 621 | + lambda classes: [Classification(c) for c in classes], |
| 622 | + self.summaries.get_list(CLASSES_PROP), |
| 623 | + ) |
| 624 | + |
| 625 | + @classes.setter |
| 626 | + def classes(self, v: Optional[List[Classification]]) -> None: |
| 627 | + self._set_summary(CLASSES_PROP, map_opt(lambda x: [c.to_dict() for c in x], v)) |
| 628 | + |
| 629 | + @property |
| 630 | + def bitfields(self) -> Optional[List[Bitfield]]: |
| 631 | + return map_opt( |
| 632 | + lambda bitfields: [Bitfield(b) for b in bitfields], |
| 633 | + self.summaries.get_list(BITFIELDS_PROP), |
| 634 | + ) |
| 635 | + |
| 636 | + @bitfields.setter |
| 637 | + def bitfields(self, v: Optional[List[Bitfield]]) -> None: |
| 638 | + self._set_summary( |
| 639 | + BITFIELDS_PROP, map_opt(lambda x: [b.to_dict() for b in x], v) |
| 640 | + ) |
641 | 641 |
|
642 | 642 |
|
643 | 643 | class ClassificationExtensionHooks(ExtensionHooks):
|
|
0 commit comments