Skip to content

Commit

Permalink
Make clearer that method applies to all numpy arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Feb 3, 2021
1 parent 8efa2de commit 50ddf0a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions bw_processing/datapackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,15 @@ def add_persistent_vector(
)
name = self._prepare_name(name)

self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(indices_array),
name=name + ".indices",
group=name,
kind="indices",
**kwargs,
)
if data_array is not None:
self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(data_array),
group=name,
name=name + ".data",
Expand All @@ -370,15 +370,15 @@ def add_persistent_vector(
if (distributions_array["uncertainty_type"] < 2).sum() < len(
distributions_array
):
self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(distributions_array),
name=name + ".distributions",
group=name,
kind="distributions",
**kwargs,
)
if flip_array is not None and flip_array.sum():
self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(flip_array),
group=name,
name=name + ".flip",
Expand All @@ -404,30 +404,30 @@ def add_persistent_array(
)
name = self._prepare_name(name)

self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(data_array),
name=name + ".data",
group=name,
kind="data",
**kwargs,
)
self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(indices_array),
name=name + ".indices",
kind="indices",
group=name,
**kwargs,
)
if flip_array is not None and flip_array.sum():
self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(flip_array),
group=name,
name=name + ".flip",
kind="flip",
**kwargs,
)

def _add_array_resource(
def _add_numpy_array_resource(
self, *, array: np.ndarray, name: str, matrix: str, kind: str, **kwargs
) -> None:
filename = check_suffix(name, ".npy")
Expand Down Expand Up @@ -557,15 +557,15 @@ def add_dynamic_vector(

# Do something with dynamic vector

self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(indices_array),
name=name + ".indices",
group=name,
kind="indices",
**kwargs,
)
if flip_array is not None and flip_array.sum():
self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(flip_array),
group=name,
name=name + ".flip",
Expand Down Expand Up @@ -606,15 +606,15 @@ def add_dynamic_array(

# Do something with dynamic vector

self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(indices_array),
name=name + ".indices",
group=name,
kind="indices",
**kwargs,
)
if flip_array is not None:
self._add_array_resource(
self._add_numpy_array_resource(
array=load_bytes(flip_array),
group=name,
name=name + ".flip",
Expand Down

0 comments on commit 50ddf0a

Please sign in to comment.