Skip to content

error in Landsat8-cog-ndvi-hvplot.iynb #35

@echoxiangzhou

Description

@echoxiangzhou

running the line in the Landsat8-cog-ndvi-hvplot.iynb

display(band1.hvplot(rasterize=True, width=600, height=400, cmap='viridis'))

results:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/srv/conda/envs/iocasdata/lib/python3.7/site-packages/xarray/core/utils.py in __len__(self)
    501         try:
--> 502             return self.shape[0]
    503         except IndexError:

IndexError: tuple index out of range

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<timed eval> in <module>

/srv/conda/envs/iocasdata/lib/python3.7/site-packages/hvplot/plotting/core.py in __call__(self, x, y, kind, **kwds)
     70                 return pn.panel(plot, **panel_dict)
     71 
---> 72         return self._get_converter(x, y, kind, **kwds)(kind, x, y)
     73 
     74     def _get_converter(self, x=None, y=None, kind=None, **kwds):

/srv/conda/envs/iocasdata/lib/python3.7/site-packages/hvplot/converter.py in __call__(self, kind, x, y)
    942                 obj = DynamicMap(cbcallable, streams=[self.stream])
    943             else:
--> 944                 obj = method(x, y)
    945 
    946         if self.crs and self.project:

/srv/conda/envs/iocasdata/lib/python3.7/site-packages/hvplot/converter.py in rgb(self, x, y, z, data)
   1586             z = list(data.data_vars)[0]
   1587         data = data[z]
-> 1588         nbands = len(data.coords[bands])
   1589         if nbands < 3:
   1590             raise ValueError('Selected bands coordinate (%s) has only %d channels,'

/srv/conda/envs/iocasdata/lib/python3.7/site-packages/xarray/core/dataarray.py in __len__(self)
    541 
    542     def __len__(self) -> int:
--> 543         return len(self.variable)
    544 
    545     @property

/srv/conda/envs/iocasdata/lib/python3.7/site-packages/xarray/core/utils.py in __len__(self)
    502             return self.shape[0]
    503         except IndexError:
--> 504             raise TypeError("len() of unsized object")
    505 
    506 

TypeError: len() of unsized object

and package versions:

# Print package versions
print('xarray version: ', xr.__version__)
print('rasterio version: ', rasterio.__version__)
print('hvplot version: ', hvplot.__version__)

xarray version: 0.15.1
rasterio version: 1.1.3
hvplot version: 0.5.2

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