Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw error when the unsliceable axis tries to slice a shape with mor… #216

Merged
merged 14 commits into from
Nov 8, 2024
Merged
6 changes: 6 additions & 0 deletions polytope_feature/datacube/backends/fdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ def __init__(
for axis_config in alternative_axes:
self.fdb_coordinates[axis_config.axis_name] = axis_config.values

fdb_coordinates_copy = deepcopy(self.fdb_coordinates)
for axis, vals in fdb_coordinates_copy.items():
if len(vals) == 1:
if vals[0] == "":
self.fdb_coordinates.pop(axis)

logging.info("Axes returned from GribJump are: " + str(self.fdb_coordinates))

self.fdb_coordinates["values"] = []
Expand Down
2 changes: 1 addition & 1 deletion polytope_feature/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ConvexPolytope(Shape):
def __init__(self, axes, points, method=None, is_orthogonal=False):
self._axes = list(axes)
self.is_flat = False
if len(self._axes) == 1:
if len(self._axes) == 1 and len(points) == 1:
self.is_flat = True
self.points = points
self.method = method
Expand Down
1 change: 0 additions & 1 deletion tests/requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ cffi
eccodes
h5netcdf
h5py
earthkit
earthkit-data
2 changes: 1 addition & 1 deletion tests/test_datacube_axes_init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import earthkit.data as data
import pytest
from earthkit import data
from helper_functions import download_test_data

from polytope_feature.datacube.datacube_axis import FloatDatacubeAxis
Expand Down
Loading