PDAL / python

PDAL's Python Support
Other
116 stars 34 forks source link

Error CRITICAL:root:'Pipeline' object has no attribute 'validate' #106

Closed mdupays closed 2 years ago

mdupays commented 2 years ago

When i lauch the script

information = {} information = { "pipeline": [ { "type": "readers.las", "filename": "/home/mdupays/Documents/REPOSITORY/data/pointcloud_ilot75105_1793.las" }, { "type": "filters.stats", "dimensions": "Z" } ] }

import pdal import json import logging

try:

Create json

json_zstats = json.dumps(information, sort_keys=True, indent=4)
pipeline = pdal.Pipeline(json_zstats)
# # Check if our JSON and options were good
#pipeline.validate()
# # Really noisy
#pipeline.loglevel = 8
pipeline.execute()
result = json.loads(pipeline.metadata)
zmin = round(result['metadata']['filters.stats'][0]['statistic'][0]['minimum'],2)
zmax = round(result['metadata']['filters.stats'][0]['statistic'][0]['maximum'],2)
logging.info("To extract the stat of ground's pointcloud")

except Exception as e: logging.critical(e)

This is a message :+1: 'Pipeline' object has no attribute 'validate'

hobu commented 2 years ago

validate() was deprecated last release and removed this release. Simply drop your call to it. Please don't file tickets in both repositories. All python-related tickets, which this one is, should be filed in this repository.

davelajoie commented 2 years ago

Hello! I need to update all my code to remove dependency over .validate() I am trying to understand what is to expect if the json pipeline is somewhat invalid. will it throw an error whenever parsing creating an instance? Pipeline( jsonContent ) or it will throw an error upon execute? Just want to confirm what is the best way to validate json pipeline prior to execution. Although I could test it ( and I will ), but I am thinking of all the corner cases here. Tx again for PDAL! much appreciated!

davelajoie commented 2 years ago

From what I am seeing, properly constructed json content will still allow to create Pipeline() instance, where it will throw an error at .execute()

>>> pdal.Pipeline( '["Yikes"]' ) <pdal.pipeline.Pipeline object at 0x122a24f90>

Just confirming if this is the right way to "detect" an invalid pipeline. tx

abellgithub commented 2 years ago

This is correct.

On Wed, Dec 22, 2021 at 7:11 AM davelajoie @.***> wrote:

From what I am seeing, properly constructed json content will still allow to create Pipeline() instance, where it will throw an error at .execute()

pdal.Pipeline( '["Yikes"]' ) <pdal.pipeline.Pipeline object at 0x122a24f90>

Just confirming if this is the right way to "detect" an invalid pipeline. tx

— Reply to this email directly, view it on GitHub https://github.com/PDAL/python/issues/106#issuecomment-999530608, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKBMMA3725EVM7KQVYCLPTUSG6A3ANCNFSM5I3LRIXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Andrew Bell @.***