Skip to content

Add feature to blank cells based on expression #171

@johnkit

Description

@johnkit

For PFLOTRAN datasets, the MATERIAL_ID array has int32 values indicating the type of cell. Type 0 indicates an inactive cell that should not be visible. We used some custom/hard-coded logic awhile ago to implement this with a ghost cell array, and would like to add some generalized version of this to Pan3D.

Note that, for pflotran, we also had to transpose the blanking array.

    if ADD_BLANKING_ARRAY:
        import numpy as np
        def blank_cell(mat_id):
            return 32 if mat_id < 1 else 0
        vblank_cell = np.vectorize(blank_cell, otypes=[np.uint8])

        # We are presuming blanking doesn't change w/time
        da_mat = ds['Material_ID'][0]
        np_blank = vblank_cell(da_mat).transpose().flatten()  # MUST TRANSPOSE
        grid.cell_data.set_array(np_blank, 'vtkGhostType')

Metadata

Metadata

Assignees

Labels

duplicateThis issue or pull request already exists

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions