Skip to content

Commit

Permalink
Fix DeprecationWarning and FutureWarning found in test suite (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder authored Jan 22, 2025
1 parent c93b5bf commit 71f1c91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def generate_multiple_variable_dataset(
var_names = list(["ts"])

if separate_dims:
var_names += list(ds_base.dims.keys()) # type: ignore[arg-type]
var_names += list(ds_base.sizes.keys()) # type: ignore[arg-type]

ds_copy = ds_copy.rename({x: f"{x}{idx+1}" for x in var_names})

Expand Down
6 changes: 3 additions & 3 deletions tests/test_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def test_output_bounds_missing_temporal(self):
decode_times=True, cf_compliant=False, has_bounds=True
)

ds = self.coarse_3d_ds.drop("time_bnds")
ds = self.coarse_3d_ds.drop_vars("time_bnds")

output_grid = grid.create_gaussian_grid(32)

Expand Down Expand Up @@ -517,7 +517,7 @@ def test_unknown_variable(self):
with pytest.raises(KeyError):
regridder.horizontal("unknown", self.coarse_2d_ds)

@pytest.mark.filterwarnings("ignore:.*invalid value.*true_divide.*:RuntimeWarning")
@pytest.mark.filterwarnings("ignore:.*invalid value.*divide.*:RuntimeWarning")
def test_regrid_input_mask(self):
regridder = regrid2.Regrid2Regridder(self.coarse_2d_ds, self.fine_2d_ds)

Expand All @@ -540,7 +540,7 @@ def test_regrid_input_mask(self):

assert np.all(output_data.ts.values == expected_output)

@pytest.mark.filterwarnings("ignore:.*invalid value.*true_divide.*:RuntimeWarning")
@pytest.mark.filterwarnings("ignore:.*invalid value.*divide.*:RuntimeWarning")
def test_regrid_input_mask_unmapped_to_nan(self):
regridder = regrid2.Regrid2Regridder(
self.coarse_2d_ds, self.fine_2d_ds, unmapped_to_nan=False
Expand Down
2 changes: 1 addition & 1 deletion xcdat/regridder/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def _create_gaussian_axis(nlats: int) -> Tuple[xr.DataArray, xr.DataArray]:
},
)

bounds = (180.0 / np.pi) * np.arcsin(bounds)
bounds = (180.0 / np.pi) * np.arcsin(bounds) # type: ignore

bounds_data = np.zeros((points.shape[0], 2))
bounds_data[:, 0] = bounds[:-1]
Expand Down

0 comments on commit 71f1c91

Please sign in to comment.