Skip to content

Commit 9d8f8bb

Browse files
committed
dev
1 parent d75dcd1 commit 9d8f8bb

File tree

3 files changed

+23
-49
lines changed

3 files changed

+23
-49
lines changed

cf/data/data.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9901,7 +9901,19 @@ def to_dask_array(self, apply_mask_hardness=False, _asanyarray=True):
99019901
If True then force the mask hardness of the returned
99029902
array to be that given by the `hardmask` attribute.
99039903
9904-
{{_asanyarray: `bool`, optional}}
9904+
_asanyarray: `bool`, optional
9905+
If True (the default) and the `__asanyarray__`
9906+
attribute is also `True`, then a `cf_asanyarray`
9907+
operation is added to the graph of the returned Dask
9908+
array. If False then this operation is not added.
9909+
9910+
In general, setting *_asanyarray* to False should only
9911+
be done if it is known that a) the returned Dask array
9912+
is never going to be computed; or b) it is not
9913+
necessary to add a `cf_asanyarray` operation in lieu of
9914+
its functionality being implemented by a new Dask graph
9915+
layer that is going to be created at a later stage. See
9916+
`cf.data.dask_utils.cf_asanyarray` for further details.
99059917
99069918
.. versionadded:: NEXTVERSION
99079919
@@ -11968,11 +11980,11 @@ def todict(
1196811980
1196911981
.. versionadded:: 3.15.0
1197011982
11971-
.. seealso:: `to_dask_array`, `tolist`
11983+
.. seealso:: `to_dask_array`
1197211984
1197311985
:Parameters:
1197411986
11975-
`optimize_graph`: `bool`
11987+
optimize_graph: `bool`
1197611988
If True, the default, then prior to being converted to
1197711989
a dictionary, the graph is optimised to remove unused
1197811990
chunks. Note that optimising the graph can add a
@@ -11984,7 +11996,12 @@ def todict(
1198411996
1198511997
.. versionadded:: NEXTVERSION
1198611998
11987-
{{_asanyarray: `bool`, optional}}
11999+
_asanyarray: `bool`, optional
12000+
If True (the default) and the `__asanyarray__`
12001+
attribute is also `True`, then a `cf_asanyarray`
12002+
operation is added to the dictionary representation of
12003+
the Dask graph. If False then this operation is not
12004+
added. See `to_dask_array` for details.
1198812005
1198912006
.. versionadded:: NEXTVERSION
1199012007

cf/docstring/docstring.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -632,21 +632,6 @@
632632
"{{to_size: `int`, optional}}": """to_size: `int`, optional
633633
Pad the axis after so that the new axis has the given
634634
size.""",
635-
# REVIEW: getitem: `_docstring_substitution_definitions`: 'asanyarray'
636-
# asanyarray
637-
"{{_asanyarray: `bool`, optional}": """_asanyarray: `bool`, optional
638-
If True (the default) and the `__asanyarray__`
639-
attribute is also `True`, then add a `cf_asanyarray`
640-
operation to the graph of the returned Dask array. If
641-
False then this operation is not added. Setting
642-
*_asanyarray* to False should only be done if it is
643-
known that a) the returned Dask array is never going to
644-
be computed; or b) it is not necessary to add a
645-
`cf_asanyarray` operation in lieu of its functionality
646-
being implemented by a new Dask graph layer that is
647-
going to be created at a later stage. See
648-
`cf.data.dask_utils.cf_asanyarray` for further
649-
details.""",
650635
# _get_array index
651636
"{{index: `tuple` or `None`, optional}}": """index: `tuple` or `None`, optional
652637
Provide the indices that define the subspace. If `None`

cf/mixin/propertiesdata.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4692,39 +4692,13 @@ def log(self, base=None, inplace=False, i=False):
46924692
delete_props=True,
46934693
)
46944694

4695-
# REVIEW: getitem: `to_dask_array`: new keyword 'asanyarray'
4696-
def to_dask_array(self, apply_mask_hardness=False, _asanyarray=None):
4695+
def to_dask_array(self):
46974696
"""Convert the data to a `dask` array.
46984697
4699-
.. warning:: By default, the mask hardness of the returned
4700-
dask array might not be the same as that
4701-
specified by the `hardmask` attribute.
4702-
4703-
This could cause problems if a subsequent
4704-
operation on the returned dask array involves the
4705-
un-masking of masked values (such as by indexed
4706-
assignment).
4707-
4708-
To guarantee that the mask hardness of the
4709-
returned dask array is correct, set the
4710-
*apply_mask_hardness* parameter to True.
4711-
47124698
.. versionadded:: 3.14.0
47134699
47144700
.. seealso:: `cf.Data.to_dask_array`
47154701
4716-
:Parameters:
4717-
4718-
apply_mask_hardness: `bool`, optional
4719-
If True then force the mask hardness of the returned
4720-
array to be that given by the `hardmask` attribute.
4721-
4722-
.. versionadded:: NEXTVERSION
4723-
4724-
{{_asanyarray: `bool`, optional}}
4725-
4726-
.. versionadded:: NEXTVERSION
4727-
47284702
:Returns:
47294703
47304704
`dask.array.Array`
@@ -4743,9 +4717,7 @@ def to_dask_array(self, apply_mask_hardness=False, _asanyarray=None):
47434717
if data is None:
47444718
raise ValueError("Can't get dask array when there is no data")
47454719

4746-
return data.to_dask_array(
4747-
apply_mask_hardness=apply_mask_hardness, _asanyarray=_asanyarray
4748-
)
4720+
return data.to_dask_array()
47494721

47504722
@_deprecated_kwarg_check("i", version="3.0.0", removed_at="4.0.0")
47514723
@_inplace_enabled(default=False)

0 commit comments

Comments
 (0)