Skip to content

Commit

Permalink
New naming convention, fixed spelling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronzedwick committed Jan 8, 2025
1 parent 1e52e02 commit 129f9c5
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion test/test_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_inverse_indices():

# Ensure code raises exceptions when the element is edges or nodes
assert pytest.raises(Exception, grid.subset.bounding_circle, center_coord, r=10, element="edge centers", inverse_indices=True)
assert pytest.raises(Exception, grid.subset.bounding_circle, center_coord, r=10, element="node centers", inverse_indices=True)
assert pytest.raises(Exception, grid.subset.bounding_circle, center_coord, r=10, element="nodes", inverse_indices=True)

# Test isel directly
subset = grid.isel(n_face=[1], inverse_indices=True)
Expand Down
4 changes: 2 additions & 2 deletions uxarray/cross_sections/dataarray_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def constant_latitude(
Must be between -90.0 and 90.0
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
Returns
-------
Expand Down Expand Up @@ -80,7 +80,7 @@ def constant_longitude(
Must be between -180.0 and 180.0
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions uxarray/cross_sections/grid_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def constant_latitude(
If True, also returns the indices of the faces that intersect with the line of constant latitude.
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
Returns
-------
Expand Down Expand Up @@ -97,7 +97,7 @@ def constant_longitude(
If True, also returns the indices of the faces that intersect with the line of constant longitude.
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
Returns
-------
Expand Down
10 changes: 5 additions & 5 deletions uxarray/grid/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class Grid:
is_subset : bool, default=False
Flag to mark if the grid is a subset or not
inverse_indices: xr.Dataset, defaul=None
inverse_indices: xr.Dataset, default=None
A dataset of indices that correspond to the original grid, if the grid being constructed is a subset
Examples
Expand All @@ -168,7 +168,7 @@ def __init__(
grid_ds: xr.Dataset,
source_grid_spec: Optional[str] = None,
source_dims_dict: Optional[dict] = {},
is_subset=False,
is_subset: bool = False,
inverse_indices: Optional[xr.Dataset] = None,
):
# check if inputted dataset is a minimum representable 2D UGRID unstructured grid
Expand Down Expand Up @@ -1529,7 +1529,7 @@ def global_sphere_coverage(self):
return not self.partial_sphere_coverage

@property
def inverse_indices(self):
def inverse_indices(self) -> xr.Dataset:
"""Indices for a subset that map each face in the subset back to the original grid"""
if self.is_subset:
return self._inverse_indices
Expand Down Expand Up @@ -2246,8 +2246,8 @@ def isel(
Parameters
inverse_indices : Union[List[str], Set[str], bool], default=False
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
Indicates whether to store the original grids indices. Passing `True` stores the original face indices,
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
**dims_kwargs: kwargs
Dimension to index, one of ['n_node', 'n_edge', 'n_face']
Expand Down
10 changes: 5 additions & 5 deletions uxarray/grid/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _slice_face_indices(
to exclusive (i.e elements be made up all desired features from a slice)
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
"""
if inclusive is False:
raise ValueError("Exclusive slicing is not yet supported.")
Expand Down Expand Up @@ -151,12 +151,12 @@ def _slice_face_indices(
inverse_indices_ds = xr.Dataset()

index_types = {
"face centers": face_indices,
"edge centers": edge_indices,
"nodes": node_indices,
"face": face_indices,
"edge": edge_indices,
"node": node_indices,
}
if isinstance(inverse_indices, bool):
inverse_indices_ds["face centers"] = face_indices
inverse_indices_ds["face"] = face_indices
else:
for index_type in inverse_indices[0]:
if index_type in index_types:
Expand Down
6 changes: 3 additions & 3 deletions uxarray/subset/dataarray_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def bounding_box(
Element for use with `coords` comparison, one of `nodes`, `face centers`, or `edge centers`
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
"""
grid = self.uxda.uxgrid.subset.bounding_box(
lon_bounds, lat_bounds, element, method, inverse_indices=inverse_indices
Expand Down Expand Up @@ -85,7 +85,7 @@ def bounding_circle(
Element for use with `coords` comparison, one of `nodes`, `face centers`, or `edge centers`
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
"""
grid = self.uxda.uxgrid.subset.bounding_circle(
center_coord, r, element, inverse_indices=inverse_indices, **kwargs
Expand Down Expand Up @@ -113,7 +113,7 @@ def nearest_neighbor(
Element for use with `coords` comparison, one of `nodes`, `face centers`, or `edge centers`
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
"""

grid = self.uxda.uxgrid.subset.nearest_neighbor(
Expand Down
6 changes: 3 additions & 3 deletions uxarray/subset/grid_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def bounding_box(
Element for use with `coords` comparison, one of `nodes`, `face centers`, or `edge centers`
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
"""

if method == "coords":
Expand Down Expand Up @@ -135,7 +135,7 @@ def bounding_circle(
Element for use with `coords` comparison, one of `nodes`, `face centers`, or `edge centers`
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
"""

coords = np.asarray(center_coord)
Expand Down Expand Up @@ -172,7 +172,7 @@ def nearest_neighbor(
Element for use with `coords` comparison, one of `nodes`, `face centers`, or `edge centers`
inverse_indices : Union[List[str], Set[str], bool], optional
Indicates whether to store the original grids indices. Passing `True` stores the original face centers,
other reverse indices can be stored by passing any or all of the following: (["face centers", "edge centers", "nodes"], True)
other reverse indices can be stored by passing any or all of the following: (["face", "edge", "node"], True)
"""

coords = np.asarray(center_coord)
Expand Down

0 comments on commit 129f9c5

Please sign in to comment.