holoviz / geoviews

Simple, concise geographical visualization in Python
http://geoviews.org
BSD 3-Clause "New" or "Revised" License
597 stars 77 forks source link

Improve rioxarray support #645

Closed hoxbro closed 1 year ago

hoxbro commented 1 year ago

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 https://github.com/holoviz/hvplot/pull/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 commented 1 year ago

Thank you for the review will merge when the test passes :+1:

ahuang11 commented 1 year ago

No problem, happy to review!