-
Notifications
You must be signed in to change notification settings - Fork 5
feat: created transform/integrate.py and modeled after select.py #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #99 +/- ##
==========================================
- Coverage 69.67% 69.00% -0.67%
==========================================
Files 37 38 +1
Lines 3307 3339 +32
==========================================
Hits 2304 2304
- Misses 1003 1035 +32 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| """ | ||
| Select a dim or dim range of the input dataset, if the dimension is found. | ||
| """ | ||
| try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you do not need this block at all.
| dim_name = dset.get_dim_name(ds, self.dim) | ||
| except KeyError: # so if the user implements integrate but it hits this error, it'll still pass thru even tho it's wrong | ||
| return ds | ||
| if dim_name == "time": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.dim == "time": # we configured this integrate for time
if not dset.is_temporal(ds): return ds # but the ds isn't temporal
ds[self.varname] = dset.integrate_time(ds, self.varname, mean=self.mean)| return ds | ||
| if dim_name == "time": | ||
| ds[self.varname] = dset.integrate_time(ds, self.varname, mean=self.mean) | ||
| elif dim_name == "depth": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto the others
I'm submitting a PR but you shouldn't merge it for now because I just want to chat about it first. I had some questions I want to write down:
.integrate()and I was wondering why you didvar.weighted(msr.fillna(0))Anyway, that's a lot. I'm basically not seeing why we need an
integrate()base class when it just uses one of the child classes (integrate_time, integrate_space, integrate_depth) and doesn't actually do anything on it's own.I also haven't tested this since I wanted to discuss first.