Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add deprecation warning for verbose parameter #200

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading