Skip to content

🐛[BUG]: XAeronet-V Prepocessor.py do not work for 'vtp' files #1262

@MarcoDeTommasi

Description

@MarcoDeTommasi

Version

nvidia-physicsnemo==1.0.1

On which installation method(s) does this occur?

Pip

Describe the issue

I'm trying to run the code example of "preprocessor.py" but if i chose the "vtp" for "surface_mesh_file_format", the funcion

process_directory

is meant for replace the .vtp into .vtu implying that the name file is the same, but for the driveraerML dataset have files "volume_i.vtu" and "boundary_i.vtp" for each "run_i" dir so the code cannot work properly

def process_directory(
    data_path,
    output_base_path,
    grid_size,
    bounds=None,
    surface_mesh_file_format="stl",
    num_workers=16,
    save_vti=False,
):
    """Process all VTU and VTP files in the given directory using multiprocessing with progress tracking."""
    tasks = []
    print(f"Scanning directory: {data_path}")
    for root, _, files in os.walk(data_path):
        print(f"Scanning directory: {root}")
        print(f"Files found: {files}")
        vtu_files = [f for f in files if f.endswith(".vtu")]
        for vtu_file in vtu_files:
            print(f"Processing VTU file: {vtu_file}")
            vtu_path = os.path.join(root, vtu_file)
            print(f"Full VTU path: {vtu_path}")
            if surface_mesh_file_format == "vtp":
                surface_mesh_path = vtu_path.replace(".vtu", ".vtp")
            elif surface_mesh_file_format == "stl":
                vtu_id = vtu_file[len("volume_") : -len(".vtu")]  # Extract the ID part
                surface_mesh_file = f"ahmed_{vtu_id}.stl"
                surface_mesh_path = os.path.join(root, surface_mesh_file)
            else:
                raise ValueError(
                    f"Unsupported surface mesh file format: {surface_mesh_file_format}"
                )

            if os.path.exists(surface_mesh_path):
                print(f"Found surface mesh file: {surface_mesh_path}")
                relative_path = os.path.relpath(root, data_path)
                output_dir = os.path.join(output_base_path, relative_path)
                tasks.append(
                    (
                        vtu_path,
                        surface_mesh_path,
                        grid_size,
                        bounds,
                        output_dir,
                        surface_mesh_file_format,
                        save_vti,
                    )
                )
            else:
                print(
                    f"Warning: Corresponding surface mesh file not found for {vtu_path}"
                )

Minimum reproducible example

Relevant log output

Environment details

Metadata

Metadata

Assignees

No one assigned

    Labels

    ? - Needs TriageNeed team to review and classifybugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions