I am using the PyVista package to resample a .vtk mesh of nonconforming rectangular prisms onto a grid of points. However, some of the points fail to sample the dataset, which results in a "0" value in the index of that point in pointset_sample.point_data['vtkValidPointMask'] and either 0 or some NaN color value when plotting the points. Here's a minimal reproducible example: mesh.vtk: # vtk DataFile Version 2.0 MeshData ASCII DATASET UNSTRUCTURED_GRID POINTS 207 float -2500 -2500 -400 -1500 -2500 -400 -500 -2500 -400 500 -2500 -400 1500 -2500 -400 2500 -2500 -400 -2500 -1500 -400 -1500 -1500 -400 -500 -1500 -400 500 -1500 -400 1500 -1500 -400 2500 -1500 -400 -2500 -500 -400 -1500 -500 -400 -500 -500 -400 500 -500 -400 1500 -500 -400 2500 -500 -400 -2500 500 -400 -1500 500 -400 -500 500 -400 500 500 -400 1500 500 -400 2500 500 -400 -2500 1500 -400 -1500 1500 -400 -500 1500 -400 500 1500 -400 1500 1500 -400 2500 1500 -400 -2500 2500 -400 -1500 2500 -400 -500 2500 -400 500 2500 -400 1500 2500 -400 2500 2500 -400 -2500 -2500 0 -1500 -2500 0 -500 -2500 0 500 -2500 0 1500 -2500 0 2500 -2500 0 -2500 -1500 0 -1500 -1500 0 -500 -1500 0 500 -1500 0 1500 -1500 0 2500 -1500 0 -2500 -500 0 -1500 -500 0 -500 -500 0 500 -500 0 1500 -500 0 2500 -500 0 -2500 500 0 -1500 500 0 -500 500 0 500 500 0 1500 500 0 2500 500 0 -2500 1500 0 -1500 1500 0 -500 1500 0 500 1500 0 1500 1500 0 2500 1500 0 -2500 2500 0 -1500 2500 0 -500 2500 0 500 2500 0 1500 2500 0 2500 2500 0 -2500 -2500 1600 -1500 -2500 1600 -500 -2500 1600 500 -2500 1600 1500 -2500 1600 2500 -2500 1600 -2500 -1500 1600 -1500 -1500 1600 -500 -1500 1600 500 -1500 1600 1500 -1500 1600 2500 -1500 1600 -2500 -500 1600 -1500 -500 1600 -500 -500 1600 500 -500 1600 1500 -500 1600 2500 -500 1600 -2500 500 1600 -1500 500 1600 -500 500 1600 500 500 1600 1500 500 1600 2500 500 1600 -2500 1500 1600 -1500 1500 1600 -500 1500 1600 500 1500 1600 1500 1500 1600 2500 1500 1600 -2500 2500 1600 -1500 2500 1600 -500 2500 1600 500 2500 1600 1500 2500 1600 2500 2500 1600 -1000 -1500 -400 -1500 -1000 -400 -1000 -1000 -400 -500 -1000 -400 -1000 -500 -400 -1000 -1500 0 -1500 -1000 0 -1000 -1000 0 -500 -1000 0 -1000 -500 0 0 -1500 -400 0 -1000 -400 500 -1000 -400 0 -500 -400 0 -1500 0 0 -1000 0 500 -1000 0 0 -500 0 1000 -1500 -400 1000 -1000 -400 1500 -1000 -400 1000 -500 -400 1000 -1500 0 1000 -1000 0 1500 -1000 0 1000 -500 0 -1500 0 -400 -1000 0 -400 -500 0 -400 -1000 500 -400 -1500 0 0 -1000 0 0 -500 0 0 -1000 500 0 0 0 -400 500 0 -400 0 500 -400 0 0 0 500 0 0 0 500 0 1000 0 -400 1500 0 -400 1000 500 -400 1000 0 0 1500 0 0 1000 500 0 -1500 1000 -400 -1000 1000 -400 -500 1000 -400 -1000 1500 -400 -1500 1000 0 -1000 1000 0 -500 1000 0 -1000 1500 0 0 1000 -400 500 1000 -400 0 1500 -400 0 1000 0 500 1000 0 0 1500 0 1000 1000 -400 1500 1000 -400 1000 1500 -400 1000 1000 0 1500 1000 0 1000 1500 0 -1000 -1500 1600 -1500 -1000 1600 -1000 -1000 1600 -500 -1000 1600 -1000 -500 1600 0 -1500 1600 0 -1000 1600 500 -1000 1600 0 -500 1600 1000 -1500 1600 1000 -1000 1600 1500 -1000 1600 1000 -500 1600 -1500 0 1600 -1000 0 1600 -500 0 1600 -1000 500 1600 0 0 1600 500 0 1600 0 500 1600 1000 0 1600 1500 0 1600 1000 500 1600 -1500 1000 1600 -1000 1000 1600 -500 1000 1600 -1000 1500 1600 0 1000 1600 500 1000 1600 0 1500 1600 1000 1000 1600 1500 1000 1600 1000 1500 1600 CELLS 104 936 8 0 1 7 6 36 37 43 42 8 1 2 8 7 37 38 44 43 8 2 3 9 8 38 39 45 44 8 3 4 10 9 39 40 46 45 8 4 5 11 10 40 41 47 46 8 6 7 13 12 42 43 49 48 8 10 11 17 16 46 47 53 52 8 12 13 19 18 48 49 55 54 8 16 17 23 22 52 53 59 58 8 18 19 25 24 54 55 61 60 8 22 23 29 28 58 59 65 64 8 24 25 31 30 60 61 67 66 8 25 26 32 31 61 62 68 67 8 26 27 33 32 62 63 69 68 8 27 28 34 33 63 64 70 69 8 28 29 35 34 64 65 71 70 8 36 37 43 42 72 73 79 78 8 37 38 44 43 73 74 80 79 8 38 39 45 44 74 75 81 80 8 39 40 46 45 75 76 82 81 8 40 41 47 46 76 77 83 82 8 42 43 49 48 78 79 85 84 8 46 47 53 52 82 83 89 88 8 48 49 55 54 84 85 91 90 8 52 53 59 58 88 89 95 94 8 54 55 61 60 90 91 97 96 8 58 59 65 64 94 95 101 100 8 60 61 67 66 96 97 103 102 8 61 62 68 67 97 98 104 103 8 62 63 69 68 98 99 105 104 8 63 64 70 69 99 100 106 105 8 64 65 71 70 100 101 107 106 8 7 108 110 109 43 113 115 114 8 108 8 111 110 113 44 116 115 8 109 110 112 13 114 115 117 49 8 110 111 14 112 115 116 50 117 8 8 118 119 111 44 122 123 116 8 118 9 120 119 122 45 124 123 8 111 119 121 14 116 123 125 50 8 119 120 15 121 123 124 51 125 8 9 126 127 120 45 130 131 124 8 126 10 128 127 130 46 132 131 8 120 127 129 15 124 131 133 51 8 127 128 16 129 131 132 52 133 8 13 112 135 134 49 117 139 138 8 112 14 136 135 117 50 140 139 8 134 135 137 19 138 139 141 55 8 135 136 20 137 139 140 56 141 8 14 121 142 136 50 125 145 140 8 121 15 143 142 125 51 146 145 8 136 142 144 20 140 145 147 56 8 142 143 21 144 145 146 57 147 8 15 129 148 143 51 133 151 146 8 129 16 149 148 133 52 152 151 8 143 148 150 21 146 151 153 57 8 148 149 22 150 151 152 58 153 8 19 137 155 154 55 141 159 158 8 137 20 156 155 141 56 160 159 8 154 155 157 25 158 159 161 61 8 155 156 26 157 159 160 62 161 8 20 144 162 156 56 147 165 160 8 144 21 163 162 147 57 166 165 8 156 162 164 26 160 165 167 62 8 162 163 27 164 165 166 63 167 8 21 150 168 163 57 153 171 166 8 150 22 169 168 153 58 172 171 8 163 168 170 27 166 171 173 63 8 168 169 28 170 171 172 64 173 8 43 113 115 114 79 174 176 175 8 113 44 116 115 174 80 177 176 8 114 115 117 49 175 176 178 85 8 115 116 50 117 176 177 86 178 8 44 122 123 116 80 179 180 177 8 122 45 124 123 179 81 181 180 8 116 123 125 50 177 180 182 86 8 123 124 51 125 180 181 87 182 8 45 130 131 124 81 183 184 181 8 130 46 132 131 183 82 185 184 8 124 131 133 51 181 184 186 87 8 131 132 52 133 184 185 88 186 8 49 117 139 138 85 178 188 187 8 117 50 140 139 178 86 189 188 8 138 139 141 55 187 188 190 91 8 139 140 56 141 188 189 92 190 8 50 125 145 140 86 182 191 189 8 125 51 146 145 182 87 192 191 8 140 145 147 56 189 191 193 92 8 145 146 57 147 191 192 93 193 8 51 133 151 146 87 186 194 192 8 133 52 152 151 186 88 195 194 8 146 151 153 57 192 194 196 93 8 151 152 58 153 194 195 94 196 8 55 141 159 158 91 190 198 197 8 141 56 160 159 190 92 199 198 8 158 159 161 61 197 198 200 97 8 159 160 62 161 198 199 98 200 8 56 147 165 160 92 193 201 199 8 147 57 166 165 193 93 202 201 8 160 165 167 62 199 201 203 98 8 165 166 63 167 201 202 99 203 8 57 153 171 166 93 196 204 202 8 153 58 172 171 196 94 205 204 8 166 171 173 63 202 204 206 99 8 171 172 64 173 204 205 100 206 CELL_TYPES 104 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 CELL_DATA 104 SCALARS BlockID int LOOKUP_TABLE default 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 SCALARS Resistivity[Ohm-m] float LOOKUP_TABLE default 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 1e+10 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 SCALARS ElemID int LOOKUP_TABLE default 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 SCALARS Level int LOOKUP_TABLE default 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 SCALARS Volume float LOOKUP_TABLE default 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 POINT_DATA 207 SCALARS NodeID int LOOKUP_TABLE default 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206  array in points.py: import numpy as np points = np.array([[-1.912e+03, -1.912e+03, -2.000e+02], [-1.912e+03, -1.912e+03, 8.000e+02], [-1.030e+03, -1.912e+03, -2.000e+02], [-1.030e+03, -1.912e+03, 8.000e+02], [-5.890e+02, -1.912e+03, -2.000e+02], [-5.890e+02, -1.912e+03, 8.000e+02], [-2.950e+02, -1.912e+03, -2.000e+02], [-2.950e+02, -1.912e+03, 8.000e+02], [-1.000e+00, -1.912e+03, -2.000e+02], [-1.000e+00, -1.912e+03, 8.000e+02], [ 2.930e+02, -1.912e+03, -2.000e+02], [ 2.930e+02, -1.912e+03, 8.000e+02], [ 5.870e+02, -1.912e+03, -2.000e+02], [ 5.870e+02, -1.912e+03, 8.000e+02], [ 1.028e+03, -1.912e+03, -2.000e+02], [ 1.028e+03, -1.912e+03, 8.000e+02], [ 1.910e+03, -1.912e+03, -2.000e+02], [ 1.910e+03, -1.912e+03, 8.000e+02], [-1.912e+03, -1.030e+03, -2.000e+02], [-1.912e+03, -1.030e+03, 8.000e+02], [-1.030e+03, -1.030e+03, -2.000e+02], [-1.030e+03, -1.030e+03, 8.000e+02], [-5.890e+02, -1.030e+03, -2.000e+02], [-5.890e+02, -1.030e+03, 8.000e+02], [-2.950e+02, -1.030e+03, -2.000e+02], [-2.950e+02, -1.030e+03, 8.000e+02], [-1.000e+00, -1.030e+03, -2.000e+02], [-1.000e+00, -1.030e+03, 8.000e+02], [ 2.930e+02, -1.030e+03, -2.000e+02], [ 2.930e+02, -1.030e+03, 8.000e+02], [ 5.870e+02, -1.030e+03, -2.000e+02], [ 5.870e+02, -1.030e+03, 8.000e+02], [ 1.028e+03, -1.030e+03, -2.000e+02], [ 1.028e+03, -1.030e+03, 8.000e+02], [ 1.910e+03, -1.030e+03, -2.000e+02], [ 1.910e+03, -1.030e+03, 8.000e+02], [-1.912e+03, -5.890e+02, -2.000e+02], [-1.912e+03, -5.890e+02, 8.000e+02], [-1.030e+03, -5.890e+02, -2.000e+02], [-1.030e+03, -5.890e+02, 8.000e+02], [-5.890e+02, -5.890e+02, -2.000e+02], [-5.890e+02, -5.890e+02, 8.000e+02], [-2.950e+02, -5.890e+02, -2.000e+02], [-2.950e+02, -5.890e+02, 8.000e+02], [-1.000e+00, -5.890e+02, -2.000e+02], [-1.000e+00, -5.890e+02, 8.000e+02], [ 2.930e+02, -5.890e+02, -2.000e+02], [ 2.930e+02, -5.890e+02, 8.000e+02], [ 5.870e+02, -5.890e+02, -2.000e+02], [ 5.870e+02, -5.890e+02, 8.000e+02], [ 1.028e+03, -5.890e+02, -2.000e+02], [ 1.028e+03, -5.890e+02, 8.000e+02], [ 1.910e+03, -5.890e+02, -2.000e+02], [ 1.910e+03, -5.890e+02, 8.000e+02], [-1.912e+03, -2.950e+02, -2.000e+02], [-1.912e+03, -2.950e+02, 8.000e+02], [-1.030e+03, -2.950e+02, -2.000e+02], [-1.030e+03, -2.950e+02, 8.000e+02], [-5.890e+02, -2.950e+02, -2.000e+02], [-5.890e+02, -2.950e+02, 8.000e+02], [-2.950e+02, -2.950e+02, -2.000e+02], [-2.950e+02, -2.950e+02, 8.000e+02], [-1.000e+00, -2.950e+02, -2.000e+02], [-1.000e+00, -2.950e+02, 8.000e+02], [ 2.930e+02, -2.950e+02, -2.000e+02], [ 2.930e+02, -2.950e+02, 8.000e+02], [ 5.870e+02, -2.950e+02, -2.000e+02], [ 5.870e+02, -2.950e+02, 8.000e+02], [ 1.028e+03, -2.950e+02, -2.000e+02], [ 1.028e+03, -2.950e+02, 8.000e+02], [ 1.910e+03, -2.950e+02, -2.000e+02], [ 1.910e+03, -2.950e+02, 8.000e+02], [-1.912e+03, -1.000e+00, -2.000e+02], [-1.912e+03, -1.000e+00, 8.000e+02], [-1.030e+03, -1.000e+00, -2.000e+02], [-1.030e+03, -1.000e+00, 8.000e+02], [-5.890e+02, -1.000e+00, -2.000e+02], [-5.890e+02, -1.000e+00, 8.000e+02], [-2.950e+02, -1.000e+00, -2.000e+02], [-2.950e+02, -1.000e+00, 8.000e+02], [-1.000e+00, -1.000e+00, -2.000e+02], [-1.000e+00, -1.000e+00, 8.000e+02], [ 2.930e+02, -1.000e+00, -2.000e+02], [ 2.930e+02, -1.000e+00, 8.000e+02], [ 5.870e+02, -1.000e+00, -2.000e+02], [ 5.870e+02, -1.000e+00, 8.000e+02], [ 1.028e+03, -1.000e+00, -2.000e+02], [ 1.028e+03, -1.000e+00, 8.000e+02], [ 1.910e+03, -1.000e+00, -2.000e+02], [ 1.910e+03, -1.000e+00, 8.000e+02], [-1.912e+03, 2.930e+02, -2.000e+02], [-1.912e+03, 2.930e+02, 8.000e+02], [-1.030e+03, 2.930e+02, -2.000e+02], [-1.030e+03, 2.930e+02, 8.000e+02], [-5.890e+02, 2.930e+02, -2.000e+02], [-5.890e+02, 2.930e+02, 8.000e+02], [-2.950e+02, 2.930e+02, -2.000e+02], [-2.950e+02, 2.930e+02, 8.000e+02], [-1.000e+00, 2.930e+02, -2.000e+02], [-1.000e+00, 2.930e+02, 8.000e+02], [ 2.930e+02, 2.930e+02, -2.000e+02], [ 2.930e+02, 2.930e+02, 8.000e+02], [ 5.870e+02, 2.930e+02, -2.000e+02], [ 5.870e+02, 2.930e+02, 8.000e+02], [ 1.028e+03, 2.930e+02, -2.000e+02], [ 1.028e+03, 2.930e+02, 8.000e+02], [ 1.910e+03, 2.930e+02, -2.000e+02], [ 1.910e+03, 2.930e+02, 8.000e+02], [-1.912e+03, 5.870e+02, -2.000e+02], [-1.912e+03, 5.870e+02, 8.000e+02], [-1.030e+03, 5.870e+02, -2.000e+02], [-1.030e+03, 5.870e+02, 8.000e+02], [-5.890e+02, 5.870e+02, -2.000e+02], [-5.890e+02, 5.870e+02, 8.000e+02], [-2.950e+02, 5.870e+02, -2.000e+02], [-2.950e+02, 5.870e+02, 8.000e+02], [-1.000e+00, 5.870e+02, -2.000e+02], [-1.000e+00, 5.870e+02, 8.000e+02], [ 2.930e+02, 5.870e+02, -2.000e+02], [ 2.930e+02, 5.870e+02, 8.000e+02], [ 5.870e+02, 5.870e+02, -2.000e+02], [ 5.870e+02, 5.870e+02, 8.000e+02], [ 1.028e+03, 5.870e+02, -2.000e+02], [ 1.028e+03, 5.870e+02, 8.000e+02], [ 1.910e+03, 5.870e+02, -2.000e+02], [ 1.910e+03, 5.870e+02, 8.000e+02], [-1.912e+03, 1.028e+03, -2.000e+02], [-1.912e+03, 1.028e+03, 8.000e+02], [-1.030e+03, 1.028e+03, -2.000e+02], [-1.030e+03, 1.028e+03, 8.000e+02], [-5.890e+02, 1.028e+03, -2.000e+02], [-5.890e+02, 1.028e+03, 8.000e+02], [-2.950e+02, 1.028e+03, -2.000e+02], [-2.950e+02, 1.028e+03, 8.000e+02], [-1.000e+00, 1.028e+03, -2.000e+02], [-1.000e+00, 1.028e+03, 8.000e+02], [ 2.930e+02, 1.028e+03, -2.000e+02], [ 2.930e+02, 1.028e+03, 8.000e+02], [ 5.870e+02, 1.028e+03, -2.000e+02], [ 5.870e+02, 1.028e+03, 8.000e+02], [ 1.028e+03, 1.028e+03, -2.000e+02], [ 1.028e+03, 1.028e+03, 8.000e+02], [ 1.910e+03, 1.028e+03, -2.000e+02], [ 1.910e+03, 1.028e+03, 8.000e+02], [-1.912e+03, 1.910e+03, -2.000e+02], [-1.912e+03, 1.910e+03, 8.000e+02], [-1.030e+03, 1.910e+03, -2.000e+02], [-1.030e+03, 1.910e+03, 8.000e+02], [-5.890e+02, 1.910e+03, -2.000e+02], [-5.890e+02, 1.910e+03, 8.000e+02], [-2.950e+02, 1.910e+03, -2.000e+02], [-2.950e+02, 1.910e+03, 8.000e+02], [-1.000e+00, 1.910e+03, -2.000e+02], [-1.000e+00, 1.910e+03, 8.000e+02], [ 2.930e+02, 1.910e+03, -2.000e+02], [ 2.930e+02, 1.910e+03, 8.000e+02], [ 5.870e+02, 1.910e+03, -2.000e+02], [ 5.870e+02, 1.910e+03, 8.000e+02], [ 1.028e+03, 1.910e+03, -2.000e+02], [ 1.028e+03, 1.910e+03, 8.000e+02], [ 1.910e+03, 1.910e+03, -2.000e+02], [ 1.910e+03, 1.910e+03, 8.000e+02]])  Example code: import pyvista as pv import numpy as np from points import points mesh = pv.read("mesh.vtk") mesh.set_active_scalars('Resistivity[Ohm-m]') pointset = pv.PointSet(points) pointset_sample = pointset.sample(mesh) print(pointset_sample.point_data['vtkValidPointMask']) plot = pv.Plotter() plot.add_mesh(pointset_sample, scalars = 'Resistivity[Ohm-m]', cmap = 'turbo_r', render_points_as_spheres=True, point_size=20, log_scale=True, clim=[5e0, 5e2]) plot.add_mesh(mesh, scalars = 'Resistivity[Ohm-m]', cmap = 'turbo_r', opacity=0.3, show_edges=True, line_width=2, edge_opacity=1.0, log_scale=True, clim=[5e0, 5e2]) plot.show()  This results in this plot, where the 12 points that are missed in this example are on the red end of the color ramp, while all others are in agreement with the cells that contain them and are either green or purple, and a vtkValidPointMask of: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] What is causing some points to fail sampling an enclosing mesh? How do I prevent points from failing to sample an enclosing mesh?
I can reproduce your issue and I don't know why it happens, but frankly I've never quite understood the subtleties of sample/probe/interpolate and friends, despite multiple attempts of more knowledgeable people to explain these to me :) So I also don't know if any of the other similar filters could be applicable. It might be worth opening an issue for. What I do know is that mesh.find_closest_cell() seems to work fine for your example. Since you just want to pick out the constant cell scalar for each point (at least based on your example), you can find the closest cell to each point and query the cell data. This might be feasible depending on the size of your actual problem. Here's the corresponding change: import pyvista as pv import numpy as np from points import points mesh = pv.read("mesh.vtk") mesh.set_active_scalars('Resistivity[Ohm-m]') pointset = pv.PointSet(points) closest_cell_inds = mesh.find_closest_cell(points) pointset['Resistivity[Ohm-m]'] = mesh.cell_data['Resistivity[Ohm-m]'][closest_cell_inds] plot = pv.Plotter() plot.add_mesh(pointset, scalars='Resistivity[Ohm-m]', cmap='turbo_r', render_points_as_spheres=True, point_size=20, log_scale=True, clim=[5e0, 5e2]) plot.add_mesh(mesh, scalars='Resistivity[Ohm-m]', cmap='turbo_r', opacity=0.3, show_edges=True, line_width=2, edge_opacity=1.0, log_scale=True, clim=[5e0, 5e2]) plot.show()  Some interactive work on your original sampled data shows that this does the right thing: >>> closest_cell_inds = mesh.find_closest_cell(pointset_sample.points) >>> sampling_works = pointset_sample['Resistivity[Ohm-m]'] == mesh.cell_data['Resistivity[Ohm-m]'][closest_cell_inds] >>> sampling_works pyvista_ndarray([ True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True]) >>> (sampling_works == pointset_sample['vtkValidPointMask']).all() np.True_ 