Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filters.python produces incorrect JSON metadata #3866

Open
bacek opened this issue Sep 19, 2022 · 2 comments
Open

filters.python produces incorrect JSON metadata #3866

bacek opened this issue Sep 19, 2022 · 2 comments

Comments

@bacek
Copy link
Contributor

bacek commented Sep 19, 2022

Describe the bug
Running pdal pipeline with filters.python produces incorrect JSON metadata.

$ pdal -v 8 pipeline --metadata m2.json pl2.json 
(PDAL Debug) Debugging...
(pdal pipeline Debug) Attempting to load plugin '/usr/local/lib/libpdal_plugin_filter_python.so'.
(pdal pipeline Debug) Loaded plugin '/usr/local/lib/libpdal_plugin_filter_python.so'.
(pdal pipeline Debug) Initialized plugin '/usr/local/lib/libpdal_plugin_filter_python.so'.
(pdal pipeline Debug) Executing pipeline in standard mode.
(pdal pipeline filters.python Debug) 					filters.python source=[54 bytes], module=foo, function=foo
 processing 0 points.
Hello
(pdal pipeline writers.las Debug) Wrote 0 points to the LAS file

Dummy pipepline with 2 inputs.

[
  "empty.laz",
  "empty.laz",
  {
    "type": "filters.merge"
  },
  {
    "type": "filters.python",
    "script": "./foo.py",
    "function": "foo",
    "module": "foo"
  },
  "out.laz"
]

$ cat foo.py
def foo(ins,outs):
    print("Hello")
    return True

Validating:
stages->filters.python software_id and system_id are not quoted.

jq . < m2.json 
parse error: Invalid numeric literal at line 19, column 57

$ cat m2.json
cat m2.json 
{
  "stages":
  {
    "filters.merge":
    {
    },
    "filters.python":
    {
      "creation_doy": 143,
      "creation_year": 2021,
      "dataformat_id": 3,
      "filesource_id": 42493,
      "global_encoding": 0,
      "major_version": 1,
      "minor_version": 2,
      "offset_x": 0,
      "offset_y": 0,
      "offset_z": 0,
      "project_id": 00000000-0000-0000-0000-000000000000,
      "readers.las":
      [
        {
        },
        {
        }
      ],
      "root":
      {
      },
      "scale_x": 0.01,
      "scale_y": 0.01,
      "scale_z": 0.01,
      "software_id": PDAL 2.1.0 (810b3c),
      "srs":
      [
        {
        },
        {
        }
      ],
      "system_id": PDAL,
      "units":
      [
        {
        },
        {
        }
      ],
      "vlr_0":
      [
        {
        },
        {
        }
      ]
    },
    "readers.las":
    [
      {
        "comp_spatialreference": "",
        "compressed": true,
        "count": 0,
        "creation_doy": 143,
        "creation_doy":         {
          "temp": 143
        },
        "creation_year": 2021,
        "creation_year":         {
          "temp": 2021
        },
        "dataformat_id": 3,
        "dataformat_id":         {
          "temp": 3
        },
        "dataoffset": 333,
        "filesource_id": 42493,
        "filesource_id":         {
          "temp": 42493
        },
        "global_encoding": 0,
        "global_encoding":         {
          "temp": 0
        },
        "global_encoding_base64": "AAA=",
        "gtiff": "",
        "header_size": 227,
        "major_version": 1,
        "major_version":         {
          "temp": 1
        },
        "maxx": -1.797693135e+308,
        "maxy": -1.797693135e+308,
        "maxz": -1.797693135e+308,
        "minor_version": 2,
        "minor_version":         {
          "temp": 2
        },
        "minx": 1.797693135e+308,
        "miny": 1.797693135e+308,
        "minz": 1.797693135e+308,
        "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": "PDAL 2.1.0 (810b3c)",
        "software_id":         {
          "temp": "PDAL 2.1.0 (810b3c)"
        },
        "spatialreference": "",
        "srs":
        {
          "compoundwkt": "",
          "horizontal": "",
          "isgeocentric": false,
          "isgeographic": false,
          "prettycompoundwkt": "",
          "prettywkt": "",
          "proj4": "",
          "units":
          {
            "horizontal": "unknown",
            "vertical": ""
          },
          "vertical": "",
          "wkt": ""
        },
        "system_id": "PDAL",
        "system_id":         {
          "temp": "PDAL"
        },
        "vlr_0":
        {
          "data": "AgAAAAMEAwAAAAAAUMMAAP////////////////////8DAAYAFAACAAcACAACAAgABgACAA==",
          "description": "http://laszip.org",
          "record_id": 22204,
          "user_id": "laszip encoded"
        }
      },
      {
        "comp_spatialreference": "",
        "compressed": true,
        "count": 0,
        "creation_doy": 143,
        "creation_year": 2021,
        "dataformat_id": 3,
        "dataoffset": 333,
        "filesource_id": 42493,
        "global_encoding": 0,
        "global_encoding_base64": "AAA=",
        "gtiff": "",
        "header_size": 227,
        "major_version": 1,
        "maxx": -1.797693135e+308,
        "maxy": -1.797693135e+308,
        "maxz": -1.797693135e+308,
        "minor_version": 2,
        "minx": 1.797693135e+308,
        "miny": 1.797693135e+308,
        "minz": 1.797693135e+308,
        "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": "PDAL 2.1.0 (810b3c)",
        "spatialreference": "",
        "srs":
        {
          "compoundwkt": "",
          "horizontal": "",
          "isgeocentric": false,
          "isgeographic": false,
          "prettycompoundwkt": "",
          "prettywkt": "",
          "proj4": "",
          "units":
          {
            "horizontal": "unknown",
            "vertical": ""
          },
          "vertical": "",
          "wkt": ""
        },
        "system_id": "PDAL",
        "vlr_0":
        {
          "data": "AgAAAAMEAwAAAAAAUMMAAP////////////////////8DAAYAFAACAAcACAACAAgABgACAA==",
          "description": "http://laszip.org",
          "record_id": 22204,
          "user_id": "laszip encoded"
        }
      }
    ],
    "writers.las":
    {
      "count": 0,
      "filename":
      [
        "out.laz"
      ],
      "maxx": -1.797693135e+308,
      "maxy": -1.797693135e+308,
      "maxz": -1.797693135e+308,
      "minx": 1.797693135e+308,
      "miny": 1.797693135e+308,
      "minz": 1.797693135e+308
    }
  }
}

Expected behavior
Generated JSON is valid.

System/installation information:
Please provide information on your PDAL version (pdal --version) and system (e.g., uname -a or ver).

$ uname -a
Linux sunburst 5.18.0-0.deb11.4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-1~bpo11+1 (2022-08-12) x86_64 GNU/Linux

$ pdal --version
pdal 2.3.0 (git-version: <plp l)

@hobu
Copy link
Member

hobu commented Dec 6, 2022

This does not happen for me with 2.4-maintenance or the master branch of PDAL. I wasn't using an empty.laz, however. Is that a key part of this?

Also, the JSON sure looks funky even if it is valid 😦

@bacek
Copy link
Contributor Author

bacek commented Dec 11, 2022

You need "empty.laz" (or any other las file with software_id) to get broken JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants