What is the most efficient/quickest way to assign new values to a subset of a dask DataArray? #8469
Unanswered
GrowlingM1ke
asked this question in
Q&A
Replies: 1 comment 1 reply
-
def _fill_interpolate(self, click):
if self._last > self._first:
self.update_status.value = "Started Filling"
# adjust chunk size as needed
# use `auto` chunking to let dask choose appropriate chunk sizes for height/width dimensions
chunk_size = {'frame': 10, 'height': 'auto', 'width': 'auto'}
self.varr_copy = self.varr_copy.chunk(chunk_size)
fill = xr.apply_ufunc(
_fill,
self.varr_copy,
input_core_dims=[["frame", "height", "width"]],
output_core_dims=[["frame", "height", "width"]],
dask="parallelized",
kwargs=dict(direction="interpolate", first=self._first, last=self._last),
output_dtypes=[self.varr_copy.dtype],
)
# delay compute call
self.varr_copy = fill
self.ds = fill.to_dataset()
.... and then when you after calling considering the above points, i recommend trying the revised |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have video data that I have loaded into a dask DataArray. Some of the frames in the video are erroneous and are either missing or contain weird artifacts. For analysis purposes I want to get rid of these problematic frames by interpolating or copying over values from frames adjacent to them.
Whatever I attempt to do seems to be very slow or results in using too much memory, which I think is due to the fact that the entire video is loaded into memory before the fix is executed. Below is a sample of my code:
Below is the fill function:
The process of writing this code has been mostly trial and error so I fully apologize if the above is incoherent. Is there any approach I could take that would allow me to apply my fix to a subset of the dataArray? Could I load only a specific chunk of the dataArray and apply the fix to it?
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions