Skip to content

Error in leafmap-example.ipynb #299

@robmarkcole

Description

@robmarkcole

First cell:

import leafmap

m = leafmap.Map()
m.add_stac_layer(
    collection="landsat-c2-l2",
    item="LC09_L2SP_047026_20220305_02_T1",
    assets="red",
    rescale="0,12000",
    colormap_name="reds",
)
m
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 4
      1 import leafmap
      3 m = leafmap.Map()
----> 4 m.add_stac_layer(
      5     collection="landsat-c2-l2",
      6     item="LC09_L2SP_047026_20220305_02_T1",
      7     assets="red",
      8     rescale="0,12000",
      9     colormap_name="reds",
     10 )
     11 m

File /home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/leafmap/leafmap.py:1154, in Map.add_stac_layer(self, url, collection, item, assets, bands, titiler_endpoint, name, attribution, opacity, shown, fit_bounds, layer_index, **kwargs)
   1152 band_names = stac_bands(url, collection, item, titiler_endpoint)
   1153 if assets is not None:
-> 1154     indexes = [band_names.index(band) + 1 for band in assets]
   1155 else:
   1156     indexes = None

File /home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/leafmap/leafmap.py:1154, in <listcomp>(.0)
   1152 band_names = stac_bands(url, collection, item, titiler_endpoint)
   1153 if assets is not None:
-> 1154     indexes = [band_names.index(band) + 1 for band in assets]
   1155 else:
   1156     indexes = None

ValueError: 'r' is not in list

And Second cell results in ValueError: 'nir08, red' is not in list.
Third cell is fine 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions