Skip to content

Commit

Permalink
chore: add deprecation warning for verbose parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nicrie committed Aug 30, 2024
1 parent 280bd43 commit 87b23f9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
21 changes: 14 additions & 7 deletions xeofs/models/_base_cross_model.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
from typing import Tuple, Hashable, Sequence, Dict, Optional, Literal
from typing_extensions import Self
import warnings
from abc import ABC, abstractmethod
from datetime import datetime
from typing import Dict, Hashable, Literal, Optional, Sequence, Tuple

import dask
import xarray as xr
from dask.diagnostics.progress import ProgressBar
from typing_extensions import Self

try:
from xarray.core.datatree import DataTree
except ImportError:
from datatree import DataTree

from .eof import EOF
from ..preprocessing.preprocessor import Preprocessor
from .._version import __version__
from ..data_container import DataContainer
from ..utils.data_types import DataObject, DataArray
from ..preprocessing.preprocessor import Preprocessor
from ..utils.data_types import DataArray, DataObject
from ..utils.io import insert_placeholders, open_model_tree, write_model_tree
from ..utils.xarray_utils import convert_to_dim_type, data_is_dask
from ..utils.sanity_checks import validate_input_type
from .._version import __version__
from ..utils.xarray_utils import convert_to_dim_type, data_is_dask
from .eof import EOF


class _BaseCrossModel(ABC):
Expand Down Expand Up @@ -76,6 +77,12 @@ def __init__(
random_state=None,
solver_kwargs={},
):
if verbose:
warnings.warn(
"The 'verbose' parameter is deprecated and will be removed in a future release.",
category=DeprecationWarning,
stacklevel=3,
)
self.n_modes = n_modes
self.sample_name = sample_name
self.feature_name = feature_name
Expand Down
26 changes: 16 additions & 10 deletions xeofs/models/_base_model.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import warnings
from abc import ABC, abstractmethod
from datetime import datetime
from typing import (
Optional,
Sequence,
Hashable,
Dict,
Any,
Dict,
Hashable,
List,
Literal,
Optional,
Sequence,
)
from typing_extensions import Self
from abc import ABC, abstractmethod
from datetime import datetime

import dask
import xarray as xr
from dask.diagnostics.progress import ProgressBar
from typing_extensions import Self

try:
from xarray.core.datatree import DataTree
except ImportError:
from datatree import DataTree

from ..preprocessing.preprocessor import Preprocessor
from .._version import __version__
from ..data_container import DataContainer
from ..utils.data_types import DataObject, Data, DataArray
from ..preprocessing.preprocessor import Preprocessor
from ..utils.data_types import Data, DataArray, DataObject
from ..utils.io import insert_placeholders, open_model_tree, write_model_tree
from ..utils.sanity_checks import validate_input_type
from ..utils.xarray_utils import (
convert_to_dim_type,
data_is_dask,
)
from .._version import __version__

# Ignore warnings from numpy casting with additional coordinates
warnings.filterwarnings("ignore", message=r"^invalid value encountered in cast*")
Expand Down Expand Up @@ -93,6 +93,12 @@ def __init__(
solver="auto",
solver_kwargs={},
):
if verbose:
warnings.warn(
"The 'verbose' parameter is deprecated and will be removed in a future release.",
category=DeprecationWarning,
stacklevel=3,
)
self.n_modes = n_modes
self.sample_name = sample_name
self.feature_name = feature_name
Expand Down

0 comments on commit 87b23f9

Please sign in to comment.