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

Add spatial interpolation with xr_interpolate notebook #1233

Merged
merged 15 commits into from
Jun 13, 2024

Conversation

robbibt
Copy link
Collaborator

@robbibt robbibt commented Jun 13, 2024

Proposed changes

This PR updates the xr_interpolate function with new interpolation functionality, and adds a new Jupyter Notebook guide to using the function to spatially interpolate data.

Key changes include:

  1. Added a new dea_tools.spatial.idw Inverse Weighted Distance Interpolation function, and updated dea_tools.spatial.xr_interpolate to use this instead of previous bespoke code. Supports spatially interpolating both 1D and 2D input values (e.g. interpolating one or multiple datasets into the spatial extents of another).
  2. Fixed some minor bugs in xr_interpolate (coordinates where being passed around in the wrong order)
  3. Added extensive automated tests for the xr_interpolate and idw` functions

IDW interpolation example:
image

Checklist

  • Notebook created using the DEA-notebooks template
  • Remove any unused Python packages from Load packages
  • Remove any unused/empty code cells
  • Remove any guidance cells (e.g. General advice)
  • Ensure that all code cells follow the PEP8 standard for code. The jupyterlab_code_formatter tool can be used to format code cells to a consistent style: select each code cell, then click Edit and then one of the Apply X Formatter options (YAPF or Black are recommended).
  • Include relevant tags in the final notebook cell (refer to the DEA Tags Index, and re-use tags if possible)
  • Clear all outputs, run notebook from start to finish, and save the notebook in the state where all cells have been sequentially evaluated
  • Test notebook on both the NCI and DEA Sandbox (flag if not working as part of PR and ask for help to solve if needed)
  • If applicable, update the Notebook currently compatible with the NCI|DEA Sandbox environment only line below the notebook title to reflect the environments the notebook is compatible with
  • Check for any spelling mistakes using the DEA Sandbox's built-in spellchecker (double click on markdown cells then right-click on pink highlighted words). For example:

sandbox_spellchecker

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Collaborator

@BexDunn BexDunn left a comment

Choose a reason for hiding this comment

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

LGTM, really useful notebook with lots of cool bits. Only comments would be, when referring to 'z' value, you could keep describing it as 'our variable of interest z' or similar as I kept thinking it was elevation (it could be elevation) because of naming conventions, and that I think that the IDW power parameter is often referred to as 'p', yet we refer to it as 'k'. I think that's ok, as long as we are consistent. Overall its beautiful, useful, and well documented, and I'm happy to approve as is.

@robbibt
Copy link
Collaborator Author

robbibt commented Jun 13, 2024

Yep, great suggestion! Will update, thanks @BexDunn!

@robbibt robbibt merged commit 9b7f260 into develop Jun 13, 2024
1 check passed
@robbibt robbibt deleted the interpolation_notebook branch June 13, 2024 08:05
erialC-P pushed a commit that referenced this pull request Jun 17, 2024
* Add updated `xr_regression` function for multi-dimensional linear regression (#1226)

* Add updated xr_regression function

* Add dask support for lazy computation

* Set dtypes

* Update docstring

* Update docstring

* Add MAD outliers

* Update docstring

* Remove lag functionality

* Update docstrings

* Add better error handling

* Update stream gauge corr notebook to use new func

* Adding DEAfrica Wetland Turbidity notebook for Australian study site (#1175)

* Adding DEAfrica Wetland Turbidity notebook for Australian study site

* change all instances of NDTI to NDTI2 to reflect usage at top of notebook

* update notebook to use Collection 3 WO Statistics

* rerun notebook

---------

Co-authored-by: BexDunn <bex.dunn@ga.gov.au>

* Add spatial interpolation with `xr_interpolate` notebook (#1233)

* Add ensemble tide modelling functionality to model_tides

* Update test_coastal.py

* Remove test

* Updates to IDW, xr_interpolate and ensemble tide modelling code"

* Doco updates

* Switch ensemble rankings from high to low = good

* Update docstring

* Fix doco

* Add interpolation notebook

* Remove coastal files from branch

* Add points data

* Review feedback;

* Add p param to IDW

* Fix test

* Updates to product notebook Knowledge Hub links and DEA notebook content (#1221)

* Move KH links into consistent alert box format

* Update DEA notebook

* Minor wording updates

* Minor wording

* Temporarily remove STAC notebook from tests

* Add ensemble tide modelling functionality to `model_tides` (#1231)

* Add ensemble tide modelling functionality to model_tides

* Update test_coastal.py

* Remove test

* Updates to IDW, xr_interpolate and ensemble tide modelling code"

* Doco updates

* Switch ensemble rankings from high to low = good

* Update docstring

* Fix doco

* Add interpolation notebook

---------

Co-authored-by: Matt-dea <129345253+Matt-dea@users.noreply.github.com>
Co-authored-by: BexDunn <bex.dunn@ga.gov.au>
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

3 participants