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
439 stars 127 forks source link

Update several notebooks to use cleaner `odc-geo` code #1186

Closed robbibt closed 6 months ago

robbibt commented 6 months ago

Proposed changes

The Open Data Cube Geo / odc-geo package now includes functionality to make it easy to perform spatial processing tasks using its built-in .odc. methods that are automatically added to xarray data.

For example, we can now mask an xarray dataset by a polygon using:

import odc.geo.xr
ds.odc.mask(poly)

Or reprojecting a dataset:

ds.odc.reproject(how="EPSG:3577")

This PR updates several notebooks to take advantage of this new functionality and simplify our code.

It also adds a new load_reproject function which uses odc.geo and rasterio to load and reproject external rasters to match data loaded from DEA.

Closes issues (optional)

Checklist

(Replace [ ] with [x] to check off)

sandbox_spellchecker

review-notebook-app[bot] commented 6 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

robbibt commented 6 months ago

Hey @BexDunn, I fixed up the comment - but when I re-ran the notebook, the runtime warning disappeared. I've had that happen before - it's a confusing! Can keep an eye out for it if it re-appears