MHKiT-MATLAB icon indicating copy to clipboard operation
MHKiT-MATLAB copied to clipboard

Dolfyn: dolfyn_read is slow relative to MHKiT-Python

Open simmsa opened this issue 5 months ago • 0 comments

Reading an original binary ADCP file is slow in MHKiT-MATLAB.

In examples/adcp_example.m:

ds = dolfyn_read('data/dolfyn/Sig1000_tidal.ad2cp');

Yields:

  Reading binary data...
Reading file data/dolfyn/Sig1000_tidal.ad2cp
    Binary read time: 62.498 seconds
  Post-processing...
    sci_data time: 0.033 seconds
    reorg time: 0.099 seconds
    reduce time: 0.008 seconds

The bulk of the read time is in reading the raw ADCP data

For comparison this code in MHKiT-Python:

import time

from mhkit import dolfyn

start_time = time.perf_counter()

ds = dolfyn.read("data/dolfyn/Sig1000_tidal.ad2cp")

end_time = time.perf_counter()

print(f"dolfyn.read execution time: {end_time - start_time:.4f} seconds")

Yields:

Reading file data/dolfyn/Sig1000_tidal.ad2cp ...
dolfyn.read execution time: 3.2022 seconds

This needs further investigation. In general MHKiT-MATLAB should use a similar read strategy as MHKiT-Python. We should leverage the MHKiT-Python repo and code to investigate this issue.

simmsa avatar Sep 09 '25 16:09 simmsa