-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add utils tests #24
Add utils tests #24
Conversation
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.
Thanks for all the work you put into this !
I added just a couple of points to address before merging the PR.
If you want, you can already change the behaviour of all get_slices_*
to return a list of dictionary {<dim>: <slice>}
(or IselDict
class (see below) instead of <slice>
objects. <dim>
will be along_track
or time
depending on the gpm object type ;) This will allow to directly pass each element of the list to the xarray isel
method ... without the need to specify the dimension.
I see two possible implementations:
- One solution is to make all current
get_slices
functions private and then define a newget_slices_*
functions that call the corresponding private functions and transform the list of slices in list of dictionaries. - Another solution is to add an argument like
return_isel_dict=True
to all currentget_slices_*
functions.
We could return an IselDicts
class
- which is initiated with a list of
{<dim>: <slice>}
- with an
__iter__
method so that you can easily loop over the list element or index by position - with the
union
/intersects
/difference
methods that allows the user to combine variousisel_dicts
objects derived from the variousget_slices_*
function. These methods should check that all are equal, and otherwise raise an error ;)
We can discuss about this in the coming days, and if you prefer I can also take care of implementing it ;)
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
==========================================
+ Coverage 43.95% 52.74% +8.78%
==========================================
Files 64 64
Lines 5339 5377 +38
==========================================
+ Hits 2347 2836 +489
+ Misses 2992 2541 -451 ☔ View full report in Codecov by Sentry. |
I adressed your comments! Regarding the change of behavior of |
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.
LGTM
Summary
Add tests for:
utils/checks.py
utils/slices.py
utils/time.py