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

fix Transform.from_points for scalar spatial points #1184

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

bjlittle
Copy link
Owner

@bjlittle bjlittle commented Oct 29, 2024

🚀 Pull Request

Description

This pull-request addresses the issue of geovista.bridge.Transfrom.from_points being unable to handle scalar spatial points e.g.,

>>> import geovista
>>> geovista.__version__
'0.5.3'
>>> from geovista.bridge import Transform
>>> Transform.from_points(0, 90).points
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<snip>/lib/python3.12/site-packages/geovista/bridge.py", line 685, in from_points
    xyz = to_cartesian(xs, ys, radius=radius, zlevel=zlevel, zscale=zscale)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<snip>/lib/python3.12/site-packages/geovista/common.py", line 731, in to_cartesian
    raise ValueError(emsg)
ValueError: Require longitudes and latitudes with same shape, got (1,) and () respectively.

Whereas, the following works as expected:

>>> Transform.from_points([0], [90]).points
pyvista_ndarray([[0., 0., 1.]])

@github-actions github-actions bot added type: testing Auto-labelled type: bug Auto-labelled for bug/*, fix/* and patch/* branches labels Oct 29, 2024
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.32%. Comparing base (2414f7c) to head (cc59f72).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1184      +/-   ##
==========================================
+ Coverage   91.28%   91.32%   +0.03%     
==========================================
  Files          58       58              
  Lines        2939     2939              
==========================================
+ Hits         2683     2684       +1     
+ Misses        256      255       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bjlittle bjlittle merged commit de45c04 into main Oct 29, 2024
22 checks passed
@bjlittle bjlittle deleted the fix/scalar-from-points branch October 29, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Auto-labelled for bug/*, fix/* and patch/* branches type: testing Auto-labelled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant