microsoft / PlanetaryComputerExamples

Examples of using the Planetary Computer
MIT License
369 stars 181 forks source link

ExtensionNotImplemented error #190

Closed gtgrp-user closed 2 years ago

gtgrp-user commented 2 years ago

As suggested in a comment in #182, I tried the label collection in Africa (ref_landcovernet_af_v1_labels). However, I now receive the following error.

---------------------------------------------------------------------------
ExtensionNotImplemented                   Traceback (most recent call last)
/tmp/ipykernel_17820/416491967.py in <module>
      2 
      3 first_item = next(item_search.get_items())
----> 4 first_item_label_ext = LabelExtension.ext(first_item)
      5 
      6 label_classes = first_item_label_ext.label_classes

/opt/conda/lib/python3.8/site-packages/pystac/extensions/label.py in ext(cls, obj, add_if_missing)
    699         """
    700         if isinstance(obj, pystac.Item):
--> 701             cls.validate_has_extension(obj, add_if_missing)
    702             return cls(obj)
    703         else:

/opt/conda/lib/python3.8/site-packages/pystac/extensions/base.py in validate_has_extension(cls, obj, add_if_missing)
    174 
    175         if cls.get_schema_uri() not in obj.stac_extensions:
--> 176             raise pystac.ExtensionNotImplemented(
    177                 f"Could not find extension schema URI {cls.get_schema_uri()} in object."
    178             )

ExtensionNotImplemented: Could not find extension schema URI https://stac-extensions.github.io/label/v1.0.1/schema.json in object.
TomAugspurger commented 2 years ago

Thanks for looking into this, I haven't had a chance yet.

If you're interested in working on this, I suspect that this collection has started using the classification extension rather than the label extension. The notebook code will need to be updated as well.

gtgrp-user commented 2 years ago

Thanks for your quick response. I am using the pystac version 1.4.0 which doesn't include the classification extension. Am I missing something?

TomAugspurger commented 2 years ago

Closing this in favor of #182