add SofaStream.verify - #138
Conversation
Update reference to sofar example
There was a problem hiding this comment.
Thanks for the effort. I think this is great to have. I suggested a few small changes and to think about a good way to efficiently and comprehesively test the added functionality.
Oh and please already add this to the HISTORY. We do not have a test to enforce this yet but should already start this new best practice.
hoyer-a
left a comment
There was a problem hiding this comment.
Thanks, code looks good and this is a great addition.
I only have a conceptual question, since this would differ from how SofaStream is being used so far.
|
Since this PR proposes a new feature, I've marked it for milestone 1.3.0, not as a patch (bugfix) release |
|
I've implemented all requested changes.
Sure. May I ask if you would consider making a beta release to PyPI with this feature? I want to depend on it in |
f-brinkmann
left a comment
There was a problem hiding this comment.
Thanks, all looks good and very elegant to me now. I only had very few formal and one docstring comment left.
I would be fine with soon releasing this as 1.3 if you rely on this. Do you have a deadline?
| issues : str, None | ||
| Detected issues as a string. None if no issues were detected. Note | ||
| that this is only returned if ``issue_handling='return'``. | ||
| """ |
There was a problem hiding this comment.
Sorry for not havong thought of this before. Can you maybe also add an example, e.g.
| """ | |
| Examples | |
| ---------- | |
| >>> import sofar | |
| >>> | |
| >>> with sofar.SofaStream("path/to/your.sofa") as file: | |
| >>> file.verify() | |
| """ |
| return self._read_open_file_for_verification().verify( | ||
| issue_handling=issue_handling, mode=mode) | ||
|
|
||
| def _read_open_file_for_verification(self): |
There was a problem hiding this comment.
In case we use this to implement more features, maybe a more general name would be better, e.g.
| def _read_open_file_for_verification(self): | |
| def _lazy_read_open_sofa(self): |
| 1.2.3 (2026-02-03) | ||
| ------------------ |
There was a problem hiding this comment.
we will decide the version upon release, please use
| 1.2.3 (2026-02-03) | |
| ------------------ | |
| unreleased | |
| ----------- |
until then
| @@ -1,6 +1,6 @@ | |||
| [project] | |||
| name = "sofar" | |||
| version = "1.2.2" | |||
There was a problem hiding this comment.
Can you merge the current develop into your branch? Since 1.2.3 is already released this looks outdated.
SofaStreamhas noverifymethod. For verification of conventions, one would need to read the entire file into memory which defeats the purpose ofSofaStream. I've added averifymethod to solve that. The method reads everything but the actual numerical data from the (potentially too large for memory).sofainto aSofain-memory object and callsSofa.verify.Changes proposed in this pull request:
SofaStream.verifynp.arraytonp.asarrayinutils.pyto avoid always loading everything into memoryDisclaimer:
I partially used an LLM for the NetCDF4 reading stuff. Local tests seem to work well