diff --git a/benchmarks/mpas_ocean.py b/benchmarks/mpas_ocean.py index 53a67a1b6..ef2dc7692 100644 --- a/benchmarks/mpas_ocean.py +++ b/benchmarks/mpas_ocean.py @@ -138,7 +138,7 @@ def time_inverse_distance_weighted_remapping(self): class HoleEdgeIndices(DatasetBenchmark): def time_construct_hole_edge_indices(self, resolution): - ux.grid.geometry._construct_hole_edge_indices(self.uxds.uxgrid.edge_face_connectivity) + ux.grid.geometry._construct_boundary_edge_indices(self.uxds.uxgrid.edge_face_connectivity) class DualMesh(DatasetBenchmark): @@ -167,10 +167,19 @@ def time_check_norm(self, resolution): from uxarray.grid.validation import _check_normalization _check_normalization(self.uxgrid) +class CrossSection: + param_names = DatasetBenchmark.param_names + ['lat_step'] + params = DatasetBenchmark.params + [[1, 2, 4]] -class CrossSections(DatasetBenchmark): - param_names = DatasetBenchmark.param_names + ['n_lat'] - params = DatasetBenchmark.params + [[1, 2, 4, 8]] - def time_constant_lat_fast(self, resolution, n_lat): - for lat in np.linspace(-89, 89, n_lat): - self.uxds.uxgrid.constant_latitude_cross_section(lat, method='fast') + def setup(self, resolution, lat_step): + self.uxgrid = ux.open_grid(file_path_dict[resolution][0]) + self.uxgrid.normalize_cartesian_coordinates() + self.lats = np.arange(-45, 45, lat_step) + _ = self.uxgrid.bounds + + def teardown(self, resolution, lat_step): + del self.uxgrid + + def time_const_lat(self, resolution, lat_step): + for lat in self.lats: + self.uxgrid.cross_section.constant_latitude(lat) diff --git a/uxarray/cross_sections/dataarray_accessor.py b/uxarray/cross_sections/dataarray_accessor.py index d8c357e55..6f82a8f2e 100644 --- a/uxarray/cross_sections/dataarray_accessor.py +++ b/uxarray/cross_sections/dataarray_accessor.py @@ -46,7 +46,7 @@ def constant_latitude(self, lat: float): Examples -------- >>> # Extract data at 15.5°S latitude - >>> cross_section = uxda.constant_latitude(lat=-15.5) + >>> cross_section = uxda.cross_section.constant_latitude(lat=-15.5) Notes ----- @@ -86,7 +86,7 @@ def constant_longitude(self, lon: float): Examples -------- >>> # Extract data at 0° longitude - >>> cross_section = uxda.constant_latitude(lon=0.0) + >>> cross_section = uxda.cross_section.constant_latitude(lon=0.0) Notes ----- diff --git a/uxarray/cross_sections/grid_accessor.py b/uxarray/cross_sections/grid_accessor.py index 146da10af..ee30bd913 100644 --- a/uxarray/cross_sections/grid_accessor.py +++ b/uxarray/cross_sections/grid_accessor.py @@ -51,7 +51,7 @@ def constant_latitude( Examples -------- >>> # Extract data at 15.5°S latitude - >>> cross_section = grid.constant_latitude(lat=-15.5) + >>> cross_section = grid.cross_section.constant_latitude(lat=-15.5) Notes ----- @@ -103,7 +103,7 @@ def constant_longitude( Examples -------- >>> # Extract data at 0° longitude - >>> cross_section = grid.constant_latitude(lon=0.0) + >>> cross_section = grid.cross_section.constant_latitude(lon=0.0) Notes -----