Skip to content

Commit

Permalink
simply generation of sparse arrays in example
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Nov 12, 2023
1 parent d265ddb commit 0e872a8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions doc/user-guide/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,14 @@ different type:
.. ipython:: python
def convert_to_sparse(var):
if var.ndim == 0:
return var
else:
var.data = sparse.COO.from_numpy(var.to_numpy())
return var
var.data = sparse.COO.from_numpy(var.to_numpy())
return var
.. ipython:: python
sparse_variables = xrst.variables().map(convert_to_sparse)
sparse_variables = xrst.variables(dims=dimension_names(min_dims=1)).map(
convert_to_sparse
)
sparse_variables.example()
sparse_variables.example()
Expand Down

0 comments on commit 0e872a8

Please sign in to comment.