OSOceanAcoustics / echopype

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

[File conversion] No parser available for type MRU version 1 #1239

Closed jmjech closed 9 months ago

jmjech commented 10 months ago

General description of problem

Required I have EK80 files collected within the past month using a Kongsberg WBT Tube that give me an error when I attempt to convert from .raw to .nc4. Data were collected on the uncrewed surface vehicle, Drix.

Computing environment

Required

Minimum example

Required: A minimum code snippet that reproduces your problem. The following code reproduces the errors I encountered:

import echopype as ep
from echopype import open_raw
from pathlib import Path
filename = Path('/home/mjech/Desktop/WindDevelopment/EK80_Data/2023120_BIWF_WTG-3_Spiral-D20231021-T003735.raw')
filelist = [filename]
EKmodel = 'EK80'   #EK60
for f in filelist:
    ed = open_raw(str(f), sonar_model=EKmodel)

Error message printouts

Required: Copy-paste the entire error messages you encounter here. Below is the error messages I received when running the above code:

In [3]: %run Convert_EK80-to-netCDF.py
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/NOAA_Gdrive/sonarpros/Python_Programs/EK_ES/Convert_EK80-to-netCDF.py in <module>
     93 # convert each to netCDF4
     94 for f in filelist:
---> 95     ed = open_raw(str(f), sonar_model=EKmodel)
     96     # Henry B. Bigelow ICES code is 33HH
     97     ed['Platform']['platform_name'] = 'Drix18'

~/.local/lib/python3.10/site-packages/echopype/utils/prov.py in inner(*args, **kwargs)
    235             @functools.wraps(func)
    236             def inner(*args, **kwargs):
--> 237                 dataobj = func(*args, **kwargs)
    238                 if is_echodata:
    239                     ed = dataobj

~/.local/lib/python3.10/site-packages/echopype/convert/api.py in open_raw(raw_file, sonar_model, xml_path, convert_params, storage_options, use_swap, max_chunk_size)
    421     )
    422     # Actually parse the raw datagrams from source file
--> 423     parser.parse_raw()
    424 
    425     # Direct offload to zarr and rectangularization only available for some sonar models

~/.local/lib/python3.10/site-packages/echopype/convert/parse_base.py in parse_raw(self)
    367 
    368             # Read the rest of datagrams
--> 369             self._read_datagrams(fid)
    370 
    371         # Convert ping time to 1D numpy array, stored in dict indexed by channel,

~/.local/lib/python3.10/site-packages/echopype/convert/parse_base.py in _read_datagrams(self, fid)
    452                 #  when users only want CONFIG or ENV, but the way this is implemented
    453                 #  the raw0/3 datagrams are still parsed, you are just not saving them
--> 454                 new_datagram = fid.read(1)
    455 
    456             except SimradEOF:

~/.local/lib/python3.10/site-packages/echopype/convert/utils/ek_raw_io.py in read(self, k)
    434         if k == 1:
    435             try:
--> 436                 return self._read_next_dgram()
    437             except Exception:
    438                 if self.at_eof():

~/.local/lib/python3.10/site-packages/echopype/convert/utils/ek_raw_io.py in _read_next_dgram(self)
    344             return raw_dgram
    345         else:
--> 346             nice_dgram = self._convert_raw_datagram(raw_dgram, bytes_read)
    347             self._current_dgram_offset += 1
    348             return nice_dgram

~/.local/lib/python3.10/site-packages/echopype/convert/utils/ek_raw_io.py in _convert_raw_datagram(self, raw_datagram_string, bytes_read)
    373             return raw_datagram_string
    374 
--> 375         nice_dgram = parser.from_string(raw_datagram_string, bytes_read)
    376         return nice_dgram
    377 

~/.local/lib/python3.10/site-packages/echopype/convert/utils/ek_raw_parsers.py in from_string(self, raw_string, bytes_read)
     78         if sys.version_info.major > 2:
     79             header = header.decode()
---> 80         id_, version = self.validate_data_header(header)
     81         return self._unpack_contents(raw_string, bytes_read, version=version)
     82 

~/.local/lib/python3.10/site-packages/echopype/convert/utils/ek_raw_parsers.py in validate_data_header(self, data)
     70 
     71         if version not in self._versions:
---> 72             raise ValueError("No parser available for type %s version %d" % (self._id, version))
     73 
     74         return type_, version

ValueError: No parser available for type MRU version 1

Provide an example file

Required: An example file that allow reproducing the problem.

Please e-mail for a link to the data file, ~200 MB. michael.jech@noaa.gov

Troubleshooting

Optional but preferred: Explain any steps that you have taken to identify the cause of conversion error. I attempted to follow the different programs/scripts, but it seems to be some missing capability.

leewujung commented 10 months ago

Thanks @jmjech ! We'll add this to the parser.

Ref: https://www.simrad.online/ek80/interface/ek80_interface_en_us.pdf#page=162

jmjech commented 9 months ago

I e-mailed a 2MB file to Wu-Jung. Let me know if it works for you. I have a few other "smaller" files.