Skip to content

Improve error messages in uxarray/grid - #1705

Open
Sevans711 wants to merge 2 commits into
mainfrom
sevans/error-messages-grid
Open

Improve error messages in uxarray/grid#1705
Sevans711 wants to merge 2 commits into
mainfrom
sevans/error-messages-grid

Conversation

@Sevans711

Copy link
Copy Markdown
Collaborator

Closes #1704 (sub-issue of #1617)

Overview

Makes error messages clearer and more informative throughout uxarray/grid. As suggested by #1617 this is attempting to be an exhaustive fix for all desired error message improvements in uxarray/grid, while touching nothing outside of uxarray/grid. (Clarifying, this is for all files in uxarray/grid, not just files inside uxarray/grid/grid.)

Small expansion of scope: fixes confusing/misleading error types in a few places:

  1. Exception → AssertionError in insert_pt_in_latlonbox: "Logic error in longitude box width calculation". (Missed this while fixing Update uxarray error types for cases with misleading/confusing types #1622, which did mention this case but it actually appeared twice and the fix missed the second occurrence.)
  2. DataCenteringError → NotImplementedError in Grid.isel() messages like "Inverse indices are not yet supported for node selection, please use face centers". DataCenteringError was also misleading because these errors depended only on input kwargs, not the actual location of any data.
  3. ValueError → NotImplementedError in _slice_face_indices: "Exclusive slicing is not yet supported." (Missed this while fixing Update uxarray error types for cases with misleading/confusing types #1622 despite it being noted there explicitly.)

Misc. small expansions of PR scope:

  • Removes warning message when initializing a Grid with source_grid_spec None. The message text and comments imply that the intent here was to warn whenever grid_ds is not a minimum representable UGRID dataset, whenever source_grid_spec is None. But, that case is already being handled by the _validate_minimum_ugrid check which was directly above it (which will crash when invalid). I suspect that for a while only the warning existed, and then whatever PR added the check forgot to also remove the warning.
  • Improves docstring of Grid.from_face_vertices to clarify expected shape and content of face_vertices, and the meaning of latlon=False.
  • Tiny efficiency improvement in _compute_face_areas_and_jacobian: actually utilize min_jacobian (computed as np.min(self._face_jacobian)), by checking min_jacobian < 0, instead of computing it then ignoring it to instead check np.any(self._face_jacobian < 0). Additionally, do not compute max_jacobian anymore; previously it was always being computed despite only being used if raising an error, and now it is no longer included in the error message at all.

Aside from these small expansions of scope there should be no functionality changes; the only differences in this PR are the changes to error message contents.

Benchmarks: running benchmarks to make sure there isn't any performance hit. (Highly unlikely, but could happen if errors are used as part of control flow in a hot loop and any objects now placed into error message strings take non-negligible time to convert to string.)

PR Checklist

General

  • An issue is created and linked
  • Added appropriate labels (if your uxarray repo permissions allow it)
  • Filled out Overview and Expected Usage (if applicable) sections

Testing & Benchmarking

  • [N/A] Adequate tests are created if there is new functionality
  • Tests are not too basic (such as simply calling a function and nothing else)
  • [N/A] Tests cover all major paths in your new functions
  • If this PR could affect performance, ran ASV benchmarks and confirmed they show expected behavior (add a new benchmark if necessary)

AI Disclosure

AI Usage: GitHub Copilot's inline code suggestions, some small chats with Claude

  • I take responsibility for all AI-generated content in my PR.
  • I have tested all AI-generated content in my PR.

(numba complains when trying to provide helpful info in error messages, such as including the value which was actually received. So, make those error messages worse, so that numba will be happy again. Left inline comments to help clarify this.)
@Sevans711 Sevans711 added documentation Improvements or additions to documentation improvement Improvements on existing features or infrastructure run-benchmark Run ASV benchmark workflow developer experience Makes the codebase easier to read, debug, maintain, or extend. design Design of an API, feature, or user interface (not just implementation details) labels Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

ASV Benchmarking

Benchmark Comparison Results

Benchmarks that have improved:

Change Before [644dd69] After [f7d25e9] Ratio Benchmark (Parameter)
- 653±20μs 580±6μs 0.89 mpas_ocean.Integrate.time_integrate('120km')

Benchmarks that have stayed the same:

Change Before [644dd69] After [f7d25e9] Ratio Benchmark (Parameter)
195±1ms 194±2ms 1.00 bench_connectivity.Connectivity.time_edge_face('120km')
12.2±0.1ms 12.0±0.1ms 0.98 bench_connectivity.Connectivity.time_edge_face('480km')
205±10ms 192±1ms 0.94 bench_connectivity.Connectivity.time_edge_node('120km')
11.1±0.2ms 11.0±0.03ms 0.98 bench_connectivity.Connectivity.time_edge_node('480km')
193±0.9ms 192±0.6ms 0.99 bench_connectivity.Connectivity.time_face_edge('120km')
12.1±0.5ms 11.3±0.1ms 0.93 bench_connectivity.Connectivity.time_face_edge('480km')
894±5ms 878±20ms 0.98 bench_connectivity.Connectivity.time_face_face('120km')
57.3±0.9ms 57.0±0.8ms 0.99 bench_connectivity.Connectivity.time_face_face('480km')
73.0±4μs 73.0±3μs 1.00 bench_connectivity.Connectivity.time_face_node('120km')
76.5±2μs 70.5±2μs 0.92 bench_connectivity.Connectivity.time_face_node('480km')
421±10μs 426±8μs 1.01 bench_connectivity.Connectivity.time_n_nodes_per_face('120km')
375±9μs 367±8μs 0.98 bench_connectivity.Connectivity.time_n_nodes_per_face('480km')
206±10ms 194±1ms 0.94 bench_connectivity.Connectivity.time_node_edge('120km')
12.0±0.5ms 11.3±0.09ms 0.94 bench_connectivity.Connectivity.time_node_edge('480km')
94.9±1ms 87.3±4ms 0.92 bench_connectivity.Connectivity.time_node_face('120km')
5.80±0.2ms 5.47±0.1ms 0.94 bench_connectivity.Connectivity.time_node_face('480km')
9.23±0.1ms 8.67±0.09ms 0.94 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
2.86±0.05ms 3.09±0.09ms 1.08 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
10.8±10s 10.3±10ms ~0.00 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
2.20±0.04ms 2.16±0.03ms 0.98 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
57.3k 57.3k 1.00 face_bounds.FaceBounds.track_nbytes_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
12.3k 12.3k 1.00 face_bounds.FaceBounds.track_nbytes_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
123k 123k 1.00 face_bounds.FaceBounds.track_nbytes_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
128 128 1.00 face_bounds.FaceBounds.track_nbytes_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
1.27M 1.27M 1.00 face_bounds.FaceBounds.track_nbytes_grid_with_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
50.1k 50.1k 1.00 face_bounds.FaceBounds.track_nbytes_grid_with_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
1.48M 1.48M 1.00 face_bounds.FaceBounds.track_nbytes_grid_with_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
712 712 1.00 face_bounds.FaceBounds.track_nbytes_grid_with_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
1.96M 2.04M 1.04 face_bounds.FaceBounds.track_peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
1.97M 2.04M 1.04 face_bounds.FaceBounds.track_peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
2.13M 2.21M 1.04 face_bounds.FaceBounds.track_peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
410M 410M 1.00 face_bounds.FaceBoundsColdStartRss.peakmem_open_and_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
441M 441M 1.00 face_bounds.FaceBoundsColdStartRss.peakmem_open_and_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
411M 411M 1.00 face_bounds.FaceBoundsColdStartRss.peakmem_open_and_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
410M 411M 1.00 face_bounds.FaceBoundsColdStartRss.peakmem_open_and_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
1.25±0.06μs 1.19±0.02μs 0.95 geometry_kernels.AccucrossKernels.time_accucross
2.77±0.04μs 2.76±0.03μs 0.99 geometry_kernels.AccucrossKernels.time_accucross_pair
416±40ns 476±20ns ~1.14 geometry_kernels.EFTPrimitives.time_acc_sqrt_re
406±10ns 436±20ns 1.07 geometry_kernels.EFTPrimitives.time_diff_of_products
425±30ns 396±9ns 0.93 geometry_kernels.EFTPrimitives.time_two_prod
376±20ns 381±5ns 1.01 geometry_kernels.EFTPrimitives.time_two_sum
1.55±0.02μs 1.51±0.02μs 0.98 geometry_kernels.GCAConstLatIntersection.time_accux_constlat_kernel
1.12±0.02μs 1.13±0.02μs 1.01 geometry_kernels.GCAConstLatIntersection.time_gca_const_lat_intersection
1.95±0.2μs 1.95±0.03μs 1.00 geometry_kernels.GCAConstLatIntersection.time_try_gca_const_lat_intersection
1.71±0.05μs 1.69±0.02μs 0.99 geometry_kernels.GCAGCAIntersection.time_accux_gca_kernel
1.43±0.02μs 1.40±0.02μs 0.98 geometry_kernels.GCAGCAIntersection.time_gca_gca_intersection
2.17±0.02μs 2.17±0.04μs 1.00 geometry_kernels.GCAGCAIntersection.time_try_gca_gca_intersection
52.8±0.7μs 52.1±0.5μs 0.99 geometry_kernels.OrientPredicates.time_on_minor_arc
1.19±0.03μs 1.14±0.04μs 0.96 geometry_kernels.OrientPredicates.time_orient3d_on_sphere
2.72±0.1ms 2.60±0.01ms 0.96 geometry_samebody.SameBodyConstLat.time_accux_dispatch
1.18±0.01ms 1.17±0ms 0.99 geometry_samebody.SameBodyConstLat.time_accux_kernel
1.73±0.01ms 1.72±0.02ms 1.00 geometry_samebody.SameBodyConstLat.time_fp64_dispatch
152±8μs 148±0.5μs 0.97 geometry_samebody.SameBodyConstLat.time_fp64_kernel
32.4±0.03ms 32.1±0.05ms 0.99 geometry_samebody_gcagca.SameBodyGcaGca.time_accux_dispatch
10.3±0.01ms 10.3±0.01ms 0.99 geometry_samebody_gcagca.SameBodyGcaGca.time_accux_kernel
26.6±0.04ms 26.4±0.03ms 0.99 geometry_samebody_gcagca.SameBodyGcaGca.time_fp64_dispatch
4.88±0.02ms 4.90±0.01ms 1.01 geometry_samebody_gcagca.SameBodyGcaGca.time_fp64_kernel
12.5±0.07s 12.4±0.3s 1.00 import.Imports.timeraw_import_uxarray
370M 367M 0.99 import.Imports.track_peakmem_import_uxarray
2.91±0.05ms 2.94±0.03ms 1.01 mpas_ocean.CheckNorm.time_check_norm('120km')
2.33±0.03ms 2.28±0.02ms 0.98 mpas_ocean.CheckNorm.time_check_norm('480km')
869±7ms 855±20ms 0.98 mpas_ocean.ConnectivityConstruction.time_face_face_connectivity('120km')
55.7±0.7ms 54.9±0.3ms 0.99 mpas_ocean.ConnectivityConstruction.time_face_face_connectivity('480km')
693±4μs 691±10μs 1.00 mpas_ocean.ConnectivityConstruction.time_n_nodes_per_face('120km')
604±10μs 605±10μs 1.00 mpas_ocean.ConnectivityConstruction.time_n_nodes_per_face('480km')
5.52±0.04ms 5.55±0.1ms 1.00 mpas_ocean.ConstructFaceLatLon.time_cartesian_averaging('120km')
4.12±0.05ms 4.02±0.04ms 0.98 mpas_ocean.ConstructFaceLatLon.time_cartesian_averaging('480km')
101±0.3ms 100±0.6ms 1.00 mpas_ocean.ConstructFaceLatLon.time_welzl('120km')
11.0±0.1ms 10.8±0.6ms 0.98 mpas_ocean.ConstructFaceLatLon.time_welzl('480km')
18.3±0.05ms 18.2±0.01ms 0.99 mpas_ocean.ConstructTreeStructures.time_ball_tree('120km')
1.11±0.03ms 1.05±0.01ms 0.95 mpas_ocean.ConstructTreeStructures.time_ball_tree('480km')
10.7±0.02ms 10.7±0.05ms 1.00 mpas_ocean.ConstructTreeStructures.time_kd_tree('120km')
784±10μs 768±8μs 0.98 mpas_ocean.ConstructTreeStructures.time_kd_tree('480km')
617±5ms 585±6ms 0.95 mpas_ocean.CrossSections.time_const_lat('120km', 1)
311±2ms 301±4ms 0.97 mpas_ocean.CrossSections.time_const_lat('120km', 2)
161±1ms 153±0.6ms 0.95 mpas_ocean.CrossSections.time_const_lat('120km', 4)
557±3ms 530±4ms 0.95 mpas_ocean.CrossSections.time_const_lat('480km', 1)
278±1ms 269±1ms 0.97 mpas_ocean.CrossSections.time_const_lat('480km', 2)
143±0.6ms 141±1ms 0.98 mpas_ocean.CrossSections.time_const_lat('480km', 4)
429M 430M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('120km', 1)
430M 430M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('120km', 2)
429M 430M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('120km', 4)
412M 413M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('480km', 1)
412M 413M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('480km', 2)
412M 413M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('480km', 4)
25.7±0.6ms 25.1±0.09ms 0.98 mpas_ocean.DualMesh.time_dual_mesh_construction('120km')
3.49±0.08ms 3.35±0.2ms 0.96 mpas_ocean.DualMesh.time_dual_mesh_construction('480km')
65.1±2ms 61.8±2ms 0.95 mpas_ocean.FaceAreas.time_face_areas('120km')
5.21±5s 7.78±5ms ~0.00 mpas_ocean.FaceAreas.time_face_areas('480km')
229k 229k 1.00 mpas_ocean.FaceAreas.track_nbytes_face_areas('120km')
14.3k 14.3k 1.00 mpas_ocean.FaceAreas.track_nbytes_face_areas('480km')
2.12M 2.12M 1.00 mpas_ocean.FaceAreas.track_peakmem_face_areas('120km')
817k 817k 1.00 mpas_ocean.FaceAreas.track_peakmem_face_areas('480km')
942±4ms 951±5ms 1.01 mpas_ocean.GeoDataFrame.time_to_geodataframe('120km', False)
54.2±1ms 53.0±0.4ms 0.98 mpas_ocean.GeoDataFrame.time_to_geodataframe('120km', True)
85.1±0.3ms 85.5±0.4ms 1.00 mpas_ocean.GeoDataFrame.time_to_geodataframe('480km', False)
6.03±0.04ms 5.84±0.2ms 0.97 mpas_ocean.GeoDataFrame.time_to_geodataframe('480km', True)
178±0.7ms 177±0.9ms 0.99 mpas_ocean.Gradient.time_gradient('120km')
12.9±0.08ms 12.9±0.1ms 1.00 mpas_ocean.Gradient.time_gradient('480km')
457k 457k 1.00 mpas_ocean.Gradient.track_nbytes_gradient('120km')
28.7k 28.7k 1.00 mpas_ocean.Gradient.track_nbytes_gradient('480km')
5.08M 5.08M 1.00 mpas_ocean.Gradient.track_peakmem_gradient('120km')
328k 328k 1.00 mpas_ocean.Gradient.track_peakmem_gradient('480km')
428M 424M 0.99 mpas_ocean.GradientColdStartRss.peakmem_gradient('120km')
403M 403M 1.00 mpas_ocean.GradientColdStartRss.peakmem_gradient('480km')
422±40μs 395±7μs 0.93 mpas_ocean.HoleEdgeIndices.time_construct_hole_edge_indices('120km')
232±9μs 215±7μs 0.93 mpas_ocean.HoleEdgeIndices.time_construct_hole_edge_indices('480km')
617±50μs 553±30μs ~0.90 mpas_ocean.Integrate.time_integrate('480km')
18.4M 18.4M 1.00 mpas_ocean.Integrate.track_nbytes_integrate('120km')
1.2M 1.2M 1.00 mpas_ocean.Integrate.track_nbytes_integrate('480km')
188±3ms 188±4ms 1.00 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'exclude')
186±1ms 185±1ms 1.00 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'include')
184±2ms 185±1ms 1.00 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'split')
14.2±0.3ms 13.9±0.1ms 0.98 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'exclude')
15.0±0.08ms 13.8±0.2ms 0.92 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'include')
14.5±0.06ms 14.1±0.1ms 0.97 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'split')
238±0.4ms 238±0.9ms 1.00 mpas_ocean.NeighborhoodBuild.time_build('120km', 1.0)
1.27±0s 1.27±0s 1.00 mpas_ocean.NeighborhoodBuild.time_build('120km', 15.0)
492±3ms 492±2ms 1.00 mpas_ocean.NeighborhoodBuild.time_build('120km', 5.0)
13.2±0.05ms 13.0±0.04ms 0.99 mpas_ocean.NeighborhoodBuild.time_build('480km', 1.0)
25.2±0.07ms 24.8±0.1ms 0.98 mpas_ocean.NeighborhoodBuild.time_build('480km', 15.0)
16.3±0.09ms 16.1±0.08ms 0.99 mpas_ocean.NeighborhoodBuild.time_build('480km', 5.0)
235±0.4ms 237±1ms 1.01 mpas_ocean.NeighborhoodBuild.time_query_radius('120km', 1.0)
1.26±0s 1.25±0s 0.99 mpas_ocean.NeighborhoodBuild.time_query_radius('120km', 15.0)
489±1ms 487±0.9ms 1.00 mpas_ocean.NeighborhoodBuild.time_query_radius('120km', 5.0)
12.6±0.04ms 12.6±0.1ms 1.00 mpas_ocean.NeighborhoodBuild.time_query_radius('480km', 1.0)
24.4±0.03ms 24.4±0.1ms 1.00 mpas_ocean.NeighborhoodBuild.time_query_radius('480km', 15.0)
15.9±0.07ms 15.7±0.03ms 0.99 mpas_ocean.NeighborhoodBuild.time_query_radius('480km', 5.0)
1.19 1.19 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('120km', 1.0)
612.76 612.76 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('120km', 15.0)
74.17 74.17 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('120km', 5.0)
1.0 1.0 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('480km', 1.0)
37.29 37.29 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('480km', 15.0)
6.57 6.57 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('480km', 5.0)
728k 728k 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('120km', 1.0)
141M 141M 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('120km', 15.0)
17.4M 17.4M 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('120km', 5.0)
43k 43k 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('480km', 1.0)
563k 563k 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('480km', 15.0)
123k 123k 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('480km', 5.0)
5.72M 5.72M 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('120km', 1.0)
145M 145M 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('120km', 15.0)
21.5M 21.5M 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('120km', 5.0)
362k 362k 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('480km', 1.0)
825k 825k 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('480km', 15.0)
384k 384k 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('480km', 5.0)
48.7±0.2ms 49.8±0.5ms 1.02 mpas_ocean.NeighborhoodDask.time_mean('120km', 'grid_chunks')
22.6±0.06ms 22.7±0.01ms 1.00 mpas_ocean.NeighborhoodDask.time_mean('120km', 'numpy')
45.1±0.9ms 45.4±0.9ms 1.01 mpas_ocean.NeighborhoodDask.time_mean('120km', 'time_chunks')
15.8±0.6ms 16.1±0.5ms 1.02 mpas_ocean.NeighborhoodDask.time_mean('480km', 'grid_chunks')
743±40μs 717±20μs 0.97 mpas_ocean.NeighborhoodDask.time_mean('480km', 'numpy')
12.4±0.1ms 12.1±0.5ms 0.98 mpas_ocean.NeighborhoodDask.time_mean('480km', 'time_chunks')
5.76M 5.83M 1.01 mpas_ocean.NeighborhoodDask.track_peakmem_mean('120km', 'grid_chunks')
2.75M 2.75M 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('120km', 'numpy')
5.69M 5.69M 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('120km', 'time_chunks')
675k 675k 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('480km', 'grid_chunks')
177k 177k 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('480km', 'numpy')
543k 544k 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('480km', 'time_chunks')
12.3±0s 12.5±0.05s 1.01 mpas_ocean.NeighborhoodReduce.time_dataset_reduce('120km', 'mean')
13.1±0.06s 13.2±0.06s 1.01 mpas_ocean.NeighborhoodReduce.time_dataset_reduce('120km', 'median')
228±0.3ms 227±0.4ms 1.00 mpas_ocean.NeighborhoodReduce.time_dataset_reduce('480km', 'mean')
234±0.4ms 234±0.8ms 1.00 mpas_ocean.NeighborhoodReduce.time_dataset_reduce('480km', 'median')
1.32±0.1s 1.32±0.01s 1.00 mpas_ocean.NeighborhoodReduce.time_neighborhood_reduce('120km', 'mean')
1.51±0.01s 1.50±0s 0.99 mpas_ocean.NeighborhoodReduce.time_neighborhood_reduce('120km', 'median')
25.7±0.1ms 26.2±0.2ms 1.02 mpas_ocean.NeighborhoodReduce.time_neighborhood_reduce('480km', 'mean')
27.2±0.1ms 27.0±0.2ms 0.99 mpas_ocean.NeighborhoodReduce.time_neighborhood_reduce('480km', 'median')
40.3±0.2ms 40.1±0.04ms 1.00 mpas_ocean.NeighborhoodReduce.time_reduce('120km', 'mean')
233±0.5ms 235±0.6ms 1.01 mpas_ocean.NeighborhoodReduce.time_reduce('120km', 'median')
708±50μs 736±10μs 1.04 mpas_ocean.NeighborhoodReduce.time_reduce('480km', 'mean')
2.14±0.03ms 2.14±0.04ms 1.00 mpas_ocean.NeighborhoodReduce.time_reduce('480km', 'median')
239k 239k 1.00 mpas_ocean.NeighborhoodReduce.track_peakmem_reduce('120km', 'mean')
245k 245k 1.00 mpas_ocean.NeighborhoodReduce.track_peakmem_reduce('120km', 'median')
19.7k 19.7k 1.00 mpas_ocean.NeighborhoodReduce.track_peakmem_reduce('480km', 'mean')
20.2k 20.2k 1.00 mpas_ocean.NeighborhoodReduce.track_peakmem_reduce('480km', 'median')
442±30μs 410±8μs 0.93 mpas_ocean.PointInPolygon.time_face_search_lonlat('120km')
410±10μs 384±10μs 0.94 mpas_ocean.PointInPolygon.time_face_search_lonlat('480km')
383±20μs 379±9μs 0.99 mpas_ocean.PointInPolygon.time_face_search_xyz('120km')
360±8μs 380±20μs 1.06 mpas_ocean.PointInPolygon.time_face_search_xyz('480km')
235±0.07ms 237±0.6ms 1.01 mpas_ocean.RemapDownsample.time_bilinear_remapping
291±4ms 291±3ms 1.00 mpas_ocean.RemapDownsample.time_inverse_distance_weighted_remapping
16.2±0.4ms 16.0±0.2ms 0.99 mpas_ocean.RemapDownsample.time_nearest_neighbor_remapping
1.38±0.01s 1.39±0.01s 1.00 mpas_ocean.RemapUpsample.time_bilinear_remapping
37.2±0.3ms 35.7±1ms 0.96 mpas_ocean.RemapUpsample.time_inverse_distance_weighted_remapping
12.8±0.3ms 12.5±0.5ms 0.98 mpas_ocean.RemapUpsample.time_nearest_neighbor_remapping
9.49±0.1ms 9.55±0.08ms 1.01 mpas_ocean.ZonalAverage.time_zonal_average('120km')
431M 431M 1.00 mpas_ocean.ZonalAveragePeakMem.peakmem_zonal_average('120km')
414M 414M 1.00 mpas_ocean.ZonalAveragePeakMem.peakmem_zonal_average('480km')
7.30±0.4ms 7.07±0.08ms 0.97 quad_hexagon.QuadHexagon.time_open_dataset
6.06±0.3ms 6.00±0.2ms 0.99 quad_hexagon.QuadHexagon.time_open_grid
408 408 1.00 quad_hexagon.QuadHexagon.track_nbytes_open_dataset
392 392 1.00 quad_hexagon.QuadHexagon.track_nbytes_open_grid
73.8k 73.8k 1.00 quad_hexagon.QuadHexagon.track_peakmem_open_dataset
72.8k 72.8k 1.00 quad_hexagon.QuadHexagon.track_peakmem_open_grid

Benchmarks that have got worse:

Change Before [644dd69] After [f7d25e9] Ratio Benchmark (Parameter)
+ 38.3k 52.4k 1.37 face_bounds.FaceBounds.track_peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
+ 4.83±0.04ms 5.32±0.1ms 1.1 mpas_ocean.ZonalAverage.time_zonal_average('480km')

@Sevans711 Sevans711 removed the run-benchmark Run ASV benchmark workflow label Aug 25, 2026
@Sevans711

Copy link
Copy Markdown
Collaborator Author

@cmdupuis3 Do you have any guesses about whether the increased peakmem values for face_bounds are likely to be real performance hits, or just an artifact of how the benchmarks were run? Similar question for the slowdown of mpas_ocean.ZonalAverage.time_zonal_average('480km').

I don't see any obvious routes in the codebase where these changes would have any significant impact on memory usage. (I would only really expect that to occur if the error message is being generated as part of the standard control flow, something like try: if_it_works_we_are_in_case_A(); except Exception: handle_case_B(), but it doesn't look like that is occurring here? It's hard to know for sure though, which is the main reason I ran benchmarks.)

Less relevant to this PR, but also, do you have any guesses about why the bot edited the message 5 times after posting it? (Is there any change it is related to the benchmarking suite taking roughly 6 times longer than it took a few weeks/days(?) ago?)

@cmdupuis3

Copy link
Copy Markdown
Collaborator

@Sevans711 I've been seeing some odd behaviors from the FaceBounds benchmarks lately. I'm rerunning it to see if we get the same 38k -> 50k behavior in a second round

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design Design of an API, feature, or user interface (not just implementation details) developer experience Makes the codebase easier to read, debug, maintain, or extend. documentation Improvements or additions to documentation improvement Improvements on existing features or infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error messages improvements in uxarray/grid

2 participants