Skip to content

Comments

A python library containing a reader and data class for vernier output#218

Draft
EdHone wants to merge 18 commits intoMetOffice:mainfrom
EdHone:py-vernier
Draft

A python library containing a reader and data class for vernier output#218
EdHone wants to merge 18 commits intoMetOffice:mainfrom
EdHone:py-vernier

Conversation

@EdHone
Copy link

@EdHone EdHone commented Feb 10, 2026

Description

This adds a python library with two classes which enable a user to read vernier output into a VernierData class. This class has a simple filter routine which allows a user to extract the calipers that they are interested in, as well as a simple routine to print the averaged output to a timer.txt-like table.
I've also added an example script which demonstrates the usage of these stuctures, along with some example vernier output data.

Linked issues

Closes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • New tests have been added
  • Tests have been modified to accommodate this change

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes, for both debug and optimised builds

@EdHone EdHone marked this pull request as draft February 10, 2026 14:34
@EdHone EdHone self-assigned this Feb 10, 2026
@EdHone EdHone marked this pull request as ready for review February 11, 2026 14:21
@EdHone EdHone marked this pull request as draft February 18, 2026 13:48
cumul_time: list[float]
n_calls: list[int]
name: str

Copy link
Member

Choose a reason for hiding this comment

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

if we're already using numpy, then why are these list[float] rather than np.array?

Copy link
Author

Choose a reason for hiding this comment

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

Numpy append creates a new array each time rather than using an dynamically allocated block of memory, so in short we use list[float] because it's a lot faster to build our dataset this way. We could allocate our data at the beginning but this was still more expensive and a bit clunky so I went down the route of using basic lists.
Performing the single allocation when doing something like np.mean(timers.data['timestep_alg'].total_time) is really cheap, but we do miss out on the nice functionality of being able to just perform timers.data['timestep_alg'].total_time.mean(). We could probably implement a solution that captures the best of both worlds in the future.

Copy link
Member

@mo-marqh mo-marqh left a comment

Choose a reason for hiding this comment

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

coding standards; prefer newline at end of each file

@EdHone
Copy link
Author

EdHone commented Feb 20, 2026

coding standards; prefer newline at end of each file

Fixed in commit 68a901

@EdHone EdHone requested a review from mo-marqh February 20, 2026 13:59
@EdHone
Copy link
Author

EdHone commented Feb 20, 2026

Open questions:

  • How should the data be presented in the txt output?
    • Are we missing max/min?
  • Should aggregate be exposed to users of the library?
  • Should there be a different aggregator implementation?
  • Do we want to (are we able to) remove the post-process.py script?

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.

2 participants