GeoscienceAustralia / dea-notebooks

Repository for Digital Earth Australia Jupyter Notebooks: tools and workflows for geospatial analysis with Open Data Cube and Xarray
https://docs.dea.ga.gov.au/notebooks/
Apache License 2.0
448 stars 128 forks source link

Major refactor of tide modelling funcs to add improved parallelization #1112

Closed robbibt closed 1 year ago

robbibt commented 1 year ago

Proposed changes

This PR implements a major refactor of the model_tides and pixel_tides functions to improve performance when modelling large numbers of points/timesteps with multiple models by adding parallelisation using concurrent.futures and Dask.

Parallelisation in model_tides is applied both across each individual tide model, as well as (optionally) by splitting tide modelling points into smaller chunks that are run in parallel. These are configurable via the parallel and parallel_splits params.

For modelling 10,000 timesteps, 1000 lat/lon points and 6 tide models on the 16XL DEA Sandbox server with parallel_splits=10, this improves runtimes by more than an order of magnitude:

The pixel_tides function has additionally been updated to use new Dask reproject functionality from odc-geo, used to reproject low-res tide outputs to each higher res satellite pixel (@Kirill888).

Other updates:

Closes issues

Closes #1109

robbibt commented 1 year ago

Hey @2320sharon @dbuscombe-usgs, this might be of interested! 🌊

2320sharon commented 1 year ago

This looks awesome! I'm definitely going to try these optimizations out. Thanks for this!

Hey @2320sharon @dbuscombe-usgs, this might be of interested! 🌊