Skip to content

Commit dca56ac

Browse files
aaronzedwickphilipc2rajeejaCopilot
authored
Bilinear Remapping (#1016)
* Updated API added comprehensive test * Fixed pre-commit * optimize code * update dual mesh construction and duplicate node validation * progress on migrating implementation to Grid * Testing Notebook * Update Untitled.ipynb * Updated Notebook * Update dual-mesh.ipynb * Update Notebook * Update docs * Update dual-mesh.ipynb * Updated Merge Duplicate Nodes and cleaned up code * Added Duplicate Nodes Test * Duplicate nodes error, updated index, fix codecov, * Fixed pre-commit * fixed duplicate check * Moved to dual.py remove duplication merge * Updated API and Benchmarks * Updated face construction and ordering * Optimization and clean up * Update dual-mesh.ipynb * Updated userguide.rst * Fixed pre-commit * Update docs/userguide.rst Co-authored-by: Philip Chmielowiec <[email protected]> * Added docstrings * Update dual.py * Added dual mesh support of DataArrays * Fixed asv config file * Added name to data array * Fixed constructed node face connectivity error * Updated user guide * Fixed docs * Removed method parameter * Added support for UxDatasets * Update dual user guide * Update index.rst * Updated Test Cases * Update test_grid.py * Updated colormaps * pre-commit fix * Notebook Update * Update dual-mesh.ipynb * Update dual-mesh.ipynb * Fixed Dimension Bug * Added bilinear.py * Fixed pre-commit * Added bilinear weights function * Working on fixing errors * Fixed bilinear weights calculation error * Pre-commit run * Added cartesian support and node edge support * Update bilinear.py * Testing Notebook * initial code for finding polygon containing point * Added `get_max_face_radius` * Updated tolerance * Updated support for mesh with holes and spherical coords * pre-commit * Initial point in triangle * Fixed merge issues * Remove leftover checkpoint * Updated test cases * Fixed notebook, added numba speedup * Update remapping.ipynb * Initial work * Testing point in polygon * Switched to projection method * Updated test cases, fixed spherical bug * Added test cases * Increased performance * Update test_geometry.py * updated api * Update bilinear.py * Updating search * Update geometry.py * Updated detection method * Fixed bilinear calculation * Implemented new ray casting method * Added edge case checks * Added node crossing and point on edge checks * Delete leftover file * Added docstrings, test case * Update test_geometry.py * Fixed point conversion bug * Update geometry.py * Converted functions to numba, updated tests accordingly * Added max face radius function * Added baseplate code for polygon containing code * Added reference point setter * Updated to use constructed edges * Debugging * Updated polygon search handling * Added support for non triangular dual mesh faces * Added unique face test cases * Fixed test cases, changed to `point_in_face` * Convert face containing point to use updated function * Added inverse indices, complete get_faces_containing_point * Update bilinear.py * Updated to use inverse face indices * Fixed failing tests * Moved function location * Fixed circular import * Update grid.py * updated comment * updated max_face_radius to handle variable face sizes * updated haversine and added test * Added benchmark, made max_face_radius attribute for better performance * Fixed benchmark * added property, update benchmark * updated benchmark * CI debugging * Fixed indexing problem * Update bilinear.py * added normalize to ensure consistency * Added test, fixed errors * Add spherical support for `faces_containing_point`, added docs, api, tests * Fixed test cases * Fixed test attempt #2 * Fixed error with improper coordinates * Updated method of subsetting and test case * pre-commit * fixed tests * Update test_grid.py * Added notebook * Update point_in_face.ipynb * Merge fixes * Fixed merging issues * Remove parameter coord_type * Integrated weighting functions, fixed bugs * testing and bug fixes * Added tests, bug fixes, deprecated destination_obj * Updated docs and api * added cartesian barycentric coordinate function * Update geometry.py * fixed user guide * Fixed failing tests * Updated weights function to use numba and be more efficient * Updated weights to calculate properly * Pre-commit * o Add TOC for notebook * o Add defaults for inverse distance * Fixed bilinear to catch values outside dual mesh * Fixed pre-commit * Fixed notebook * o Add healpix bilinear remapping * o Fix pre-commit * o Better doc * updated method for finding barycentric weights * updated weights to use spherical unless colinear * Redesigned weights calculation algorithm * Update uxarray/remap/bilinear.py Co-authored-by: Copilot <[email protected]> * Changed remapping structure to match new refactor * Fixed test cases, updated notebook * Added test to cover quadrilateral weight calculation * use updated point in face * use latest point in face * numba newton quad * updated weights function to use numba * pre-commit * Changed weights function to use dual properties more effectively * Changed barycentric weights function to use numba for all calculations * Update bilinear.py * pre-commit * small optimization in get_dual * remove a print * update notebook content * update notebook --------- Co-authored-by: Philip Chmielowiec <[email protected]> Co-authored-by: Philip Chmielowiec <[email protected]> Co-authored-by: Rajeev Jain <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 6d5bd3e commit dca56ac

File tree

10 files changed

+792
-64
lines changed

10 files changed

+792
-64
lines changed

benchmarks/mpas_ocean.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ def time_nearest_neighbor_remapping(self):
120120
def time_inverse_distance_weighted_remapping(self):
121121
self.uxds_120["bottomDepth"].remap.inverse_distance_weighted(self.uxds_480.uxgrid)
122122

123+
def time_bilinear_remapping(self):
124+
self.uxds_120["bottomDepth"].remap.bilinear(self.uxds_480.uxgrid)
123125

124126
class RemapUpsample:
125127

@@ -136,6 +138,9 @@ def time_nearest_neighbor_remapping(self):
136138
def time_inverse_distance_weighted_remapping(self):
137139
self.uxds_480["bottomDepth"].remap.inverse_distance_weighted(self.uxds_120.uxgrid)
138140

141+
def time_bilinear_remapping(self):
142+
self.uxds_480["bottomDepth"].remap.bilinear(self.uxds_120.uxgrid)
143+
139144

140145
class HoleEdgeIndices(DatasetBenchmark):
141146
def time_construct_hole_edge_indices(self, resolution):

docs/api.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ UxDataArray
369369
UxDataArray.remap
370370
UxDataArray.remap.nearest_neighbor
371371
UxDataArray.remap.inverse_distance_weighted
372+
UxDataArray.remap.bilinear
372373

373374
UxDataset
374375
~~~~~~~~~
@@ -380,7 +381,7 @@ UxDataset
380381
UxDataset.remap
381382
UxDataset.remap.nearest_neighbor
382383
UxDataset.remap.inverse_distance_weighted
383-
384+
UxDataset.remap.bilinear
384385

385386
Mathematical Operators
386387
----------------------

0 commit comments

Comments
 (0)