Make dask configurable inside pixel_tides
#1123
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
Currently the
pixel_tides
function uses Dask under the hood to resample our low resolution tide modelling outputs into the original higher-res pixels of our satellite data. Previously, we used.compute()
inside the function to load our results into memory and return then as a normalxr.DataArray
.However, for certain applications it can be useful to return our tide modelling data as an un-computed Dask array, for example to use as part of a larger Dask workflow.
This PR adds two new params to
pixel_tides
which make Dask more configurable:dask_compute
: Defaults to True; if set to False then data will be returned as a lazily loaded Dask arraydask_chunks
: Defaults to "auto"; this will automatically set Dask chunks to those in the inputds
dataset (if they exist). Can also be used to pass in a tuple of custom chunks (e.g.(2048, 2048)
) to use for the resampling step.Also added a new test covering this functionality, and re-run the
How_to_guides/Tidal_modelling.ipynb
notebook.