omf-python icon indicating copy to clipboard operation
omf-python copied to clipboard

failed to load example assets/test_file.omf

Open rminhxm opened this issue 6 years ago • 4 comments

Trying to run this example to load assets/test_file.omf but failed: https://mybinder.org/v2/gh/OpenGeoVis/omfvista/master?filepath=Example.ipynb

Error messages:

Traceback (most recent call last):
  File "Example.py", line 36, in <module>
    proj = omfvista.load_project('assets/test_file.omf')
  File "E:\Python37\lib\site-packages\omfvista\wrapper.py", line 124, in load_project
    return project_to_vtk(project)
  File "E:\Python37\lib\site-packages\omfvista\wrapper.py", line 115, in project_to_vtk
    d = omfvista.wrap(e)
  File "E:\Python37\lib\site-packages\omfvista\wrapper.py", line 103, in wrap
    return wrappers[key](data)
  File "E:\Python37\lib\site-packages\omfvista\pointset.py", line 29, in point_s
et_to_vtk
    points = pse.geometry.vertices
AttributeError: 'PointSetElement' object has no attribute 'geometry'

rminhxm avatar May 21 '19 21:05 rminhxm

Hi @rminhxm - this issue looks like it might be on the omfvista-side rather than the OMF backend (this repository). Could you share a few more details to help me understand what's going wrong in this example?

Where exactly did you download the 'test_file.omf' file?

What is your version of omfvista, omf, and properties?

import omfvista, omf, properties
print('omfvista: ', omfvista.__version__)
print('omf: ', omf.__version__)
print('properties: ', properties.__version__)

banesullivan avatar May 22 '19 03:05 banesullivan

Hi @banesullivan , thanks for looking into this. Here with more info:

  1. The test_file.omf is from this repository.
  2. The output of the versions
omfvista:  0.2.0
omf:  1.0.1
properties:  0.6.0b0

I followed the README guide and install all dependencies with pip.

rminhxm avatar May 22 '19 16:05 rminhxm

Thank you for sharing those details - I have reproduced this issue locally.

This appears to be the result of a change that is present on the master branch of OMF (this repo) which I haven't corrected in omfvista. I'll look in the commit history and see what I can do to update omfvista to reflect most recent changes to OMF

banesullivan avatar May 23 '19 21:05 banesullivan

To generalize this issue (adopted from the docs), the following example is failing when using the master branch of omf:

>>> import numpy as np
>>> import omf
>>>
>>> pts = omf.PointSetElement(
...     name='Random Points',
...     description='Just random points',
...     geometry=omf.PointSetGeometry(
...         vertices=np.random.rand(100, 3)
...     ),
...     data=[
...         omf.ScalarData(
...             name='rand data',
...             array=np.random.rand(100),
...             location='vertices'
...         ),
...         omf.ScalarData(
...             name='More rand data',
...             array=np.random.rand(100),
...             location='vertices'
...         )
...     ],
... )
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
AttributeError: module 'omf' has no attribute 'PointSetGeometry'

Immediate solution... revert to the stable version deployed on PyPI: pip install omf==1.0.1

banesullivan avatar May 23 '19 21:05 banesullivan