-
Notifications
You must be signed in to change notification settings - Fork 20
Speed up tif data access #1192
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
base: main
Are you sure you want to change the base?
Speed up tif data access #1192
Conversation
Example Notebooks showing local data access with different opening parametersaccess_tif_local0.ipynb |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1192 +/- ##
=======================================
Coverage 89.55% 89.55%
=======================================
Files 280 280
Lines 21646 21653 +7
=======================================
+ Hits 19384 19391 +7
Misses 2262 2262 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b-yogesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I did not test it but I believe the screenshots on the speedup. Should we add any tests that show that using chunks is faster than any other tile size? Also, please have a look at my comments.
| "variables. If `False`, the original data structure returned by " | ||
| "rioxarray is preserved." | ||
| ), | ||
| default=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it says the defaults are set to True but in the PR description it says it is set to False.
| "variables. If `False`, the original data structure returned by " | ||
| "rioxarray is preserved." | ||
| ), | ||
| default=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well
| file_path: str, | ||
| overview_level: int, | ||
| tile_size: tuple[int, int] | None = None, | ||
| band_as_variable: bool = True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well.
| self._file_url, | ||
| overview_level=index - 1 if index > 0 else None, | ||
| tile_size=self._open_params.get("tile_size"), | ||
| band_as_variable=self._open_params.get("band_as_variable", True), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and other places too. If true is correct, change the PR description
| * Added the optional argument `band_as_variable`, which allows to preserve the | ||
| original dataset structure as returned by `rioxarray`, rather than splitting | ||
| raster bands into separate data variables. This improves data access patterns and | ||
| avoids unnecessary transformations. Defaults are set to `False`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it is set to False
chunks="auto"by default inrioxarray.open_rasteriowithinxcube.core.store.fs.impl.rasteriowhen reading GeoTIFF and JPEG2000 files.This enables efficient, storage-aware data access without forcing explicit
rechunking.
band_as_variable, which allows to preserve theoriginal dataset structure as returned by
rioxarray, rather than splittingraster bands into separate data variables. This improves data access patterns and
avoids unnecessary transformations. Defaults are set to
False.Here is an small example of a GeoTIFF access as it was implemented before:

Here is an small example of the same GeoTIFF access with

chunks="auto":Checklist:
docs/source/*CHANGES.md