You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Let PyGMT accept a 1d array when 2d array is needed #1132
Below is a simple example plotting a circular vector. The data parameter expects a 2D array/list. Each row is a record, and the 5 columns are [x_start, y_start, radius, degree_start, degree_stop].
The following script works as expected because the variable data is a 2D array/list:
Hello! I tried the example you mentioned in the issue description and I got this error message.
'list' object has no attribute 'flags'
So it looks like even passing a 2D array would cause an error. To solve it, I had to pass the 2D array into a numpy array object to see the plot.
I don't know if it's important to know but I ran the code using Jupyter Notebook.
Activity
seisman commentedon Mar 27, 2021
Similarly, parameters like
xandyusually expect a 1D array/list, but PyGMT allow passing scalar values to them.noorbuchi commentedon Mar 27, 2021
Hello! I tried the example you mentioned in the issue description and I got this error message.
So it looks like even passing a 2D array would cause an error. To solve it, I had to pass the 2D array into a
numpyarray object to see the plot.I don't know if it's important to know but I ran the code using Jupyter Notebook.
seisman commentedon Mar 27, 2021
It works for me. What's your PyGMT and GMT versions?
noorbuchi commentedon Mar 27, 2021
This is what I got:
seisman commentedon Mar 27, 2021
You're using PyGMT v0.3.0, but the latest one is v0.3.1. I think the
'list' object has no attribute 'flags'error was fixed in #990.noorbuchi commentedon Mar 27, 2021
That makes a lot of sense! I haven't been keeping up with the latest updates. I'll try updating and see if it fixes the issue. I'll keep you posted
noorbuchi commentedon Mar 27, 2021
I just updated to v0.3.1. and your example is working! It still doesn't accept 1D array as you already mentioned