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

Fix failing ASV benchmarks #1118

Merged
merged 6 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions benchmarks/mpas_ocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions uxarray/cross_sections/dataarray_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down Expand Up @@ -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
-----
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 @@ -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
-----
Expand Down Expand Up @@ -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
-----
Expand Down
Loading