Skip to content

filters.python produces broken metadata when 2 or more files processed #87

@bacek

Description

@bacek

When running pdal pipeline with filters.python inside and requesting metadata output is broken by unquoted string values.

Example pipeline:

[
  {
    "type": "readers.las",
    "filename": "1.2-with-color.las"
  },
  {
    "type": "readers.las",
    "filename": "1.2-with-color.las"
  },
  {
    "type": "filters.python",
    "source": "def foo(ins, outs):\n    return True",
    "module": "anything",
    "function": "foo"
  },
  {
    "type": "writers.las",
    "filename": "/tmp/out.laz"
  }
]

Run:

pdal -v 8 pipeline --metadata m.json pl.json 

(PDAL Debug) Debugging...
(pdal pipeline Debug) Attempting to load plugin '/home/bacek/miniconda3/envs/pdal-clean/lib/python3.8/site-packages/lib/libpdal_plugin_filter_python.so'.
(pdal pipeline Debug) Loaded plugin '/home/bacek/miniconda3/envs/pdal-clean/lib/python3.8/site-packages/lib/libpdal_plugin_filter_python.so'.
(pdal pipeline Debug) Initialized plugin '/home/bacek/miniconda3/envs/pdal-clean/lib/python3.8/site-packages/lib/libpdal_plugin_filter_python.so'.
(pdal pipeline Debug) Executing pipeline in standard mode.
(pdal pipeline filters.python Debug) 					filters.python source=[35 bytes], module=anything, function=foo
 processing 1065 points.
(pdal pipeline filters.python Debug) 					filters.python source=[35 bytes], module=anything, function=foo
 processing 1065 points.
(pdal pipeline writers.las Debug) Wrote 2130 points to the LAS file

Generated metadata:

{
  "stages":
  {
    "filters.python":
    {
      "creation_doy":
      [
        0,
        0
      ],
      "creation_year":
      [
        0,
        0
      ],
      "dataformat_id":
      [
        3,
        3
      ],
      "filesource_id":
      [
        0,
        0
      ],
      "filters.python":
      {
      },
      "global_encoding":
      [
        0,
        0
      ],
      "major_version":
      [
        1,
        1
      ],
      "minor_version":
      [
        2,
        2
      ],
      "offset_x":
      [
        0,
        0
      ],
      "offset_y":
      [
        0,
        0
      ],
      "offset_z":
      [
        0,
        0
      ],
      "project_id":
      [
        00000000-0000-0000-0000-000000000000,
        00000000-0000-0000-0000-000000000000
      ],
      "readers.las":
      [
        {
        },
        {
        },
        {
        },
        {
        }
      ],
      "root":
      [
        {
        },
        {
        }
      ],
      "scale_x":
      [
        0.01,
        0.01
      ],
      "scale_y":
      [
        0.01,
        0.01
      ],
      "scale_z":
      [
        0.01,
        0.01
      ],
      "software_id":
      [
        TerraScan,
        TerraScan
      ],
      "srs":
      [
        {
        },
        {
        },
        {
        },
        {
        }
      ],
      "system_id":
      [
        {
        },
        {
        }
      ],
      "units":
      [
        {
        },
        {
        },
        {
        },
        {
        }
      ]
    },
    "readers.las":
    [
      {
        "comp_spatialreference": "",
        "compressed": false,
        "count": 1065,
        "creation_doy": 0,
        "creation_doy":         {
          "temp": 0
        },
        "creation_year": 0,
        "creation_year":         {
          "temp": 0
        },
        "dataformat_id": 3,
        "dataformat_id":         {
          "temp": 3
        },
        "dataoffset": 229,
        "filesource_id": 0,
        "filesource_id":         {
          "temp": 0
        },
        "global_encoding": 0,
        "global_encoding":         {
          "temp": 0
        },
        "global_encoding_base64": "AAA=",
        "header_size": 227,
        "major_version": 1,
        "major_version":         {
          "temp": 1
        },
        "maxx": 638982.55,
        "maxy": 853535.43,
        "maxz": 586.38,
        "minor_version": 2,
        "minor_version":         {
          "temp": 2
        },
        "minx": 635619.85,
        "miny": 848899.7,
        "minz": 406.59,
        "offset_x": 0,
        "offset_x":         {
          "temp": 0
        },
        "offset_y": 0,
        "offset_y":         {
          "temp": 0
        },
        "offset_z": 0,
        "offset_z":         {
          "temp": 0
        },
        "point_length": 34,
        "project_id": "00000000-0000-0000-0000-000000000000",
        "project_id":         {
          "temp": "00000000-0000-0000-0000-000000000000"
        },
        "scale_x": 0.01,
        "scale_x":         {
          "temp": 0.01
        },
        "scale_y": 0.01,
        "scale_y":         {
          "temp": 0.01
        },
        "scale_z": 0.01,
        "scale_z":         {
          "temp": 0.01
        },
        "software_id": "TerraScan",
        "software_id":         {
          "temp": "TerraScan"
        },
        "spatialreference": "",
        "srs":
        {
          "compoundwkt": "",
          "horizontal": "",
          "isgeocentric": false,
          "isgeographic": false,
          "prettycompoundwkt": "",
          "prettywkt": "",
          "proj4": "",
          "units":
          {
            "horizontal": "unknown",
            "vertical": ""
          },
          "vertical": "",
          "wkt": ""
        },
        "system_id": "",
        "system_id":         {
          "temp": ""
        }
      },
      {
        "comp_spatialreference": "",
        "compressed": false,
        "count": 1065,
        "creation_doy": 0,
        "creation_year": 0,
        "dataformat_id": 3,
        "dataoffset": 229,
        "filesource_id": 0,
        "global_encoding": 0,
        "global_encoding_base64": "AAA=",
        "header_size": 227,
        "major_version": 1,
        "maxx": 638982.55,
        "maxy": 853535.43,
        "maxz": 586.38,
        "minor_version": 2,
        "minx": 635619.85,
        "miny": 848899.7,
        "minz": 406.59,
        "offset_x": 0,
        "offset_y": 0,
        "offset_z": 0,
        "point_length": 34,
        "project_id": "00000000-0000-0000-0000-000000000000",
        "scale_x": 0.01,
        "scale_y": 0.01,
        "scale_z": 0.01,
        "software_id": "TerraScan",
        "spatialreference": "",
        "srs":
        {
          "compoundwkt": "",
          "horizontal": "",
          "isgeocentric": false,
          "isgeographic": false,
          "prettycompoundwkt": "",
          "prettywkt": "",
          "proj4": "",
          "units":
          {
            "horizontal": "unknown",
            "vertical": ""
          },
          "vertical": "",
          "wkt": ""
        },
        "system_id": ""
      }
    ],
    "writers.las":
    {
      "filename":
      [
        "/tmp/out.laz"
      ]
    }
  }
}

stages/filters.python has unquoted strings in project_id and sotfware_id.

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