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

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

Merged
merged 4 commits into from Aug 30, 2023

Conversation

robbibt
Copy link
Collaborator

@robbibt robbibt commented Aug 28, 2023

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:

  • Before: 29 min, 22 sec
  • After: 1 min, 16 sec

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:

  • Allow the tide modelling file directory to be optionally defined via a global environmental variable DEA_TOOLS_TIDE_MODELS (thanks to a suggestion by @omad in Provide a global method to set the tidal data directory #1109)
  • Allow results from model_tides to be returned in wide or long dataframe format
  • Allow the user to control the units of modelled tides (e.g. to improve memory by outputting results as integer centimetres vs floating point metres)
  • Expand coastal.py test coverage to include newly added multiple tide modelling functionality
  • Added some extra words to the spellcheck dictionary

Closes issues

Closes #1109

@robbibt
Copy link
Collaborator Author

robbibt commented Aug 29, 2023

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

Copy link
Collaborator

@erialC-P erialC-P left a comment

Choose a reason for hiding this comment

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

Hey Robbi! Everything looks hunky-dory to me :) Nice work on the optimisation!!!

@2320sharon
Copy link

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

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

@robbibt robbibt merged commit a8a8302 into develop Aug 30, 2023
2 checks passed
@robbibt robbibt deleted the update_tide_funcs branch August 30, 2023 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a global method to set the tidal data directory
3 participants