Skip to content

Commit

Permalink
ASV Benchmarks for Remapping and Tree Construction (#870)
Browse files Browse the repository at this point in the history
* Added initial benchmarks

* Updated remapping benchmarks, up down sampling

---------

Co-authored-by: Philip Chmielowiec <[email protected]>
  • Loading branch information
aaronzedwick and philipc2 authored Jul 31, 2024
1 parent 4aee84b commit 7e68169
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions benchmarks/mpas_ocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,52 @@ def teardown(self, resolution, periodic_elements):

def time_dataarray_to_polycollection(self, resolution, periodic_elements):
self.uxds[data_var].to_polycollection()


class ConstructTreeStructures:
param_names = ['resolution']
params = ['480km', '120km']

def setup(self, resolution):
self.uxds = ux.open_dataset(file_path_dict[resolution][0], file_path_dict[resolution][1])

def teardown(self, resolution):
del self.uxds

def time_kd_tree(self, resolution):
self.uxds.uxgrid.get_kd_tree()

def time_ball_tree(self, resolution):
self.uxds.uxgrid.get_ball_tree()


class RemapDownsample:

def setup(self):
self.uxds_120 = ux.open_dataset(file_path_dict['120km'][0], file_path_dict['120km'][1])
self.uxds_480 = ux.open_dataset(file_path_dict['480km'][0], file_path_dict['480km'][1])

def teardown(self):
del self.uxds_120, self.uxds_480

def time_nearest_neighbor_remapping(self):
self.uxds_120["bottomDepth"].remap.nearest_neighbor(self.uxds_480.uxgrid)

def time_inverse_distance_weighted_remapping(self):
self.uxds_120["bottomDepth"].remap.inverse_distance_weighted(self.uxds_480.uxgrid)


class RemapUpsample:

def setup(self):
self.uxds_120 = ux.open_dataset(file_path_dict['120km'][0], file_path_dict['120km'][1])
self.uxds_480 = ux.open_dataset(file_path_dict['480km'][0], file_path_dict['480km'][1])

def teardown(self):
del self.uxds_120, self.uxds_480

def time_nearest_neighbor_remapping(self):
self.uxds_480["bottomDepth"].remap.nearest_neighbor(self.uxds_120.uxgrid)

def time_inverse_distance_weighted_remapping(self):
self.uxds_480["bottomDepth"].remap.inverse_distance_weighted(self.uxds_120.uxgrid)

0 comments on commit 7e68169

Please sign in to comment.