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

Improve rioxarray support #645

Merged
merged 13 commits into from
Jun 12, 2023
Merged

Improve rioxarray support #645

merged 13 commits into from
Jun 12, 2023

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented May 31, 2023

Fixes #644

Rioxarray da.coords containsspatial_ref with is not a dimension. This makes it go down the wrong code path. By only using da.coords.dims, we can make it go down the same code path as previously.

I also aligned process_crs with the recent changes in hvplot's version of it in holoviz/hvplot#1026. Though I added +init to the string comparison to avoid this warning:

/home/shh/miniconda3/envs/holoviz/lib/python3.11/site-packages/pyproj/crs/crs.py:141: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  in_crs_string = _prepare_from_proj_string(in_crs_string)

At last, I added simple crs detection for a rioxarray and updated param.main.warning to warn as it no longer exits.

These changes make it possible to run the original example like this:
image

@hoxbro hoxbro requested a review from ahuang11 June 8, 2023 16:23
geoviews/util.py Outdated Show resolved Hide resolved
geoviews/util.py Outdated Show resolved Hide resolved
geoviews/util.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@ahuang11 ahuang11 left a comment

Choose a reason for hiding this comment

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

Looks good to me; just left a few nits about readability!

@ahuang11 ahuang11 self-requested a review June 12, 2023 15:17
Copy link
Collaborator

@ahuang11 ahuang11 left a comment

Choose a reason for hiding this comment

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

Looks good; just one suggestion for adding a test.

hoxbro and others added 3 commits June 12, 2023 17:28
Co-authored-by: Andrew <15331990+ahuang11@users.noreply.github.com>
Co-authored-by: Andrew <15331990+ahuang11@users.noreply.github.com>
@hoxbro
Copy link
Member Author

hoxbro commented Jun 12, 2023

Thank you for the review will merge when the test passes 👍

@ahuang11
Copy link
Collaborator

No problem, happy to review!

@hoxbro hoxbro merged commit 4228f2d into main Jun 12, 2023
@hoxbro hoxbro deleted the improve_rioxarray branch June 12, 2023 16:58
ahuang11 added a commit that referenced this pull request Jun 27, 2023
Co-authored-by: Andrew <15331990+ahuang11@users.noreply.github.com>
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.

ValueError when Displaying GeoTIFFs with geoviews.util.from_xarray(rioxarray.open_rasterio(filename))
2 participants