Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dask configurable inside pixel_tides #1123

Merged
merged 1 commit into from Sep 5, 2023
Merged

Conversation

robbibt
Copy link
Collaborator

@robbibt robbibt commented Sep 5, 2023

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 normal xr.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 array
  • dask_chunks: Defaults to "auto"; this will automatically set Dask chunks to those in the input ds 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.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Collaborator

@vnewey vnewey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Robbi!

@vnewey vnewey merged commit 835754e into develop Sep 5, 2023
2 checks passed
@vnewey vnewey deleted the pixel_tide_update branch September 5, 2023 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants