-
Notifications
You must be signed in to change notification settings - Fork 11
Types take 2 #162
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?
Types take 2 #162
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,10 +44,9 @@ def select(self, ds: xr.Dataset) -> xr.Dataset: | |
| ds_out.append(ds_subset) | ||
|
|
||
| # Merge the subsetted datasets | ||
| ds_out = xr.merge(ds_out) | ||
| _ds_out = xr.merge(ds_out) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These happen b/c we are re-using variable names. It is harmless, but I like the readability of easily knowing that the variable changed its type and b/c of that deserves a new name.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm -- does In this code, there's quite a lot of processing of a Dataset step by step. -- each step usually creating a smaller Dataset -- so there is something to be said for re-using the same name so the old one will be immediately deleted. The actual data is probably lazy-loaded, so maybe it doesn't matter, but I think it's kind of clean. If we are going to use a new name at each step, maybe a meaningful one:
(I don't know if that's a good name, I haven't looked to see what this actually doing) Or even |
||
|
|
||
| ds_out = ds_out.assign({self._grid_topology_key: self._grid_topology}) | ||
| return ds_out | ||
| return _ds_out.assign({self._grid_topology_key: self._grid_topology}) | ||
|
|
||
|
|
||
| class SGrid(Grid): | ||
|
|
||
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.
This is a nice
mypy"find", by converting to anumpyarray early, the twonumpymethods we use (absoluteandargmin) are always applied to a numpy array and avoid surprises, like when a method has the same name, but different behaviour in similar objects. For example the dataframe.stdvs the numpy.stdmethods.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.
Doesn't
np.absolute(arrray_like)always return a numpy array anyway?