Skip to content

Commit

Permalink
Fix output widget bug
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Apr 22, 2024
1 parent d734ffa commit be6face
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion hypercoast/hypercoast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import ipyleaflet
import leafmap

import xarray as xr
from .emit import read_emit, plot_emit, viz_emit, emit_to_netcdf, emit_to_image


Expand Down Expand Up @@ -38,6 +38,7 @@ def add(self, obj, position="topright", **kwargs):
from .ui import SpectralWidget

SpectralWidget(self, position=position)
self.set_plot_options(add_marker_cluster=True)

else:
super().add(obj, **kwargs)
Expand Down Expand Up @@ -159,6 +160,9 @@ def add_emit(

xds = read_emit(source)
source = emit_to_image(xds, wavelengths=wavelengths)
elif isinstance(source, xr.Dataset):
xds = source
source = emit_to_image(xds, wavelengths=wavelengths)

self.add_raster(
source,
Expand Down
3 changes: 2 additions & 1 deletion hypercoast/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ def cleanup(self):
if hasattr(self._host_map, "_spectral_data"):
self._host_map._spectral_data = {}

self._output_widget.clear_output()
if hasattr(self, "_output_widget") and self._output_widget is not None:
self._output_widget.clear_output()

if self.on_close is not None:
self.on_close()

0 comments on commit be6face

Please sign in to comment.