1717# Import the utility function for opening datasets with fallback
1818from uxarray .core .utils import _open_dataset_with_fallback
1919from uxarray .cross_sections import GridCrossSectionAccessor
20- from uxarray .errors import DataCenteringError , GridInvalidError
20+ from uxarray .errors import DataCenteringError , DimensionError , GridInvalidError
2121from uxarray .formatting_html import grid_repr
2222from uxarray .grid .area import _get_all_face_area_from_coords
2323from uxarray .grid .bounds import _populate_face_bounds
@@ -569,7 +569,7 @@ def from_face_vertices(
569569 Indicates whether the inputted vertices are in lat/lon, with units in degrees
570570 """
571571 if not isinstance (face_vertices , (list , tuple , np .ndarray )):
572- raise ValueError ("Input must be either a list, tuple, or np.ndarray" )
572+ raise TypeError ("Input must be either a list, tuple, or np.ndarray" )
573573
574574 face_vertices = np .asarray (face_vertices )
575575
@@ -580,7 +580,7 @@ def from_face_vertices(
580580 grid_ds = _read_face_vertices (np .array ([face_vertices ]), latlon )
581581
582582 else :
583- raise RuntimeError (
583+ raise DimensionError (
584584 f"Invalid Input Dimension: { face_vertices .ndim } . Expected dimension should be "
585585 f"3: [n_face, n_node, two/three] or 2 when only "
586586 f"one face is passed in."
@@ -633,7 +633,7 @@ def validate(self, check_duplicates=True):
633633 print ("Mesh validation successful." )
634634 return True
635635 else :
636- raise RuntimeError ("Mesh validation failed." )
636+ raise GridInvalidError ("Mesh validation failed." )
637637
638638 def construct_face_centers (self , method = "cartesian average" ):
639639 """Constructs face centers, this method provides users direct control
@@ -1612,7 +1612,7 @@ def boundary_node_indices(self):
16121612 """Indices of nodes that border regions not covered by any geometry
16131613 (holes) in a partial grid."""
16141614 if "boundary_node_indices" not in self ._ds :
1615- raise ValueError
1615+ raise NotImplementedError
16161616
16171617 return self ._ds ["boundary_node_indices" ]
16181618
@@ -1663,7 +1663,7 @@ def inverse_indices(self) -> xr.Dataset:
16631663 if self .is_subset :
16641664 return self ._inverse_indices
16651665 else :
1666- raise Exception (
1666+ raise AttributeError (
16671667 "Grid is not a subset, therefore no inverse face indices exist"
16681668 )
16691669
@@ -2534,7 +2534,7 @@ def get_dual(self, check_duplicate_nodes: bool = False):
25342534 if check_duplicate_nodes :
25352535 if _check_duplicate_nodes_indices (self ):
25362536 # TODO: This is very slow
2537- raise RuntimeError ("Duplicate nodes found, cannot construct dual" )
2537+ raise GridInvalidError ("Duplicate nodes found, cannot construct dual" )
25382538
25392539 # Get dual mesh node face connectivity
25402540 dual_node_face_conn = construct_dual (grid = self )
0 commit comments