ubarsc / pylidar

A set of Python modules which makes it easy to write lidar processing code in Python
http://www.pylidar.org
GNU General Public License v3.0
15 stars 11 forks source link

Cannot open same SPDV4 file twice in one program #8

Closed gillins closed 7 years ago

gillins commented 7 years ago

Original report by Neil Flood (Bitbucket: neilflood, GitHub: neilflood).


It seems there is some mysterious state information being preserved between calls to lidarprocessor.doProcessing(), within the SPDV4 driver and/or the h5py libraries.

The attached program pylidarFileCloseBug.py demonstrates the problem. It runs two successive processes which operate on the same file. The intention is situations where a first pass through a file is required to calculate some numbers, then a second pass through to update a field with the resulting values. In this small example, we just read some points and do nothing.

The first pass opens the file with READ mode, and works fine. The second pass opens with UPDATE, and fails. If both passes use the same mode (either READ or UPDATE), they both succeed.

I do not know whether the problem is in h5py or pylidar, but it is not purely an h5py problem, because the attached h5py fragment pureH5py.py works fine.

It does not modify the file (as shown by the file modification times), so it is internal to the program, not in the file itself.

I was testing this on the latest tip in the repository (fbea23379b02 - dated Sun Nov 27 15:14:44 2016 +1000).

Any thoughts?

gillins commented 7 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


Hi Neil,

Works fine for me here, but could be something to do with the file. Does it work for other files? I may need the actual file in question to do a proper check.

Sam.

gillins commented 7 years ago

Original comment by Neil Flood (Bitbucket: neilflood, GitHub: neilflood).


The problem went away when I upgraded h5py to version 2.6.0. Previously I was using 2.1.0. Very mysterious, but not worth pursuing further.