question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`merge` filter does not preserve multi-component data

See original GitHub issue

Describe the bug, what’s wrong, and what you expect:

merge filter does not preserve vectors data.

To Reproduce

Please include a code snippet to reproduce the bug in the block below:

import pyvista
from pyvista import examples
filename = examples.download_cavity(load=False)
reader = pyvista.get_reader(filename)
reader.set_active_time_value(2.5)
mesh = reader.read()
internal_mesh = mesh['internalMesh']
boundary_mesh = mesh['boundary']['movingWall']
# Using vtk==9.1.0, the point_data is mostly the same on both meshes
# Arbitrarily change the boundary mesh
boundary_mesh.point_data["U"] = 10
merged_mesh = internal_mesh.merge(boundary_mesh, main_has_priority=False)
print(internal_mesh.point_data)
print(boundary_mesh.point_data)
print(merged_mesh.point_data)

gives

pyvista DataSetAttributes
Association     : POINT
Active Scalars  : p
Active Vectors  : U
Active Texture  : None
Active Normals  : None
Contains arrays :
    U                       float32  (882, 3)             VECTORS
    p                       float32  (882,)               SCALARS
pyvista DataSetAttributes
Association     : POINT
Active Scalars  : p
Active Vectors  : U
Active Texture  : None
Active Normals  : None
Contains arrays :
    U                       float64  (42,)                VECTORS
    p                       float32  (42,)                SCALARS
pyvista DataSetAttributes
Association     : POINT
Active Scalars  : p
Active Vectors  : None
Active Texture  : None
Active Normals  : None
Contains arrays :
    p                       float32  (882,)               SCALARS

Screenshots N/A


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())
--------------------------------------------------------------------------------
           pyvista : 0.34.dev0
               vtk : 9.1.0
             numpy : 1.22.2
           imageio : 2.14.1
           appdirs : 1.4.4
            scooby : 0.5.11
        matplotlib : 3.5.1
           IPython : 7.31.1
          colorcet : 3.0.0
           cmocean : 2.0
        ipyvtklink : 0.2.2
        itkwidgets : 0.32.1
              tqdm : 4.62.3
            meshio : 5.3.0

Noted in https://github.com/pyvista/pyvista/discussions/2126

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
MatthewFlammcommented, Feb 7, 2022

I wonder also if we could de-activate the VECTORS data then re-activate later. I’m not sure if it is limited to the active vectors yet.

This doesn’t work, which means that it is multi-component data that doesn’t get copied. This is weird to me.

import pyvista
from pyvista import examples
filename = examples.download_cavity(load=False)
reader = pyvista.get_reader(filename)
reader.set_active_time_value(2.5)
mesh = reader.read()
internal_mesh = mesh['internalMesh']
boundary_mesh = mesh['boundary']['movingWall']
internal_mesh.set_active_vectors(None)
boundary_mesh.set_active_vectors(None)
# Using vtk==9.1.0, the point_data is mostly the same on both meshes
# Arbitrarily change the boundary mesh
boundary_mesh.point_data["U"] = 10
merged_mesh = internal_mesh.merge(boundary_mesh, main_has_priority=False)
print(internal_mesh.point_data)
print(boundary_mesh.point_data)
print(merged_mesh.point_data)
pyvista DataSetAttributes
Association     : POINT
Active Scalars  : p
Active Vectors  : None
Active Texture  : None
Active Normals  : None
Contains arrays :
    U                       float32  (882, 3)
    p                       float32  (882,)               SCALARS
pyvista DataSetAttributes
Association     : POINT
Active Scalars  : p
Active Vectors  : None
Active Texture  : None
Active Normals  : None
Contains arrays :
    U                       float64  (42,)
    p                       float32  (42,)                SCALARS
pyvista DataSetAttributes
Association     : POINT
Active Scalars  : p
Active Vectors  : None
Active Texture  : None
Active Normals  : None
Contains arrays :
    p                       float32  (882,)               SCALARS
1reaction
MatthewFlammcommented, Feb 7, 2022

I wonder also if we could de-activate the VECTORS data then re-activate later. I’m not sure if it is limited to the active vectors yet.

I can see some cases where just copying over data may not be possible. For example, copying over NORMALS may not be correct. I can’t come up with a reason why VECTORS would be affected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mail merge filtering problem - Microsoft Community
I am trying to get a consistent result from filtering records during a mail merge from an Excel data file. It has worked...
Read more >
How to filter all related data from merged cells in Excel?
To solve this job, you need to do following operations step by step. 1. Copy your merged cells data to other blank column...
Read more >
Filter not working for merged cell in Excel - YouTube
FB: https://www.facebook.com/shaakzscatiav5forumOne day training on any subject taught on my channel for 100$, Training only on weekends IST ...
Read more >
Unable to Filter Data after merging Cells? Then try this tips!
Hello, In this short video I have shown you how to filter data after merging cells. This is really simple and really helpful...
Read more >
Clampfit Batch Analysis User Guide | Molecular Devices
Keep the window open while you use Clampfit Batch Analysis to move to different locations in the client and copy data to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found