@@ -113,33 +113,39 @@ def test_raw_2d_interpolation(field, interpolator, t, z, y, x, expected):
113113 np .testing .assert_equal (value , expected )
114114
115115
116+ @pytest .mark .parametrize ("mesh" , ["flat" , "spherical" ])
116117@pytest .mark .parametrize (
117118 "func, t, z, y, x, expected" ,
118119 [
119- (XPartialslip (), 1 , 0 , 0 , 0.0 , [[1 ], [1 ]]),
120- (XFreeslip (), 1 , 0 , 0.5 , 1.5 , [[1 ], [0.5 ]]),
120+ (XPartialslip (), 1 , 0 , 0 , 0.0 , [[1.0 ], [1.0 ]]),
121+ (XFreeslip (), 1 , 0 , 0.5 , 1.5 , [[1.0 ], [0.5 ]]),
121122 (XPartialslip (), 1 , 0 , 2.5 , 1.5 , [[0.75 ], [0.5 ]]),
122- (XFreeslip (), 1 , 0 , 2.5 , 1.5 , [[1 ], [0.5 ]]),
123+ (XFreeslip (), 1 , 0 , 2.5 , 1.5 , [[1.0 ], [0.5 ]]),
123124 (XPartialslip (), 1 , 0 , 1.5 , 0.5 , [[0.5 ], [0.75 ]]),
124- (XFreeslip (), 1 , 0 , 1.5 , 0.5 , [[0.5 ], [1 ]]),
125+ (XFreeslip (), 1 , 0 , 1.5 , 0.5 , [[0.5 ], [1.0 ]]),
125126 (
126127 XFreeslip (),
127128 [1 , 0 ],
128129 [0 , 2 ],
129130 [1.5 , 1.5 ],
130131 [2.5 , 0.5 ],
131- [[0.5 , 0.5 ], [1 , 1 ]],
132+ [[0.5 , 0.5 ], [1.0 , 1.0 ]],
132133 ),
133134 ],
134135)
135- def test_spatial_slip_interpolation (field , func , t , z , y , x , expected ):
136+ def test_spatial_slip_interpolation (field , func , t , z , y , x , expected , mesh ):
137+ field .grid ._mesh = mesh
136138 field .data [:] = 1.0
137139 field .data [:, :, 1 :3 , 1 :3 ] = 0.0 # Set zero land value to test spatial slip
138140 U = field
139141 V = field
140142 UV = VectorField ("UV" , U , V , interp_method = func )
141143
142144 velocities = UV [t , z , y , x ]
145+ expected = np .array (expected )
146+ if mesh == "spherical" :
147+ expected [0 ] = expected [0 ] / (1852 * 60.0 * np .cos (np .radians (y )))
148+ expected [1 ] = expected [1 ] / (1852 * 60.0 )
143149 np .testing .assert_array_almost_equal (velocities , expected )
144150
145151
0 commit comments