Additions to hdr module.#100
Open
IanTBlack wants to merge 3 commits into
Open
Conversation
- Updates file to conform more with PEP8. - Adds typing hints. - Adds non-public functions for seeking software version and parsing an hdr file as a yaml.
Owner
|
Thanks for your contribution. I'll run the workflows, have copilot do an initial review, review it myself, and test against large datasets with variations in the hdr formats. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the hdr module by refactoring the header parser with type hints, adding two helper functions for software‐version extraction and YAML‐based parsing, and supplying three sample .hdr test files covering various formats.
- Added type annotations to
parse_alt_headerandparse_hdr - Introduced
_get_software_versionand_parse_hdrfor YAML parsing - Included three
.hdrtest fixtures spanning old and new header conventions
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ifcb/data/hdr.py | Refactored imports, added PathLike typing, new YAML parsing and version‐extraction functions |
| ifcb/tests/test_files/D20231021T154635_IFCB199.hdr | New sample header (IFCB199, modern keys) |
| ifcb/tests/test_files/D20230521T210245_IFCB174.hdr | New sample header (IFCB174, modern keys) |
| ifcb/tests/test_files/D20190929T185847_IFCB122.hdr | New sample header (IFCB122, legacy keys) |
Comments suppressed due to low confidence (3)
ifcb/data/hdr.py:94
- There are no unit tests for the newly added
_get_software_versionfunction. Consider adding tests to verify correct version extraction across different header formats.
def _get_software_version(hdr_filepath: PathLike) -> str:
ifcb/data/hdr.py:48
- The function
parse_hdrinvokescast(...)from the removedastimport. Please restore theastimport or explicitly definecast(e.g.,from ast import literal_eval as cast) to prevent a NameError.
def parse_hdr(lines: list) -> dict:
ifcb/tests/test_files/D20190929T185847_IFCB122.hdr:103
- The key
TemperatureAdjustappears twice (lines 103 and 104), which can lead to one entry silently overwriting the other when parsed. Please remove the duplicate or consolidate them.
TemperatureAdjust: 0
Owner
|
Again, thanks, and I have a few questions:
|
Owner
|
Also please note that there are already a variety of |
Author
|
Thanks, Joe. I will test this with older .HDR files.
Do you have a particular doc string/typing hint style you would like me to stick to?
…________________________________
From: Joe Futrelle ***@***.***>
Sent: Wednesday, July 2, 2025 5:12:05 AM
To: joefutrelle/pyifcb ***@***.***>
Cc: Black, Ian ***@***.***>; Author ***@***.***>
Subject: Re: [joefutrelle/pyifcb] Additions to hdr module. (PR #100)
[This email originated from outside of OSU. Use caution with links and attachments.]
[https://avatars.githubusercontent.com/u/2365298?s=20&v=4]joefutrelle left a comment (joefutrelle/pyifcb#100)<#100 (comment)>
Also please note that there are already a variety of .hdr files here<https://github.com/joefutrelle/pyifcb/tree/master/ifcb/tests/data/test_data>.
—
Reply to this email directly, view it on GitHub<#100 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGU4ACOFWZVZ2LIGZPRSNYL3GPEBLAVCNFSM6AAAAAB7TVV42GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAMRXGY2DCMJUHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Joe,
I am interested in contributing to pyifcb. In this PR I've updated some of the typing hints and added two functions to the hdr module. One function for discovering the IFCB software version and another for parsing the hdr file as a yaml. I am not familiar with older versions of .hdr files, but if the software version always exists and the .hdr files always act as yaml files, then I think the parsing function could reduced to a few lines. The eventual intention is to be able to use pyifcb in script form with the OOI Raw Data Archive and to make connections with other OOI data products.
I've included three test .hdr files in this PR. Would you mind uploading some other, older .hdr files with different software versions so that I could make sure my changes are compatible and update the PR?
Thanks,
Ian