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

Ask for help to run the code successfully #2

Open
HarDLy-nnu opened this issue Feb 10, 2025 · 3 comments
Open

Ask for help to run the code successfully #2

HarDLy-nnu opened this issue Feb 10, 2025 · 3 comments

Comments

@HarDLy-nnu
Copy link

My goal is to process NEON's waveform data with pywaves and perform further analysis. I created a main.py to call base.py according to the guidance in readme. The base.py has not been modified. The code of main.py is as follows:

import base as pw
pulsewave = pw.openPLS(r"D:\...\NEON_D01_HARV_DP1_L001-1_2019081112_1.pls")
wave = pulsewave.get_waves(0)
wave.plot()

But then I received the following error:

Traceback (most recent call last):
  File "D:\...\pypwaves\main.py", line 4, in <module>
    pulsewave = pw.openPLS(r"D:\...\NEON_D01_HARV_DP1_L001-1_2019081112_1.pls")
  File "D:\...\pypwaves\base.py", line 211, in openPLS
    return PulseWaves(filename)
  File "D:\...\pypwaves\base.py", line 20, in __init__
    self.file_sig = "".join(struct.unpack("c"*16, pulsebinary.read(16))).strip("\x00")
TypeError: sequence item 0: expected str instance, bytes found

The pywaves has been tested with NEON's waveform lidar data, so I think it's my problem, but I have limited knowledge of python and can't solve this problem independently, I would be very grateful if anyone can help me with this problem.

@Rheinwalt
Copy link

I vaguely remember that I had a similar problem, basically because of a different Python version. Maybe you can test my fork at https://github.com/Rheinwalt/pulsewaves and report back?

@HarDLy-nnu
Copy link
Author

I vaguely remember that I had a similar problem, basically because of a different Python version. Maybe you can test my fork at https://github.com/Rheinwalt/pulsewaves and report back?

Thank you very much for the code you provided, it runs successfully. I truly appreciate your help. I have an additional question, if you don't mind. Following your example, I plotted some waveform data as elevation vs. amplitude graph. However, I am not sure what the amplitude represents. Is it the echo intensity? Also, I noticed that it doesn't start from 0. In my example, the minimum value is around 200. Could you kindly explain why this is the case?

@HarDLy-nnu
Copy link
Author

I vaguely remember that I had a similar problem, basically because of a different Python version. Maybe you can test my fork at https://github.com/Rheinwalt/pulsewaves and report back?

I hope you are doing well. Thanks for your help, I successfully read NEON's waveform data, and I also know why the amplitude is almost greater than 200, mainly because of noise. But recently I have encountered a bug. When I try to read a waveform of JERC in Line L006-1 in 2019, I received the following error:

  File "D:\...\pulsewaves-master\pulsewaves.py", line 84, in __init__
    vlr.record = f.read(vlr.record_length).decode("utf-8").strip("\x00")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 26: invalid start byte

But before that, I did use this code to read a waveform of HARV normally. I don't know how to debug or avoid this bug. Can you give me some help?

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