Skip to content

Commit

Permalink
chores: remove long deprecated functions/arguments/attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
fneum committed Aug 17, 2024
1 parent 55098dd commit d772ce7
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 94 deletions.
2 changes: 2 additions & 0 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Upcoming Release
keyword arguments for ``dask.compute`` (``dask_kwargs={}``) and an option to
disable the progressbar (``show_progressbar=True``).

- Remove long deprecated functions and cutout arguments / attributes.

Version 0.2.13
==============

Expand Down
48 changes: 0 additions & 48 deletions atlite/cutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ def __init__(self, path, **cutoutparams):
Whether to open dataset in parallel mode. Take effect for all
xr.open_mfdataset usages.
"""
name = cutoutparams.get("name", None)
cutout_dir = cutoutparams.get("cutout_dir", None)
if cutout_dir or name or Path(path).is_dir():
raise ValueError(
"Old style format not supported. You can migrate the old "
"cutout directory using the function "
"`atlite.utils.migrate_from_cutout_directory()`. The argument "
"`cutout_dir` and `name` have been deprecated in favour of `path`."
)

path = Path(path).with_suffix(".nc")
chunks = cutoutparams.pop("chunks", {"time": 100})
Expand All @@ -156,31 +147,6 @@ def __init__(self, path, **cutoutparams):
else:
storable_chunks = {}

# Backward compatibility for xs, ys, months and years
if {"xs", "ys"}.intersection(cutoutparams):
warn(
"The arguments `xs` and `ys` have been deprecated in favour of "
"`x` and `y`",
DeprecationWarning,
)
if "xs" in cutoutparams:
cutoutparams["x"] = cutoutparams.pop("xs")
if "ys" in cutoutparams:
cutoutparams["y"] = cutoutparams.pop("ys")

if {"years", "months"}.intersection(cutoutparams):
warn(
"The arguments `years` and `months` have been deprecated in "
"favour of `time`",
DeprecationWarning,
)
assert "years" in cutoutparams
months = cutoutparams.pop("months", slice(1, 12))
years = cutoutparams.pop("years")
cutoutparams["time"] = slice(
f"{years.start}-{months.start}", f"{years.stop}-{months.stop}"
)

# Three cases. First, cutout exists -> take the data.
# Second, data is given -> take it. Third, else -> build a new cutout
if path.is_file():
Expand Down Expand Up @@ -279,20 +245,6 @@ def coords(self):
"""
return self.data.coords

@property
def meta(self):
"""
Metadata of the cutout.
Deprecated since v0.2.
"""
warn(
"The `meta` attribute is deprecated in favour of direct "
"access to `data`",
DeprecationWarning,
)
return xr.Dataset(self.coords, attrs=self.data.attrs)

@property
def shape(self):
"""
Expand Down
13 changes: 0 additions & 13 deletions atlite/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,6 @@ def _reproject_shape(shape):
return list(map(_reproject_shape, shapes))


def reproject(shapes, p1, p2):
"""
Project a collection of shapes from one crs to another.
Deprecated since version 0.2.
"""
warn("reproject has been renamed to reproject_shapes", DeprecationWarning)
return reproject_shapes(shapes, p1, p2)


reproject.__doc__ = reproject_shapes.__doc__


def compute_indicatormatrix(orig, dest, orig_crs=4326, dest_crs=4326):
"""
Compute the indicatormatrix.
Expand Down
33 changes: 0 additions & 33 deletions atlite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,6 @@
logger = logging.getLogger(__name__)


def make_optional_progressbar(show, prefix, max_value=None):
warnings.warn(
"make_optional_progressbar() is deprecated and will be removed "
"in the next version.",
warnings.DeprecationWarning,
)
if show:
widgets = [
pgb.widgets.Percentage(),
" ",
pgb.widgets.SimpleProgress(
format="(%s)" % pgb.widgets.SimpleProgress.DEFAULT_FORMAT
),
" ",
pgb.widgets.Bar(),
" ",
pgb.widgets.Timer(),
" ",
pgb.widgets.ETA(),
]
if not prefix.endswith(": "):
prefix = prefix.strip() + ": "
maybe_progressbar = pgb.ProgressBar(
prefix=prefix, widgets=widgets, max_value=max_value
)
else:

def maybe_progressbar(x):
return x

return maybe_progressbar


def migrate_from_cutout_directory(old_cutout_dir, path):
"""
Convert an old style cutout directory to new style netcdf file.
Expand Down

0 comments on commit d772ce7

Please sign in to comment.