Skip to content

Commit

Permalink
Merge pull request #426 from sadielbartholomew/lama-to-dask-concat-data
Browse files Browse the repository at this point in the history
LAMA to Dask: (deprecate) `Data.concatenate_data`
  • Loading branch information
sadielbartholomew authored Aug 2, 2022
2 parents 799d49f + b367578 commit fb7cc5f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
31 changes: 0 additions & 31 deletions cf/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5451,37 +5451,6 @@ def apply_masking(

return d

@classmethod
def concatenate_data(cls, data_list, axis):
"""Concatenates a list of Data objects into a single Data object
along the specified access (see cf.Data.concatenate for
details). In the case that the list contains only one element,
that element is simply returned.
:Parameters:
data_list: `list`
The list of data objects to concatenate.
axis: `int`
The axis along which to perform the concatenation.
:Returns:
`Data`
The resulting single `Data` object.
"""
if len(data_list) > 1:
data = cls.concatenate(data_list, axis=axis)
if data.fits_in_one_chunk_in_memory(data.dtype.itemsize):
data.varray

return data
else:
assert len(data_list) == 1
return data_list[0]

def argmax(self, axis=None, unravel=False):
"""Return the indices of the maximum values along an axis.
Expand Down
29 changes: 29 additions & 0 deletions cf/data/mixin/deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,3 +966,32 @@ def reconstruct_sectioned_data(cls, sections, cyclic=(), hardmask=None):
"Data method 'reconstruct_sectioned_data' has been deprecated "
"at version TODODASK and is no longer available"
)

@classmethod
def concatenate_data(cls, data_list, axis):
"""Concatenates a list of Data objects along the specified axis.
See cf.Data.concatenate for details.
In the case that the list contains only one element, that element
is simply returned.
:Parameters:
data_list: `list`
The list of data objects to concatenate.
axis: `int`
The axis along which to perform the concatenation.
:Returns:
`Data`
The resulting single `Data` object.
"""
raise DeprecationError(
"Data method 'concatenate_data' has been deprecated at "
"version TODODASK and is no longer available. Use "
"'concatenate' instead."
)

0 comments on commit fb7cc5f

Please sign in to comment.