Skip to content

Conversation

@msteckle
Copy link
Collaborator

@msteckle msteckle commented Nov 7, 2025

Closes #57

This allows the user to specify if they want to integrate the input variables of the expression over time before evaluation. This is a small addition to expression() that prevents us from writing unnecessary transforms that only require simple algebra.

Thought: This may need to be adjusted so that the user can specify mean or total. Right now, it is locked on mean.

@msteckle msteckle self-assigned this Nov 7, 2025
@msteckle msteckle requested a review from nocollier as a code owner November 7, 2025 01:31
@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.17%. Comparing base (a3e5df0) to head (39e90bb).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
+ Coverage   68.73%   69.17%   +0.44%     
==========================================
  Files          37       37              
  Lines        3272     3277       +5     
==========================================
+ Hits         2249     2267      +18     
+ Misses       1023     1010      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

def test_transform(name, kwargs, out, value):
transform = ALL_TRANSFORMS[name](**kwargs)
ds = transform(DATA[name])
print(ds[out].mean().values) # this value should be the correct one
Copy link
Contributor

Choose a reason for hiding this comment

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

This is helpful to figure out what the value is to check against, but then should be removed in the commit.

expr : str
An algebraic expression of the form "a = b + c" defining how to compute a new variable.
The lhs is the output variable name, and the rhs is a valid Python expression referencing existing dataset variables.
integrate_time : bool, optional
Copy link
Contributor

Choose a reason for hiding this comment

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

The only thing that I am not sure about is the name of this parameter. You know that a mean is not a lot different than a integral and can see that maybe sometimes we would want to integrate it. Since we talked about this I came to a realization:

By adding in this time mean to expressions, we are now making the transform do 2 things. I wonder if we should rather make a integrate_time transform with an option for mean or not which could be called in sequence before the expression transform.

This is the messy part of design. I cannot tell you how many times I have implemented something only to re-implement it not long after. I think, we keep this as is and let's chat about the above idea and see if we can agree that makes more sense :D

@nocollier nocollier merged commit 3cef891 into main Nov 7, 2025
6 checks passed
@nocollier nocollier deleted the time_integ_expression branch November 7, 2025 14:54
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.

T: Albedo

3 participants