diff --git a/src/earthkit/plots/quickmap.py b/src/earthkit/plots/quickmap.py index 6ecf3b6..506ede1 100644 --- a/src/earthkit/plots/quickmap.py +++ b/src/earthkit/plots/quickmap.py @@ -34,6 +34,11 @@ def scatter(*args, **kwargs): """Quick plot""" +@_quickmap +def point_cloud(*args, **kwargs): + """Quick plot""" + + @_quickmap def block(*args, **kwargs): """Quick plot""" diff --git a/src/earthkit/plots/sources/__init__.py b/src/earthkit/plots/sources/__init__.py index f2847f5..6366f89 100644 --- a/src/earthkit/plots/sources/__init__.py +++ b/src/earthkit/plots/sources/__init__.py @@ -52,7 +52,7 @@ def get_source(*args, data=None, x=None, y=None, z=None, u=None, v=None, **kwarg if len(args) == 1 and core_data is None: core_data = args[0] if core_data is not None: - if data.__class__.__name__ in ("Dataset", "DataArray"): + if core_data.__class__.__name__ in ("Dataset", "DataArray"): cls = XarraySource elif isinstance(core_data, ek_data.core.Base): cls = EarthkitSource diff --git a/src/earthkit/plots/sources/earthkit.py b/src/earthkit/plots/sources/earthkit.py index 24b710b..913f11b 100644 --- a/src/earthkit/plots/sources/earthkit.py +++ b/src/earthkit/plots/sources/earthkit.py @@ -92,7 +92,10 @@ def metadata(self, key, default=None): """ value = super().metadata(key, default) if value == default: - value = self.data.metadata(key, default=default) + try: + value = self.data.metadata(key, default=default) + except NotImplementedError: + pass return value def datetime(self, *args, **kwargs): diff --git a/src/earthkit/plots/sources/xarray.py b/src/earthkit/plots/sources/xarray.py index 8f87571..30e364b 100644 --- a/src/earthkit/plots/sources/xarray.py +++ b/src/earthkit/plots/sources/xarray.py @@ -190,18 +190,17 @@ def y_values(self): def z_values(self): """The z values of the data.""" values = None - if len(self.dims) > 1: - if self._z is None: - if not hasattr(self.data, "data_vars"): - data = self.data - else: - data = self.data[list(self.data.data_vars)[0]] + if self._z is None: + if not hasattr(self.data, "data_vars"): + data = self.data else: - data = self.data[self._z] - values = data.values - x, y = self.extract_xy() - if [y, x] != [c for c in data.dims if c in [y, x]]: - values = values.T + data = self.data[list(self.data.data_vars)[0]] + else: + data = self.data[self._z] + values = data.values + # x, y = self.extract_xy() + # if [y, x] != [c for c in data.dims if c in [y, x]]: + # values = values.T return values diff --git a/src/earthkit/plots/styles/__init__.py b/src/earthkit/plots/styles/__init__.py index b01ad33..53dbefe 100644 --- a/src/earthkit/plots/styles/__init__.py +++ b/src/earthkit/plots/styles/__init__.py @@ -483,7 +483,12 @@ def scatter(self, ax, x, y, values, s=3, *args, **kwargs): if values is not None: kwargs = {**self.to_scatter_kwargs(values), **kwargs} kwargs.pop("extend", None) - if values is not None and missing_values is not None and np.isnan(values).any(): + if ( + values is not None + and missing_values is not None + and np.isnan(values).any() + and len(values.shape) > 1 + ): missing_idx = np.where(np.isnan(values)) missing_x = x[missing_idx] missing_y = y[missing_idx]