Skip to content

[Bug] v.lidar.mcc: topology handling #1712

Description

@baharmon

Name of the addon

v.lidar.mcc

Describe the bug

This addon handles topology differently depending on the minor version. For GRASS version x.<1, this addon will build topology, but for version x.>=1 it will expect z values without topology. This topology handling behavior was written for changes impacting v.patch between 7.0 and 7.1, but could cause inconsistent topology handling for major releases of GRASS (e.g. 8.0, 9.0, etc).

Minor version test sets flags:

    # 7.x requires topology to see z coordinate
    # 7.1 v.patch has flags to use z even without topology
    # see #2433 on Trac and r66822 in Subversion
    build_before_patch = True
    unused, gver_minor, unused = gs.version()["version"].split(".")
    if int(gver_minor) >= 1:
        build_before_patch = False
        # do not expect topology and expect z
        vpatch_flags += "nz"

Minor version test builds topology:

                if build_before_patch:
                    gs.run_command("v.build", map=temp_ng, stderr=nuldev)
                # Patch non-ground points to non-ground output map
                if ng_output_exists:
                    gs.run_command(
                        "v.patch",
                        input=temp_ng,
                        output=ng_output,
                        flags=vpatch_flags,
                        overwrite=True,
                        quiet=True,
                        stderr=nuldev,
                    )

Expected behavior

Consistent handling of topology across major and minor versions. A simple fix would be to set the pre-patch behavior to 7.0-7.<1 rather than x.0-x.<1. A better solution might be removing the version check, adding a flag to expect (or not expect) topology, and adding error handling that suggests trying the flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions