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

UniformGrid object has no attribute point_data #1779

Closed
RichardScottOZ opened this issue Nov 3, 2021 · 6 comments
Closed

UniformGrid object has no attribute point_data #1779

RichardScottOZ opened this issue Nov 3, 2021 · 6 comments
Labels
bug Uh-oh! Something isn't working as expected.

Comments

@RichardScottOZ
Copy link
Contributor

Just running this example:-
https://docs.pyvista.org/examples/00-load/create-uniform-grid.html


To Reproduce

# Create the 3D NumPy array of spatially referenced data
# This is spatially referenced such that the grid is 20 by 5 by 10
#   (nx by ny by nz)
values = np.linspace(0, 10, 1000).reshape((20, 5, 10))
values.shape

# Create the spatial reference
grid2 = pv.UniformGrid()

# Set the grid dimensions: shape because we want to inject our values on the
#   POINT data
grid2.dimensions = values.shape

# Edit the spatial reference
grid2.origin = (100, 33, 55.6)  # The bottom left corner of the data set
grid2.spacing = (1, 5, 2)  # These are the cell sizes along each axis

# Add the data values to the cell data
grid2.point_data["values"] = values.flatten(order="F")  # Flatten the array!

# Now plot the grid!
grid2.plot(show_edges=True)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-33-809b343a900c> in <module>
     17 
     18 # Add the data values to the cell data
---> 19 grid2.point_data["values"] = values.flatten(order="F")  # Flatten the array!
     20 
     21 # Now plot the grid!

~\AppData\Local\Continuum\anaconda3\envs\gempy2021\lib\site-packages\pyvista\core\dataset.py in __getattr__(self, item)
     94     def __getattr__(self, item) -> Any:
     95         """Get attribute from base class if not found."""
---> 96         return super().__getattribute__(item)
     97 
     98     @property

AttributeError: 'UniformGrid' object has no attribute 'point_data'

System Information:
Please run the following code wherever you are experiencing the bug and paste the output below. This report helps us track down bugs and it is critical to addressing your bug:

# Get system info
import pyvista as pv
print(pv.Report())
# Paste system info here
-------------------------------------------------------------------------------
  Date: Wed Nov 03 16:33:16 2021 Cen. Australia Daylight Time

                OS : Windows
            CPU(s) : 12
           Machine : AMD64
      Architecture : 64bit
               RAM : 127.8 GiB
       Environment : Jupyter
        GPU Vendor : Intel
      GPU Renderer : Intel(R) UHD Graphics P630
       GPU Version : 4.5.0 - Build 27.20.100.8280

  Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 15:50:08)
  [MSC v.1916 64 bit (AMD64)]

           pyvista : 0.29.1
               vtk : 9.0.1
             numpy : 1.20.2
           imageio : 2.9.0
           appdirs : 1.4.4
            scooby : 0.5.7
            meshio : 4.3.12
        matplotlib : 3.4.3
         pyvistaqt : 0.3.0
             PyQt5 : 5.12.3
           IPython : 7.22.0
          colorcet : 1.0.0
             scipy : 1.6.2
              tqdm : 4.60.0

  Intel(R) Math Kernel Library Version 2020.0.4 Product Build 20200917 for
  Intel(R) 64 architecture applications
-----------------------------------------------------------------------------
@RichardScottOZ RichardScottOZ added the bug Uh-oh! Something isn't working as expected. label Nov 3, 2021
@RichardScottOZ
Copy link
Contributor Author

Just don't need the point_data part? So maybe not a bug - a doc update?

@RichardScottOZ
Copy link
Contributor Author

Version issue?

@akaszynski
Copy link
Member

akaszynski commented Nov 3, 2021

Version issue?

Exactly. Upgrade to pyvista>=0.32.0 because we've updated the API to move from point_arrays --> point_data. The reasoning behind this is a bit complex, but for fun you can read https://docs.pyvista.org/user-guide/data_model.html.

BTW, nice specs!

        CPU(s) : 12
        RAM : 127.8 GiB

@RichardScottOZ
Copy link
Contributor Author

Thanks.

Yes, been a crucial bit of gear the last 2 years!

@RichardScottOZ
Copy link
Contributor Author

The data model overview is good.

@akaszynski
Copy link
Member

The data model overview is good.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Uh-oh! Something isn't working as expected.
Projects
None yet
Development

No branches or pull requests

2 participants