Repository: UXARRAY/uxarray

Issue:
Improve Test Coverage for `uxarray.subset` 

Discussion:

Patch:
diff --git a/uxarray/cross_sections/dataarray_accessor.py b/uxarray/cross_sections/dataarray_accessor.py
index 43365b79..7d7610db 100644
--- a/uxarray/cross_sections/dataarray_accessor.py
+++ b/uxarray/cross_sections/dataarray_accessor.py
@@ -133,9 +133,6 @@ class UxDataArrayCrossSectionAccessor:
         lats : Tuple[float, float]
             The latitude interval (min_lat, max_lat) at which to extract the cross-section,
             in degrees. Values must be between -90.0 and 90.0
-        return_face_indices : bool, optional
-            If True, also returns the indices of the faces that intersect with the
-            latitude interval.
         inverse_indices : Union[List[str], Set[str], bool], optional
             Controls storage of original grid indices. Options:
             - True: Stores original face indices
@@ -181,8 +178,6 @@ class UxDataArrayCrossSectionAccessor:
         lons : Tuple[float, float]
             The longitude interval (min_lon, max_lon) at which to extract the cross-section,
             in degrees. Values must be between -180.0 and 180.0
-        return_face_indices : bool, optional
-            If True, also returns the indices of the faces that intersect are within a specifed longitude interval.
         inverse_indices : Union[List[str], Set[str], bool], optional
             Controls storage of original grid indices. Options:
             - True: Stores original face indices
@@ -215,9 +210,3 @@ class UxDataArrayCrossSectionAccessor:
         faces = self.uxda.uxgrid.get_faces_between_longitudes(lons)
 
         return self.uxda.isel(n_face=faces, inverse_indices=inverse_indices)
-
-    def gca(self, *args, **kwargs):
-        raise NotImplementedError
-
-    def gca_gca(self, *args, **kwargs):
-        raise NotImplementedError
diff --git a/uxarray/cross_sections/grid_accessor.py b/uxarray/cross_sections/grid_accessor.py
index 921a6060..b4fed76d 100644
--- a/uxarray/cross_sections/grid_accessor.py
+++ b/uxarray/cross_sections/grid_accessor.py
@@ -159,9 +159,6 @@ class GridCrossSectionAccessor:
         else:
             return grid_at_constant_lon
 
-    def gca(self, *args, **kwargs):
-        raise NotImplementedError
-
     def constant_latitude_interval(
         self,
         lats: Tuple[float, float],
@@ -284,6 +281,3 @@ class GridCrossSectionAccessor:
             return grid_between_lons, faces
         else:
             return grid_between_lons
-
-    def gca_gca(self, *args, **kwargs):
-        raise NotImplementedError
diff --git a/uxarray/subset/dataarray_accessor.py b/uxarray/subset/dataarray_accessor.py
index f5f64d9f..0c2279e4 100644
--- a/uxarray/subset/dataarray_accessor.py
+++ b/uxarray/subset/dataarray_accessor.py
@@ -59,9 +59,11 @@ class DataArraySubsetAccessor:
             - List/Set of strings: Stores specified index types (valid values: "face", "edge", "node")
             - False: No index storage (default)
         """
-        grid = self.uxda.uxgrid.subset.bounding_box(lon_bounds, lat_bounds)
+        grid = self.uxda.uxgrid.subset.bounding_box(
+            lon_bounds, lat_bounds, inverse_indices=inverse_indices
+        )
 
-        return self.uxda._slice_from_grid(grid, inverse_indices=inverse_indices)
+        return self.uxda._slice_from_grid(grid)
 
     def bounding_circle(
         self,


Test patch:
diff --git a/test/test_cross_sections.py b/test/test_cross_sections.py
index 4942c86f..1cf602de 100644
--- a/test/test_cross_sections.py
+++ b/test/test_cross_sections.py
@@ -10,10 +10,31 @@ import numpy.testing as nt
 current_path = Path(__file__).resolve().parent
 quad_hex_grid_path = current_path / 'meshfiles' / "ugrid" / "quad-hexagon" / 'grid.nc'
 quad_hex_data_path = current_path / 'meshfiles' / "ugrid" / "quad-hexagon" / 'data.nc'
+quad_hex_node_data = current_path / 'meshfiles' / "ugrid" / "quad-hexagon" / 'random-node-data.nc'
 cube_sphere_grid = current_path / "meshfiles" / "ugrid" / "outCSne30" / "outCSne30.ug"
 
 from uxarray.grid.intersections import constant_lat_intersections_face_bounds
 
+
+def test_repr():
+    uxds = ux.open_dataset(quad_hex_grid_path, quad_hex_data_path)
+
+    # grid repr
+    grid_repr = uxds.uxgrid.cross_section.__repr__()
+    assert "constant_latitude" in grid_repr
+    assert "constant_longitude" in grid_repr
+    assert "constant_latitude_interval" in grid_repr
+    assert "constant_longitude_interval" in grid_repr
+
+    # data array repr
+    da_repr = uxds['t2m'].cross_section.__repr__()
+    assert "constant_latitude" in da_repr
+    assert "constant_longitude" in da_repr
+    assert "constant_latitude_interval" in da_repr
+    assert "constant_longitude_interval" in da_repr
+
+
+
 def test_constant_lat_cross_section_grid():
     uxgrid = ux.open_grid(quad_hex_grid_path)
 
@@ -120,6 +141,48 @@ def test_constant_lat_out_of_bounds():
     assert len(candidate_faces) == 0
 
 
+
+def test_const_lat_interval_da():
+    uxds = ux.open_dataset(quad_hex_grid_path, quad_hex_data_path)
+    uxds.uxgrid.normalize_cartesian_coordinates()
+
+    res = uxds['t2m'].cross_section.constant_latitude_interval(lats=(-10, 10))
+
+    assert len(res) == 4
+
+
+def test_const_lat_interval_grid():
+    uxgrid = ux.open_grid(quad_hex_grid_path)
+
+    res = uxgrid.cross_section.constant_latitude_interval(lats=(-10, 10))
+
+    assert res.n_face == 4
+
+    res, indices = uxgrid.cross_section.constant_latitude_interval(lats=(-10, 10), return_face_indices=True)
+
+    assert len(indices) == 4
+
+def test_const_lon_interva_da():
+    uxds = ux.open_dataset(quad_hex_grid_path, quad_hex_data_path)
+    uxds.uxgrid.normalize_cartesian_coordinates()
+
+    res = uxds['t2m'].cross_section.constant_longitude_interval(lons=(-10, 10))
+
+    assert len(res) == 4
+
+
+def test_const_lon_interval_grid():
+    uxgrid = ux.open_grid(quad_hex_grid_path)
+
+    res = uxgrid.cross_section.constant_longitude_interval(lons=(-10, 10))
+
+    assert res.n_face == 4
+
+    res, indices = uxgrid.cross_section.constant_longitude_interval(lons=(-10, 10), return_face_indices=True)
+
+    assert len(indices) == 4
+
+
 class TestArcs:
     def test_latitude_along_arc(self):
         node_lon = np.array([-40, -40, 40, 40])
diff --git a/test/test_subset.py b/test/test_subset.py
index 71be6dff..26bc79b5 100644
--- a/test/test_subset.py
+++ b/test/test_subset.py
@@ -19,6 +19,24 @@ DATA_PATHS = [
     current_path / "meshfiles" / "ugrid" / "outCSne30" / "var2.nc"
 ]
 
+quad_hex_grid_path = current_path / 'meshfiles' / "ugrid" / "quad-hexagon" / 'grid.nc'
+quad_hex_data_path = current_path / 'meshfiles' / "ugrid" / "quad-hexagon" / 'data.nc'
+
+def test_repr():
+    uxds = ux.open_dataset(quad_hex_grid_path, quad_hex_data_path)
+
+    # grid repr
+    grid_repr = uxds.uxgrid.subset.__repr__()
+    assert "bounding_box" in grid_repr
+    assert "bounding_circle" in grid_repr
+    assert "nearest_neighbor" in grid_repr
+
+    # data array repr
+    da_repr = uxds['t2m'].subset.__repr__()
+    assert "bounding_box" in da_repr
+    assert "bounding_circle" in da_repr
+    assert "nearest_neighbor" in da_repr
+
 
 def test_grid_face_isel():
     for grid_path in GRID_PATHS:
@@ -155,3 +173,13 @@ def test_inverse_indices():
     # Test isel directly
     subset = grid.isel(n_face=[1], inverse_indices=True)
     assert subset.inverse_indices.face.values == 1
+
+
+def test_da_subset():
+    uxds = ux.open_dataset(quad_hex_grid_path, quad_hex_data_path)
+
+    res1 = uxds['t2m'].subset.bounding_box(lon_bounds=(-10, 10), lat_bounds=(-10, 10))
+    res2 = uxds['t2m'].subset.bounding_circle(center_coord=(0,0), r=10)
+    res3 = uxds['t2m'].subset.nearest_neighbor(center_coord=(0, 0), k=4)
+
+    assert len(res1) == len(res2) == len(res3) == 4