OSOceanAcoustics / echopype

Enabling interoperability and scalability in ocean sonar data analysis
https://echopype.readthedocs.io/
Apache License 2.0
95 stars 73 forks source link

Error in parsing EK80 config XML #267

Closed DLWangSan closed 3 years ago

DLWangSan commented 3 years ago

Hello, thank you for your open source project. But when I used the demo, I used my own EK80 sonar data, and there was a problem. Only the simplest code in the manual, like:

from echopype import Convert
dc = Convert('test.raw', model='EK80')  # for EK80 file
dc.raw2nc()

but an error occurred:

AttributeError: 'NoneType' object has no attribute 'iter'AttributeError: 'NoneType' object has no attribute 'iter'

the whole output in the window is like:

Traceback (most recent call last):
  File "./test.py", line 13, in <module>
    dc.raw2nc()
  File ".\venv\lib\site-packages\echopype\convert\convertbase.py", line 200, in raw2nc
    self.save(".nc", save_path, combine_opt, overwrite, compress)
  File ".\venv\lib\site-packages\echopype\convert\ek80.py", line 677, in save
    self.load_ek80_raw(file)
  File ".\venv\lib\site-packages\echopype\convert\ek80.py", line 177, in load_ek80_raw
    self.config_datagram = fid.read(1)
  File ".\venv\lib\site-packages\echopype\convert\utils\ek_raw_io.py", line 395, in read
    return self._read_next_dgram()
  File ".\venv\lib\site-packages\echopype\convert\utils\ek_raw_io.py", line 305, in _read_next_dgram
    nice_dgram = self._convert_raw_datagram(raw_dgram, bytes_read)
  File ".\venv\lib\site-packages\echopype\convert\utils\ek_raw_io.py", line 333, in _convert_raw_datagram
    nice_dgram = parser.from_string(raw_datagram_string, bytes_read)
  File ".\venv\lib\site-packages\echopype\convert\utils\ek_raw_parsers.py", line 75, in from_string
    return self._unpack_contents(raw_string, bytes_read, version=version)
  File ".\venv\lib\site-packages\echopype\convert\utils\ek_raw_parsers.py", line 817, in _unpack_contents
    for xducer_ch in xducer.iter('Transducer'):
AttributeError: 'NoneType' object has no attribute 'iter'
21:03:45  converting file: test.raw

thanks!

leewujung commented 3 years ago

@DLWangSan : thanks for reporting this! This is in the parsing of the config XML at the beginning of the data file. It seems that something is not defined in the expected XML string. Could you share an example file so we can take a look what may be going on? There are a few things we added to the dev branch class-redesign that might address the problem you run into, but it is hard to know for sure without seeing the file. Feel free to email me if you don't want to put a link here.

DLWangSan commented 3 years ago

Thank you very much! I have put the sample file in the attachment, please take a look at it, thank you!

------------------ 原始邮件 ------------------ 发件人: "OSOceanAcoustics/echopype" @.>; 发送时间: 2021年3月12日(星期五) 上午10:06 @.>; @.**@.>; 主题: Re: [OSOceanAcoustics/echopype] ERROR in my EK80 data (#267)

@DLWangSan : thanks for reporting this! This is in the parsing of the config XML at the beginning of the data file. It seems that something is not defined in the expected XML string. Could you share an example file so we can take a look what may be going on? There are a few things we added to the dev branch class-redesign that might address the problem you run into, but it is hard to know for sure without seeing the file. Feel free to email me if you don't want to put a link here.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

从QQ邮箱发来的超大附件

fishing-D20160613-T155703.raw (101.20M, 2021年04月11日 10:12 到期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?t=exs_ftn_download&k=33373039dfb59a9d972974761166044b5352090e550753024c00030f054b020755071d000257554957075608075f525d5404015d377b36020844585059011b205307010f075007574c63010c025106574f45514e375b&code=a7097f6d

imranmaj commented 3 years ago

Thank you very much! I have put the sample file in the attachment, please take a look at it, thank you! ------------------ 原始邮件 ------------------ 发件人: "OSOceanAcoustics/echopype" @.>; 发送时间: 2021年3月12日(星期五) 上午10:06 @.>; @.**@.>; 主题: Re: [OSOceanAcoustics/echopype] ERROR in my EK80 data (#267) @DLWangSan : thanks for reporting this! This is in the parsing of the config XML at the beginning of the data file. It seems that something is not defined in the expected XML string. Could you share an example file so we can take a look what may be going on? There are a few things we added to the dev branch class-redesign that might address the problem you run into, but it is hard to know for sure without seeing the file. Feel free to email me if you don't want to put a link here. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. 从QQ邮箱发来的超大附件 fishing-D20160613-T155703.raw (101.20M, 2021年04月11日 10:12 到期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?t=exs_ftn_download&k=33373039dfb59a9d972974761166044b5352090e550753024c00030f054b020755071d000257554957075608075f525d5404015d377b36020844585059011b205307010f075007574c63010c025106574f45514e375b&code=a7097f6d

Hello @DLWangSan, could you please post another download link for the file you were having issues with? The previous one seems to be expired. Thanks!

DLWangSan commented 3 years ago

Hello, here is the link of the data, could you take a look. https://drive.google.com/drive/folders/1YbLqLuhFruXGEd8l5uoVifT1ysZhIkkz?usp=sharing

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年4月17日(星期六) 上午6:08 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [OSOceanAcoustics/echopype] Error in parsing EK80 config XML (#267)

Thank you very much! I have put the sample file in the attachment, please take a look at it, thank you! … ------------------ 原始邮件 ------------------ 发件人: "OSOceanAcoustics/echopype" @.>; 发送时间: 2021年3月12日(星期五) 上午10:06 @.>; @.@.>; 主题: Re: [OSOceanAcoustics/echopype] ERROR in my EK80 data (#267) @DLWangSan : thanks for reporting this! This is in the parsing of the config XML at the beginning of the data file. It seems that something is not defined in the expected XML string. Could you share an example file so we can take a look what may be going on? There are a few things we added to the dev branch class-redesign that might address the problem you run into, but it is hard to know for sure without seeing the file. Feel free to email me if you don't want to put a link here. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. 从QQ邮箱发来的超大附件 fishing-D20160613-T155703.raw (101.20M, 2021年04月11日 10:12 到期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?t=exs_ftn_download&amp;k=33373039dfb59a9d972974761166044b5352090e550753024c00030f054b020755071d000257554957075608075f525d5404015d377b36020844585059011b205307010f075007574c63010c025106574f45514e375b&amp;code=a7097f6d

Hello @DLWangSan, could you please post another download link for the file you were having issues with? The previous one seems to be expired. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

leewujung commented 3 years ago

@DLWangSan : @imranmaj's fix of this problem is in the latest master, but we are not ready to release it formally until we have all the tests and docs updated. In the mean time, you can give it a try by:

from echopype import open_raw
echodata = open_raw(ek80_raw_path, sonar_model="EK80")
echodata.to_netcdf(save_path=output_dir)

Let us know if it works out.

leewujung commented 3 years ago

I think we are ready to close this since @imranmaj already tested using the examples @DLWangSan provided.