Skip to content

adds --riot-csv and --riot-positions to L2 command and riot_csv_writer#34

Closed
s-pearce wants to merge 9 commits intoOSUGliders:mainfrom
s-pearce:riot_csv
Closed

adds --riot-csv and --riot-positions to L2 command and riot_csv_writer#34
s-pearce wants to merge 9 commits intoOSUGliders:mainfrom
s-pearce:riot_csv

Conversation

@s-pearce
Copy link
Copy Markdown
Collaborator

Adds 2 flag options to the l2 processing command.

  1. A --riot-csv filename option which takes a filename/path string, and provided the riot variables are present in the TBD/EBD file provided to the l2 command, will collect the data and write a $riotData formatted CSV file to filename.
  2. A --riot-positions option which if given with the --riot-csv flag, will append depth, lat, and lon position information to the RIOT data CSV file records. Depth, lat, and lon are interpolated to the timestamps that are part of the RIOT acoustic ping ranging data.

Also adds the new file riot_csv_writer which handles the logic of writing the CSV.

Note: The RIOT variables are only available in the L2 data to write to the CSV if they are present in the configuration YAML file given to the -c options of the l2 command. It is required to add them to the configuration file you are using.

@s-pearce
Copy link
Copy Markdown
Collaborator Author

I haven't added any tests yet, but I wanted to get a functional review started so we could use this in next week's shakedown.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional RIOT CSV export support to the L2 processing CLI, including an option to append/interpolate position fields, and introduces a dedicated writer module to generate RIOT $riotData-formatted CSV output.

Changes:

  • Add --riot-csv and --riot-positions flags to the glide l2 command.
  • Introduce src/glide/riot_csv_writer.py to extract RIOT variables from the L2 dataset and write RIOT-formatted CSV.
  • Update .gitignore to ignore PyCharm project metadata.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 9 comments.

File Description
src/glide/riot_csv_writer.py New RIOT CSV writing logic, including optional position interpolation/append.
src/glide/cli.py Adds new l2 flags and calls the RIOT CSV writer after netCDF output is written.
.gitignore Adds an ignore rule intended for PyCharm projects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/glide/cli.py Outdated
Comment thread src/glide/cli.py Outdated
Comment on lines +42 to +43
_log.error("Dataset is missing required RIOT variables")
return
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the dataset is missing RIOT variables, the function logs an error and returns, but the l2 CLI command will still exit successfully even though the user explicitly requested --riot-csv. Consider raising an exception (or having the CLI convert this into a non-zero exit) so this failure mode is actionable and doesn't silently skip output generation.

Suggested change
_log.error("Dataset is missing required RIOT variables")
return
missing_vars = set(riot_vars).difference(set(ds.data_vars))
_log.error(
"Dataset is missing required RIOT variables: %s",
", ".join(sorted(missing_vars)),
)
raise ValueError(
"Dataset is missing required RIOT variables: "
+ ", ".join(sorted(missing_vars))
)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jessecusack , do you want this behavior, for the whole l2 command to fail if the RIOT variables are missing?
I guess it wouldn't matter if it did raise an exception because the netCDF file would have already been written at this point.

Comment thread src/glide/cli.py
@OSUGliders OSUGliders deleted a comment from Copilot AI Mar 12, 2026
@OSUGliders OSUGliders deleted a comment from Copilot AI Mar 12, 2026
@OSUGliders OSUGliders deleted a comment from Copilot AI Mar 12, 2026
@OSUGliders OSUGliders deleted a comment from Copilot AI Mar 12, 2026
@OSUGliders OSUGliders deleted a comment from Copilot AI Mar 12, 2026
@jessecusack
Copy link
Copy Markdown
Contributor

@s-pearce I think that we should include the bottle data in the level 2 output for debugging purposes. However, this will probably generate an error when generating the level 3 binned data. There isn't a robust mechanism for dropping variables during binning (it is hard coded). Binning the acoustic data is meaningless of course. I will create a separate issue to implement more robust variable dropping support.

@jessecusack jessecusack linked an issue Mar 13, 2026 that may be closed by this pull request
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/glide/riot_csv_writer.py Outdated
Comment thread src/glide/riot_csv_writer.py Outdated
Comment thread src/glide/riot_csv_writer.py Outdated
Comment thread src/glide/riot_csv_writer.py Outdated
Comment thread src/glide/riot_csv_writer.py Outdated
Comment thread src/glide/riot_csv_writer.py Outdated
Comment thread src/glide/cli.py
Comment thread src/glide/cli.py
@jessecusack
Copy link
Copy Markdown
Contributor

Incorporated under #37

@s-pearce s-pearce deleted the riot_csv branch March 18, 2026 19:20
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

Successfully merging this pull request may close these issues.

RIOT acoustics

3 participants