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

Modify Nortek Signature parser logic to handle ad2cp/mat and OceanContour nc/mat #775

Open
sspagnol opened this issue Feb 18, 2022 · 1 comment
Labels
Unit:Instrument Reader Instrument parsers and related
Milestone

Comments

@sspagnol
Copy link
Contributor

Maybe I'm missing something, but when when I'm loading a Nortek signature file, since the insrument is identified as a Nortek Signature then the toolbox wants to use signatureParser. This obviously does not work for OceanContour processed and exported file. If I'm missing something obvious to do this please let me know, otherwise...

Could signatureParser code be split out to say AD2CP.ad2cp_reader and AD2CP.mat_reader (this code pulled out from current large case statements) and the logic be rewritten like

if ~iscellstr(filename), error('filename must be a cell array of strings'); end

% only one file supported
filename = filename{1};
[~, ~, ext] = fileparts(filename);

switch lower(ext)
   case '.ad2cp'
      sample_data = AD2CP.ad2cp_reader(filename);
   case '.nc'
      sample_data = sample_data = OceanContour.readOceanContourFile(filename);
   case '.mat'
      % some test to determine if OceanContour mat file or SignatureViewer mat file, this might involve loading the structure,
      % in which case maybe pass the structure to below functions rather than filename
      is_ocean_contour_matfile = <some test to determine if OceanContour mat file or SignatureViewer mat file>
      if is_ocean_contour_matfile 
         sample_data = AD2CP.mat_reader(filename);
      else
         sample_data = sample_data = OceanContour.readOceanContourFile(filename);
      end
    otherwise
        error('Data format not supported');
@hugo-sardi
Copy link

have you tried to update the instruments.txt file and check if the instrument name matches the ones in there?
I got something like:

NORTEK, Signature 1000, oceanContour
NORTEK, Signature 500, oceanContour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unit:Instrument Reader Instrument parsers and related
Projects
None yet
Development

No branches or pull requests

3 participants