__init__
PYL-W0201154 da = xr.DataArray(self._handle, name=array_name).rename(
155 dict(dim_0="frames", dim_1="height", dim_2="width", dim_3="color")
156 )
157 self._array = da.assign_coords(frames=t_s)158 self._array.frames.attrs["units"] = "s"
159
160 @property
147
148 def _wrap_data_array(self, array_name):
149 if isinstance(self._handle, xr.DataArray):
150 self._array = self._handle # TODO: this is kinda ugly!151 else:
152 t_s = np.linspace(0, self.duration.m, len(self._handle))
153
Defining an instance attribute outside __init__
affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__
method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None
in the init then call the sub-initialization methods.