pyvista / pyvista

3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)

Home Page:https://docs.pyvista.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing file reader for NumPy file types (e.g. `.npy`)

user27182 opened this issue · comments

Describe the bug, what's wrong, and what you expected.

There are pyvista examples, e.g. download_cloud_dark_matterwhich return a .npy file. Using pv.read on these files will fail:

import pyvista as pv
from pyvista import examples as ex
file = ex.download_cloud_dark_matter(load=False)
pv.read(file)  # OSError: This file was not able to be automatically read by pyvista.

I would have expected that using pv.read on the returned file would succeed.

In the example's source code, the files are loaded with:

return pyvista.PointSet(np.load(filename))

Perhaps a new reader class should be made to handle loading .npy and npz files?

Steps to reproduce the bug.

See above.

System Information

--------------------------------------------------------------------------------
                OS : Darwin
            CPU(s) : 8
           Machine : arm64
      Architecture : 64bit
               RAM : 16.0 GiB
       Environment : Python
       File system : apfs
        GPU Vendor : Apple
      GPU Renderer : Apple M2
       GPU Version : 4.1 Metal - 83.1
  MathText Support : True

  Python 3.12.2 (v3.12.2:6abddd9f6a, Feb  6 2024, 17:02:06) [Clang 13.0.0
  (clang-1300.0.29.30)]

           pyvista : 0.44.dev0
               vtk : 9.3.0
             numpy : 1.26.4
        matplotlib : 3.8.2
            scooby : 0.9.2
             pooch : 1.8.0
            pillow : 10.2.0
           imageio : 2.33.1
           IPython : 8.21.0
          colorcet : 3.0.1
           cmocean : 3.1.3
        ipywidgets : 8.1.2
              tqdm : 4.66.2
            meshio : 5.3.5
    pytest_pyvista : 0.1.8
             trame : 3.5.2
      trame_client : 2.16.1
      trame_server : 2.17.2
         trame_vtk : 2.8.5
     trame_vuetify : 2.4.2
      nest_asyncio : 1.6.0
--------------------------------------------------------------------------------

Screenshots

No response