Skip to content

Commit 2bb056b

Browse files
committed
deprecate argument xy_var_names
1 parent 4ae4d7f commit 2bb056b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

xcube/core/gridmapping/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ def from_dataset(cls,
648648
:param crs: Optional spatial coordinate reference system.
649649
:param xy_var_names: Optional tuple of the x- and
650650
y-coordinate variables in *dataset*.
651+
Deprecated since xcube 0.10.1.
651652
:param tile_size: Optional tile size
652653
:param prefer_is_regular: Whether to prefer a regular
653654
grid mapping if multiple found. Default is True.

xcube/core/gridmapping/dataset.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# SOFTWARE.
2121

2222
from typing import Optional, Union, Tuple
23+
import warnings
2324

2425
import pyproj
2526
import xarray as xr
@@ -53,13 +54,10 @@ def new_grid_mapping_from_dataset(
5354
prefer_crs = _normalize_crs(prefer_crs)
5455
else:
5556
prefer_crs = crs
56-
if xy_var_names is not None:
57-
x_var_name, y_var_name = xy_var_names
58-
if x_var_name not in dataset or y_var_name not in dataset:
59-
raise ValueError(f'coordinate variables "{x_var_name}" '
60-
f'or "{y_var_name}" not found in dataset')
61-
# TODO: create new instance using named coordinate variables
62-
raise NotImplementedError('xy_var_names not yet supported')
57+
if xy_var_names:
58+
warnings.warn('Argument "xy_var_names" is deprecated since '
59+
'xcube 0.10.1 and will be ignored.',
60+
category=DeprecationWarning)
6361

6462
grid_mapping_proxies = get_dataset_grid_mapping_proxies(
6563
dataset,

0 commit comments

Comments
 (0)