@@ -55,18 +55,19 @@ def test_grid_init_param_types(ds):
5555
5656@pytest .mark .parametrize ("ds, attr, expected" , test_cases )
5757def test_xgrid_properties_ground_truth (ds , attr , expected ):
58- grid = XGrid .from_dataset (ds )
58+ grid = XGrid .from_dataset (ds , mesh = "flat" )
5959 actual = getattr (grid , attr )
6060 assert_equal (actual , expected )
6161
6262
6363@pytest .mark .parametrize ("ds" , [pytest .param (ds , id = key ) for key , ds in datasets .items ()])
6464def test_xgrid_from_dataset_on_generic_datasets (ds ):
65- XGrid .from_dataset (ds )
65+ XGrid .from_dataset (ds , mesh = "flat" )
6666
6767
68+ @pytest .mark .parametrize ("ds" , [datasets ["ds_2d_left" ]])
6869def test_xgrid_axes (ds ):
69- grid = XGrid .from_dataset (ds )
70+ grid = XGrid .from_dataset (ds , mesh = "flat" )
7071 assert grid .axes == ["Z" , "Y" , "X" ]
7172
7273
@@ -80,7 +81,7 @@ def test_uxgrid_mesh(ds, mesh):
8081@pytest .mark .parametrize ("ds" , [datasets ["ds_2d_left" ]])
8182def test_transpose_xfield_data_to_tzyx (ds ):
8283 da = ds ["data_g" ]
83- grid = XGrid .from_dataset (ds )
84+ grid = XGrid .from_dataset (ds , mesh = "flat" )
8485
8586 all_combinations = (itertools .combinations (da .dims , n ) for n in range (len (da .dims )))
8687 all_combinations = itertools .chain (* all_combinations )
@@ -93,7 +94,7 @@ def test_transpose_xfield_data_to_tzyx(ds):
9394
9495@pytest .mark .parametrize ("ds" , [datasets ["ds_2d_left" ]])
9596def test_xgrid_get_axis_dim (ds ):
96- grid = XGrid .from_dataset (ds )
97+ grid = XGrid .from_dataset (ds , mesh = "flat" )
9798 assert grid .get_axis_dim ("Z" ) == Z - 1
9899 assert grid .get_axis_dim ("Y" ) == Y - 1
99100 assert grid .get_axis_dim ("X" ) == X - 1
@@ -113,15 +114,15 @@ def test_invalid_lon_lat():
113114 ValueError ,
114115 match = ".*is defined on the center of the grid, but must be defined on the F points\." ,
115116 ):
116- XGrid .from_dataset (ds )
117+ XGrid .from_dataset (ds , mesh = "flat" )
117118
118119 ds = datasets ["ds_2d_left" ].copy ()
119120 ds ["lon" ], _ = xr .broadcast (ds ["YG" ], ds ["XG" ])
120121 with pytest .raises (
121122 ValueError ,
122123 match = ".*have different dimensionalities\." ,
123124 ):
124- XGrid .from_dataset (ds )
125+ XGrid .from_dataset (ds , mesh = "flat" )
125126
126127 ds = datasets ["ds_2d_left" ].copy ()
127128 ds ["lon" ], ds ["lat" ] = xr .broadcast (ds ["YG" ], ds ["XG" ])
@@ -131,20 +132,20 @@ def test_invalid_lon_lat():
131132 ValueError ,
132133 match = ".*must be defined on the X and Y axes and transposed to have dimensions in order of Y, X\." ,
133134 ):
134- XGrid .from_dataset (ds )
135+ XGrid .from_dataset (ds , mesh = "flat" )
135136
136137
137138def test_invalid_depth ():
138139 ds = datasets ["ds_2d_left" ].copy ()
139140 ds = ds .reindex ({"ZG" : ds .ZG [::- 1 ]})
140141
141142 with pytest .raises (ValueError , match = "Depth DataArray .* must be strictly increasing*" ):
142- XGrid .from_dataset (ds )
143+ XGrid .from_dataset (ds , mesh = "flat" )
143144
144145
145146def test_dim_without_axis ():
146147 ds = xr .Dataset ({"z1d" : (["depth" ], [0 ])}, coords = {"depth" : [0 ]})
147- grid = XGrid .from_dataset (ds )
148+ grid = XGrid .from_dataset (ds , mesh = "flat" )
148149 with pytest .raises (ValueError , match = 'Dimension "depth" has no axis attribute*' ):
149150 Field ("z1d" , ds ["z1d" ], grid , XLinear )
150151
@@ -155,7 +156,7 @@ def test_vertical1D_field():
155156 {"z1d" : (["depth" ], np .linspace (0 , 10 , nz ))},
156157 coords = {"depth" : (["depth" ], np .linspace (0 , 1 , nz ), {"axis" : "Z" })},
157158 )
158- grid = XGrid .from_dataset (ds )
159+ grid = XGrid .from_dataset (ds , mesh = "flat" )
159160 field = Field ("z1d" , ds ["z1d" ], grid , XLinear )
160161
161162 assert field .eval (np .timedelta64 (0 , "s" ), 0.45 , 0 , 0 ) == 4.5
@@ -167,7 +168,7 @@ def test_time1D_field():
167168 {"t1d" : (["time" ], np .arange (0 , len (timerange )))},
168169 coords = {"time" : (["time" ], timerange , {"axis" : "T" })},
169170 )
170- grid = XGrid .from_dataset (ds )
171+ grid = XGrid .from_dataset (ds , mesh = "flat" )
171172 field = Field ("t1d" , ds ["t1d" ], grid , XLinear )
172173
173174 assert field .eval (np .datetime64 ("2000-01-10T12:00:00" ), - 20 , 5 , 6 ) == 9.5
@@ -181,7 +182,7 @@ def test_time1D_field():
181182 ],
182183) # for key, ds in datasets.items()])
183184def test_xgrid_search_cpoints (ds ):
184- grid = XGrid .from_dataset (ds )
185+ grid = XGrid .from_dataset (ds , mesh = "flat" )
185186 lat_array , lon_array = get_2d_fpoint_mesh (grid )
186187 lat_array , lon_array = corner_to_cell_center_points (lat_array , lon_array )
187188
@@ -299,7 +300,7 @@ def test_search_1d_array_some_out_of_bounds(array, x, expected_xi):
299300)
300301def test_xgrid_localize_zero_position (ds , da_name , expected ):
301302 """Test localize function using left and right datasets."""
302- grid = XGrid .from_dataset (ds )
303+ grid = XGrid .from_dataset (ds , mesh = "flat" )
303304 da = ds [da_name ]
304305 position = grid .search (0 , 0 , 0 )
305306
0 commit comments